Total Pageviews

Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Monday, August 10, 2015

VirtualBox: Running Samba inside CentOS 7 guest and expose Samba shares to running Windows host

This was a problem puzzling me a complete day. My environment is as follows:
  • Running Windows 7 (64 Bit)
  • Using VirtualBox 5 to run CentOS 7 as Linux guest
I was looking for a solution to create a Samba share inside the CentOS guest, so I am able to access folders in the running CentOS guest from my Windows 7 host system.

I configured VirtualBox to use two network adapters (NAT and Host-Only).

I installed Samba on the CentOS guest and configured it as a Standalone Server. I created a Samba share called "data". See the full smb.conf here, the Samba share is defined at the end of the file:

 [global]  
      workgroup = WORKGROUP  
      server string = Samba Server Version %v  
      dns proxy = no  
      # log files split per-machine:  
      log file = /var/log/samba/log.%m  
      # maximum size of 50KB per log file, then rotate:  
      max log size = 50  
      security = user  
      passdb backend = tdbsam  
      load printers = yes  
      cups options = raw  
      server role = standalone server  
      encrypt passwords = true  
      guest ok = yes  
      usershare allow guests = yes  
      obey pam restrictions = yes  
      unix password sync = yes  
      passwd program = /usr/bin/passwd %u  
      passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .  
      pam password change = yes  
      map to guest = bad user  
 #============================ Share Definitions ==============================  
 [homes]  
      comment = Home Directories  
      browseable = no  
      writable = yes  
 ;     valid users = %S  
 ;     valid users = MYDOMAIN\%S  
 [printers]  
      comment = All Printers  
      path = /var/spool/samba  
      browseable = no  
      guest ok = no  
      writable = no  
      printable = yes  
 [data]  
      comment = Data Folder  
      path = /data  
      guest ok = yes  
      browseable = yes  
      create mask = 0777  
      directory mask = 0777  
      writable = yes  
      force create mode = 777  
      force directory mode = 777  
      force security mode = 777  
      force directory security mode = 777  

This Samba configuration works in an Ubuntu 14.04. VirtualBox guest OS perfectly. But no matter what I did, this configuration did not work in CentOS. I always got a "Permission denied" error when I tried to access the Samba share from the Windows host using

\\centos-guest\data\

Well it turned out, that the problem was a running firewall AND SELinux (Security-Enhanced Linux). To disable both do the following steps in CentOS:
  1. systemctl stop firewalld
  2. systemctl disalbe firewalld
  3. vi /etc/selinux/config

 # This file controls the state of SELinux on the system.  
 # SELINUX= can take one of these three values:  
 #   enforcing - SELinux security policy is enforced.  
 #   permissive - SELinux prints warnings instead of enforcing.  
 #   disabled - No SELinux policy is loaded.  
 SELINUX=disabled  
 # change  
 # SELINUXTYPE= can take one of these two values:  
 #   targeted - Targeted processes are protected,  
 #   minimum - Modification of targeted policy. Only selected processes are protected.  
 #   mls - Multi Level Security protection.  
 SELINUXTYPE=targeted  

After this, reboot the guest OS and you can access the samba shares of your CentOS guest on your Windows host.

But be warned, you disabled the firewall on your Linux guest OS!
If this is not what you want, you should find an alternative approach.

Saturday, January 25, 2014

How to install Couch DB 1.5 on Ubuntu

A recent task I had to do on my home Ubuntu Linux box running 12.04. LTS was to install CouchDB. I needed it because I wanted to use ACRA as remote error reporting tool for Android Apps. Acra is completely open source (hosted on GitHub) and an incredible cool tool started by Kevin Gaudin.

I used to try it out using Iris Couch but it turns out for me that Iris Couch using the free of charge account is painful slow. Thus I decided to host my own CouchDB at home.

The Ubuntu repositories doesn't host an up to date version of Couch DB. I tried it using apt-get and got CouchDB version 1.0.1. This was not a viable choice, because I wanted to use the replicate function of CouchDB which only is available on version higher than 1.2.

I found a pretty good step by step guide in the Apache CouchDB wiki.
To sum it up:

I installed it by compiling it from source

using the following steps.

  1. Download CouchDB 1.5 sources
  2. Create a user and a group with name 'couchdb'. This is very important. Don't compile and install it with user 'root'. If you do it with root, CouchDB will not start nor write any error messages to any log file, because CouchDB will start under user 'couchdb' but all installed files and folders don't allow read or write access for any other user than 'root'. If you have compiled and installed it with user 'root' you have to adjust the permissions and owner rights of various files and folders by yourself. I have to admit that I did it with user 'root' the first time and it took me two hours to search for the causes and correct everything. So be warned ;-)
  3. Install at least the following packages.
  4.  sudo apt-get install -y g++  
     sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe erlang-eunit erlang-nox erlang-xmerl erlang-inets  
     sudo apt-get install -y libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool  
    
  5. Extract and compile CouchDB using default installation directory /usr/local. You can change it by using a different --prefix when calling configure. Check manual.
  6.  cd /tmp && tar xvzf apache-couchdb-1.5.0.tar.gz  
     cd apache-couchdb-*  
     ./configure && make  
    
  7. Install CouchDB. CouchDB installs into /usr/local
  8.  sudo make install  
    
  9. Sometimes it's necessary to remove old stuff from ubuntu packages. This was not necessary in my case. But you can do the following:
  10.  sudo rm /etc/logrotate.d/couchdb /etc/init.d/couchdb  
    
  11. Install init scripts and logrotate
  12.  sudo ln -s /usr/local/etc/logrotate.d/couchdb /etc/logrotate.d/couchdb  
     sudo ln -s /usr/local/etc/init.d/couchdb /etc/init.d  
     sudo update-rc.d couchdb defaults  
    
  13. Verify that CouchDB is running
  14.  curl http://127.0.0.1:5984/  
    
    It should give you an output like this:
     {"couchdb":"Welcome","uuid":"5a23983ac768251e1c8d413bb52e67b5","version":"1.5.0","vendor":{"version":"1.5.0","name":"The Apache Software Foundation"}}  
    
  15. With this setup, CouchDB only listens on localhost (127.0.0.1). If you want CouchDB to listen on all interfaces and access it externally you have to configure it in /usr/local/etc/couchdb/local.ini
    Just look for the [httpd] section and uncomment the line starting with 'bind_address' and replace 127.0.0.1 with 0.0.0.0
  16.  [httpd]  
     ;port = 5984  
     bind_address = 0.0.0.0  
    
  17. Now restart CouchDB and you are done.
  18.  /etc/init.d/couchdb restart  
    
You are also able to install a CouchDB version built by source alongside the default Ubuntu package. Check out the step by step guide mentioned above to look how this is being achieved.

Monday, December 09, 2013

Useful Subversion pre-commit hook script for Linux servers

Looking for useful subversion pre-commit hooks? Maybe this script is for you. It's a Linux bash shell script and makes also use of python.
The script does the following:

  1. Checks whether the commit message is not empty
  2. Checks whether the commit message consists of at least 5 characters
  3. Checks if the committed files are UTF-8 compliant
  4. Checks whether the svn:eol-style property is set to LF on newly added files
  5. Checks if the committed files have no TAB characters

The UTF-8 and TAB checks are performed on the following file suffixes
  • *.java
  • *.js
  • *.xhtml
  • *.css
  • *.xml
  • *.properties (only check for TABs here, no check for UTF-8 compliance)
It should be easy to adjust those settings to your needs.

 #!/bin/bash  
   
 REPOS="$1"  
 TXN="$2"  
   
   
 # Make sure that the log message contains some text.  
 SVNLOOK=/usr/bin/svnlook  
 ICONV=/usr/bin/iconv  
   
 SVNLOOKOK=1  
 $SVNLOOK log -t "$TXN" "$REPOS" | \  
 grep "[a-zA-Z0-9]" > /dev/null || SVNLOOKOK=0  
 if [ $SVNLOOKOK = 0 ]; then  
  echo "Empty log messages are not allowed. Please provide a proper log message." >&2  
  exit 1  
 fi  
   
 # Comments should have more than 5 characters  
 LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | grep [a-zA-Z0-9] | wc -c)  
   
 if [ "$LOGMSG" -lt 6 ]; then  
  echo -e "Please provide a meaningful comment when committing changes." 1>&2  
  exit 1  
 fi  
   
 # Make sure that all files to be committed are encoded in UTF-8.  
 while read changeline;   
 do  
   
   # Get just the file (not the add / update / etc. status).  
   file=${changeline:4}  
   
   # Only check source files.  
   if [[ $file == *.java || $file == *.xhtml || $file == *.css || $file == *.xml || $file == *.js ]] ; then  
     $SVNLOOK cat -t "$TXN" "$REPOS" "$file" | $ICONV -f UTF-8 -t UTF-8 -o /dev/null  
     if [ "${PIPESTATUS[1]}" != 0 ] ; then  
       echo "Only UTF-8 files can be committed ("$file")" 1>&2  
       exit 1  
     fi  
   fi  
 done < <($SVNLOOK changed -t "$TXN" "$REPOS")  
   
 # Check files for svn:eol-style property  
 # Exit on all errors.  
 set -e  
 EOL_STYLE="LF"  
 echo "`$SVNLOOK changed -t "$TXN" "$REPOS"`" | while read REPOS_PATH  
 do  
  if [[ $REPOS_PATH =~ A[[:blank:]]{3}(.*)\.(java|css|properties|xhtml|xml|js) ]]  
  then  
   if [ ${#BASH_REMATCH[*]} -ge 2 ]  
     then  
   FILENAME=${BASH_REMATCH[1]}.${BASH_REMATCH[2]};  
   
   # Make sure every file has the right svn:eol-style property set  
    if [ $EOL_STYLE != "`$SVNLOOK propget -t \"$TXN\" \"$REPOS\" svn:eol-style \"$FILENAME\" 2> /dev/null`" ]  
     then  
     ERROR=1;  
       echo "svn ps svn:eol-style $EOL_STYLE \"$FILENAME\"" >&2  
    fi  
   fi  
  fi  
  test -z $ERROR || (echo "Please execute above commands to correct svn property settings. EOL Style LF must be used!" >& 2; exit 1)  
 done  
   
   
   
 # Block commits with tabs  
 # This is coded in python  
 # Exit on all errors  
 set -e  
   
 $SVNLOOK diff -t "$TXN" "$REPOS" | python /dev/fd/3 3<<'EOF'  
 import sys  
 ignore = True  
 SUFFIXES = [ ".java", ".css", ".xhtml", ".js", ".xml", ".properties" ]  
 filename = None  
   
 for ln in sys.stdin:  
   
     if ignore and ln.startswith("+++ "):  
         filename = ln[4:ln.find("\t")].strip()  
         ignore = not reduce(lambda x, y: x or y, map(lambda x: filename.endswith(x), SUFFIXES))  
   
     elif not ignore:  
         if ln.startswith("+"):  
           
            if ln.count("\t") > 0:  
               sys.stderr.write("\n*** Transaction blocked, %s contains tab character:\n\n%s" % (filename, ln))  
               sys.exit(1)  
   
         if not (ln.startswith("@") or \  
            ln.startswith("-") or \  
            ln.startswith("+") or \  
            ln.startswith(" ")):  
   
            ignore = True  
   
 sys.exit(0)  
 EOF  
   
 # All checks passed, so allow the commit.  
 exit 0  
   

Wednesday, September 11, 2013

Pitfalls installing wordpress on a Linux box using Multisite with sub directories

This post is not about installing wordpress on a Linux box. It just covers two problems I have faced when installing wordpress 3.6 on my Ubuntu 12.04 box at home.
I did install wordpress using the distributed zip archive following the detailed instructions on the wordpress site. Setting up the database and editing the PHP config files was no problem.
The installation went smooth and everything was working as expected.

Problem 1: Configuring Multisite

Multisite is a great feature of wordpress. It gives you the ability to create more than one site (or blog) within your wordpress installation.
I did the setup using this step-by-step guide. So far so good. With my new multisite feature enabled I wanted to create a new site and filled in the necessary informations for it. The creation succeeded without an error and when I clicked on the dashboard of the newly created site I got a "Page Not Found" error.
Hm ... googling around I didn't really find a good answer.
I decided to check the network administration guide of the wordpress documentation and found a really helpful paragraph about using mod_rewrite (multisite feature needs mod_rewrite) and Apache Virtual Hosts.
My Apache installation is using virtual hosts so what finally did the trick was to add these lines to my VirtualHost section:


 <VirtualHost *:80>    
  <Directory /var/www/vhosts/wordpress>  
   AllowOverride Fileinfo Options  
  </Directory>  

Problem 2: Changing the domain name (or change the URL)

I am using DynDNS and I (and my users) want to access the wordpress installation from the internet. During the installation I did not realize that this was so important, because I thought I can change it easily afterwards. Well, changing it in a Non-Multisite environment is easy, but it turns out that a change of the domain name in a multisite installation is a little bit harder.
What helped me a lot was this documentation on the wordpress site.
Because my installation was totally fresh I skipped the step to make a backup of my database. I walked through all tables of the database and replaced every occurrence of my old domain name with the new DynDNS domain name.
Finally I changed the DOMAIN_CURRENT_SITE attribute in the wp-config.php file to point to the DynDNS name as well and after that my multisite wordpress installation was accessible via the DynDNS url.

I can't say whether it would have been easier to change the domain name before I activated the multisite feature, but it would make sense to me.

Anyway, it works now.

Sunday, December 30, 2012

Friday, December 28, 2012

Pure-FTP Daemon unter Ubuntu Linux installieren und konfigurieren

Und noch eine Perle der Installationsdokumentationen zum Aufsetzen eines FTP Servers (hier Pure FTP unter Ubuntu/Debian). Unter diesem Link findet sich eine schnelle und wie ich finde gut geschriebene, verständliche Anleitung zum Aufsetzen eines FTP Servers.

Mailserver für einen Homeserver unter Linux einrichten

Wer schon immer mal einen Mailserver auf seinem eigenen Server zu Hause betreiben möchte (Stichwort DynDNS), der sollte sich mal diese wirklich gute Anleitung durchlesen.
Die dort beschriebenen Komponenten

  • Postfix
  • Dovecot
  • Fetchmail
  • Sieve

harmonieren sehr gut zusammen.
Generell ist das komplette Wiki dort sehr gut aufgebaut und enthält einige sehr nützliche und tolle Anleitungen.

Saturday, December 22, 2012

Remove all unused Ubuntu Kernel images, headers and modules

Seeing that my linux box is running low on free space I decided to remove all unused Linux kernel images on my Ubuntu 10.04 system.
For some unknown reason Ubuntu Tweak refused to install properly so I decided to go a different way and used the command from this blog article.

The command mentioned in the blog is

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge  


If you don't understand what this command does I recommend to dig into the topic. I must admit it is a little bit complex, but the command is working well.

Use it at your own risk!

Now my system is cleaned up and still boots the correct and latest kernel. All other kernel images, headers and modules are completely removed.

Friday, July 13, 2012

How to flush DNS cache

Sometimes it's good to know how to flush the DNS cache on your Linux or Windows box. Here is how to do it:

Linux

Restart the nscd daemon. In case it is not installed install it first

 apt-get install nscd  

then type the command

 sudo /etc/init.d/nscd restart  

or

 sudo service nscd restart  

There are a few alternatives to flush the DNS cache under Linux. See this blog posting to get a more complete overview.

Windows

Open a command shell and type

 ipconfig /flushdns  



Thursday, July 12, 2012

Solving "Too many open files" under Linux

Every now and then I got this error and everytime I start googling around how to fix this. So now I have decided to write it down and publish it to avoid using Google or any other search engines.

On any Linux most if not everything "is a file".
This is also the case for network connections. Thus, the error message "Too many open files" is more likely the problem of "Too many open connections".

The message comes from the operating system to tell you that the application opened a large number of connections. The Linux kernel has several securities to prevent an application from slowing the system by opening too many file handles.

In Linux there are two limits:
  • A global limit specifying the total amount of open file descriptors by the whole system
  • A per-process limit specifying the total amount of open files that can be opened by an application

Specifying the global limit

Determine the global limit with the command

 cat /proc/sys/fs/file-nr  

The result is a set of 3 numbers:

 1408  0    380226  

  1. The amount of currently opened file handles
  2. The number of free allocated file handles
  3. The maximum number of allowed file handles for the whole system
The maximum number on Ubuntu systems is somewhere around 300000. This should suffice in most of the cases. However, if you want to increase the size edit the file /etc/sysctl.conf as root and add/edit this:

 fs.file-max = 380180  

After editing you have to reconnect or restart your system for changed to be taken into account.

Specifying the per-process limit

To get the maximum value of file handles an application can open run this command

 ulimit -n  

Be aware, that this limit depends on the user running the application. You might get different results depending on the user running ulimit -n

On Ubuntu systems the value is set to 1024 which is in certain situations too low.
To permanently increase the value edit file /etc/security/limits.conf as root and add the following lines

 *      hard  nofile   65536  
 *      soft  nofile   65536  
 root   hard  nofile   65536  
 root   soft  nofile   65536  

With these settings any application running under any user can open a maximum amount of 65536 files. That should be enough in most cases.

The meaning of the four columns are:
  1. The name of the user the setting applies to. A "*" means every user except for user "root"
  2. Either "hard" or "soft" are possible values. A hard limit is fixed and can not be modified by a non-root user. A soft limit may be modified to the value up to the hard limit
  3. The type of resource to be limited. "nofile" means number of open files.
  4. The number of the limit to be set. In the case above the limit is always set to 65536
You have to reboot your system to apply the changes.

There is also a temporary method to set the per-process limit.

 ulimit -n 65536  

This limit of 65536 open files only applies for the life of the session or shell and is lost if you reconnect or restart your system. The value cannot be higher than those specified in /etc/security/limits.conf except if you are acting as user root.

How to measure the number of open files used?


To get the number of open files used by your application type:

 ps -aux | grep $APPLICATION_NAME  

$APPLICATION_NAME is the name of the process you want to get the process id for. This can be "java" for a running Java virtual machine or "tomcat" for a running tomcat container or XXX for any other application.

Copy the process id and enter:

 lsof -p $PROCESS_ID | wc -l  

where $PROCESS_ID is the process id you received from the ps command. The command returns the number of open files used by the process you specified.

Thursday, March 01, 2012

Setting up an Apache cluster under RedHat Enterprise Linux

If it ever happens that you have to set up an Apache Linux cluster, I highly recommend the step-by-step manual from clusterlabs.org.
The docs are really easy to read and are very helpful.
I only have two negative points:

  1. Sometimes the commands you have to enter into the console are not clearly separated from the parameters or text you have to pass. Example:
    cat <<-END >>/etc/corosync/service.d/pcmkservice {
            # Load the Pacemaker Cluster Resource Manager
            name: pacemaker
            ver:  1
    }
    END
    The file to create is called /etc/corosync/service.d/pcmk (NOT pcmkservice) and the content of the file starts with "service {
    # Load the Pacemaker ..."
    I assume this has something to do with the formatting of the docs.
  2. The docs almost never tell you what to do in case things go wrong or you did a typo or your environment differs from the one used in the docs.
    In that case you have to use google and cross your fingers or use other resources like this one.
After all I only had to consult google once during the complete setup.
My failover tests succeeded after a few hours of setup including writing a howto for my specific setup.
Now the cluster works using corosync and pacemaker as services.

Friday, February 10, 2012

Updating GlassFish 3.1 under RHEL 6 on a 64 Bit machine

Don't be surprised when you have problems updating GlassFish 3.1 on a RedHat Enterprise Linux 6 64 Bit machine. This will not work out of the box (officially Oracle only supports GlassFish on RedHat 4 and 5 not on version 6). But there is a way to get it to work.
You will get this error when executing the pkg command:

 [glassfish@MYMACHINE glassfish3]$ pkg list -u  
 Traceback (most recent call last):  
  File "/opt/glassfish/glassfish3/pkg/bin/client.py", line 61, in ?  
   import pkg.actions as actions  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/actions/__init__.py", line 59, in ?  
   globals(), locals(), [modname])  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/actions/link.py", line 36, in ?  
   import generic  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/actions/generic.py", line 45, in ?  
   import pkg.variant as variant  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/variant.py", line 28, in ?  
   from pkg.misc import EmptyI  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/misc.py", line 49, in ?  
   import zlib  
 ImportError: libz.so.1: cannot open shared object file: No such file or directory  
 ---------------------------------------------------------------  
 There was an error running  
   
 /opt/glassfish/glassfish3/pkg/bin/../python2.4-minimal/bin/python  
   
 You are running on a 64 bit Linux distribution and the 32 bit Linux  
 compatibility libraries do not appear to be installed. In order to use  
 the Update Center tools you must install the 32 bit compatibility libraries.  
   
 On Ubuntu (and possibly other Debian based systems) please install the  
 ia32-libs package. On RedHat 4 (and other RPM based systems), you may  
 need to add multiple 'compat' runtime library packages. Please see the  
 Update Center Release Notes for more information.  
   
   

The solution is to install the following packages using yum

yum install compat-db.i686 zlib.i686 libidn.i686 krb5-libs.i686

The trick is to find out about the correct names of the packages. It's easy on Debian based systems but quiet difficult on RPM based systems.
If you are using CentOS take a closer look at this blog post.

Friday, January 06, 2012

How to solve " Target Filesystem doesn't have /sbin/init" on Ubuntu 10.04


I restarted my Ubuntu 10.04 box today and it wouldn't start. It gave me this error:

 mount: mounting /dev/disk/by-uuid/***************************** on /root  
 failed: Invalid argument  
 mount: mounting /sys on /root/sys failed: No such file or directory  
 mount: mounting /dev on /root/dev failed: No such file or directory  
 mount: mounting /sys on /root/sys failed: No such file or directory  
 mount: mounting /proc on /root/proc failed: No such file or directory  
 Target file system doesn't have /sbin/init  
 No init found. Try passing init= bootarg  

So after googling around I found out that this seems to be a common problem ;-)
I have a JMicron RAID controller in my box using a RAID mirror but that doesn't help very much :-( It's a logical error and therefore replicated on the other disk as well.

I found this forum entry which helped me a lot and applied the fix using the following steps:
  1. Install GParted on an USB Stick using Tuxboot (my Linux box does not have a DVD drive)
  2. Boot GParted and wait until the graphical partition editor comes up
  3. Identify the boot partition (mounted on /). My boot partition is named "/dev/mapper/jmicron_GRAID1"
  4. Open a terminal and type in the following command
    sudo e2fsck -f -y -v /dev/mapper/jmicron_GRAID1
  5. When e2fsck finishes it usually must have been corrected some errors. So it's best to take a look into the summary.
  6. Reboot your system
After I applied these steps my system booted up without errors again.
Now I need to identify the source of the problem ...

Wednesday, December 07, 2011

Wie man die Größe des Systemfonts in Ubuntu 11.10 ändern kann

Bei Ubuntu 11.10 ist es leider nicht mehr so einfach möglich, den System Font bzw. seine Größe zu ändern.

Auf meinem Netbook ist der Font für mich viel zu groß.

Diese Anleitung zeigt, wie man den Font ändern kann. Ist mir ein Rätsel, warum Ubuntu das nicht standardmäßig in den Systemeinstellungen möglich macht.

Howto configure additional swap file on Linux

I had to restore my linux box from a backup and I also had to configure an additional swap file. Here is a good tutorial how to do this.

Great and short tutorial about Sieve mail filtering

The Sieve mail filtering language is great for filtering email messages on the server side. 
 
I use it heavily for my IMAP account on my homeserver. There is a really good and short tutorial about the syntax with great real world examples. Go and check it out.
 
An introduction to Sieve, the mail filtering language. This tutorial introduces the basic building blocks of a Sieve filter and explains the conceps with many examples.

Thursday, November 12, 2009

Fixing hibernation problem under Ubuntu 9.10

Recently I upgraded my Ubuntu Linux 9.04 to the latest Ubuntu 9.10 on my Acer Aspire 5652 laptop. So far so good. The upgrade went smooth and without any problems and after 40 minutes I was able to take a look at the latest Ubuntu release.

Soon I found out that neither suspend nor hibernate were working. After resuming I got a blank black screen and I was not able to fix this problem with infos from the ubuntu forums.
I decided to install a fresh Ubuntu 9.10 on my laptop because I wanted to benefit from ext4, a better startup time and the newest grub.
After installation succeeded I really was impressed by the startup time. Even after I installed all the programs I used on Ubuntu 9.04 the startup time was nearly twice as fast. But one problem was still there: Neither suspend nor hibernate did work.

One of the answers in the forum was to wait for a patch but this is no option for me because I need at least hibernation on my laptop.

So I found this link to be very useful: http://www.ubuntugeek.com/fix-for-suspend-and-hibernation-problem-for-laptops.html

It shows how to use the "Userspace Software Suspend" program to fix hibernate or suspend problems.

As root I edited the file
/etc/pm/config.d/00sleep_module

and changed the line
SLEEP_MODULE="kernel"
into
SLEEP_MODULE=”uswsusp”

and all of a sudden hibernation is working again. I still cannot use suspend but for now I can live with it.

UPDATE: 2009-11-29
With the latest Ubuntu updates my hibernation and suspend problems are gone, so I switched back to kernel suspend mode.

Monday, June 01, 2009

Switching my home Linux server from Knoppix to Ubuntu

My Linux box at home crashed during a distribution upgrade of my Knoppix version. I always had troubles in doing a distribution upgrade of my Knoppix server. So I decided to switch to Ubuntu 9.04.
The server is back since yesterday but not all the services are running.
I hope I will not regret this decision.

Monday, April 27, 2009

Encoding mp3 under Ubuntu Linux

I recently ran into a problem encoding some audio files under my Ubuntu Linux 8.10. There was no way I could bring the "Audio CD Extractor" or "Rhythmbox Music Player" to encode my CDs to mp3.
It took me some time to figure out what the problem was. There should be at least three packages installed, to be able to encode audio files to mp3:

lame
gstreamer0.10-plugins-ugly
gstreamer0.10-plugins-ugly-multiverse

My Ubuntu 8.10 did not have the last one installed. So I did a quick

"apt-get install gstreamer0.10-plugins-ugly-multiverse"

and the problem was solved.
The last thing I did was to create and activate an mp3 profile in the preferences dialog of the "Audio CD Creator"

Thursday, October 16, 2008

Problem solved: Eclipse with Cypal Studio, m2eclipse running GWT Hosted Mode under Linux

I am developing a GWT application on my laptop which runs on Ubuntu 8.
I am using Eclipse 3.4 with the m2eclipse plugin (my project is built using Maven 2) and Cypal Studio as GWT plugin. So far, nothing fancy one should think.
But there are a few things to overcome with:
  1. When you import your Maven project using m2eclipse the web project containing the GWT code will not be configured correctly to work with Cypal Studio. I haven't figured out yet the reason why, but a workaround to this problem is to generate the eclipse project files for the web project by executing "mvn eclipse:eclipse" manually. Now you are able to add a working "Run configuration" for the GWT hosted mode in eclipse.
  2. I started the newly created "Run Configuration" and got an error message stating that a file called "libswt-pi-gtk-3235.so" was missing. So I copied that one from the installed GWT 1.5.2 distribution to my local maven repository into the directory $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION.
  3. Now, choosing "Run" one would expect to see a starting hosted mode browser (namely Mozilla Firefox). But the only thing I saw was an error message saying "** Unable to find a usable Mozilla install **". Hm, I had installed the latest GWT distribution (1.5.2) and I had configured the path correctly within the Cypal preferences. The dependencies for the web project were all correctly managed by m2eclipse. So what the hell was going wrong?
    Well it turns out to be a problem with the gwt-dev-1.5.2-linux.jar dependency and the way Cypal (or GWT) resolves dependencies.
    The gwt-dev-1.5.2-linux.jar was a dependency of my web project. So Cypal (or GWT) assumes to have a valid GWT distribution and therefore a runnable Mozilla Firefox installed in the directory $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION. That was obviously not the case.
    So I copied ALL *.so files and the file mozilla-hosted-browser.conf from the GWT distribution directory to the $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION folder.
  4. The last thing was to edit the mozilla-hosted-browser.conf file and point to the mozilla-firefox installation of the GWT distribution. I did this using absolut path arguments (eg. /usr/local/share/gwt/gwt-1.5.2/mozilla-1.7.12).
  5. Now Cypal starts the GWT Hosted mode with the Mozilla Firefox browser.
I am aware of the fact that this is not the best solution. Poluting the maven directory with shared object files of the GWT distribution is somehow weird. But so far this is the only working scenario I have successfully configured and running with.
If you have a better solution don't hesitate to comment on this entry.