Mount error (12) after upgrade to Ubuntu 12.04

I recently upgrade an Ubuntu server from 10.04 to 12.04 and I encountered this error when trying to mount a cifs folder on a Windows 7 machine.

mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

I suspected it was related to the recent upgrade but it turns out that the error was caused by the Windows 7 system. I only mount this folder on rare occasions when I want to back up some folders to this system. Therefore I can not be sure if the problem was caused by my recent server update or some recent Windows 7 updates.

I found the solution in this post and some more details here:

These registery items need to be changed to make Windows 7 act more as a file server and prevent the error:

  • HKLMSYSTEMCurrentControlSetControlSession ManagerMemory ManagementLargeSystemCache change to 1
  • HKLMSYSTEMCurrentControlSetServicesLanmanServerParametersSize change to 3

Setting up permalinks on WordPress

This site runs on a Ubuntu 12.04 LAMP server behind another Ubuntu Apache proxy using a virtual host. When I tried to set up the permalinks it didn’t work straight away. The .htaccess file was correct and mod_rewrite was enabled. It was the virtual host that had some issue.
The website has been configured under /var/www/blog.your-site.name and these are the steps you should take to make sure the permalinks work:

  • Open .htacces in /var/www/blog.your-site.name and change it to look like this:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
  • Enable mod_rewrite for Apache:
    sudo ae2enmod rewrite
  • Create your host configuration in /etc/apache2/sites-available/blog.your-site.name and make it look like this:

    <VirtualHost *:80>
        ServerName blog.your-site.name
        ServerAdmin admin@your-site.name
    
        DocumentRoot /var/www/blog.your-site.name
        
            Options FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
        
        
            Options Indexes FollowSymLinks -MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
        
    
    
        ErrorLog ${APACHE_LOG_DIR}/blog.your-site.name-error.log
    
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
    
        CustomLog ${APACHE_LOG_DIR}/blog.your-site.name-access.log combined
    
    </VirtualHost>
    

That should do the job.

Ubuntu mirror problems

Ubuntu logo ubuntu.comWhen I started what I thought would be a simple update of a few of my Ubuntu server virtual machines I didn’t know how much trouble the mirrors would give me.
For a start, the sg. mirror failed to load completely. Then I found some info about ec2 mirrors, but they gave me Hash Sum mismatch problems.
Then I came across the mirror:// schema, that worked great and I managed to upgrade one system. Funny enough, I would expected the upgrade from 10.04 to result in a 12.04 but I ended up with 11.10?? Not so sure if I started with a different version or the failed update and upgrades caused this.

Now my problems really started. Trying to upgrade from 11.10 Oneric to 12.04 Precise seemed impossible. If I would use the mirror://mirrors.ubuntu.com/mirrors.txt the mirrors would fail and no package information was downloaded. Next, using the ec2 it wouldn’t even try to download as the Hash would fail.

In the end I logged into a Ubuntu server I manage in the Netherlands and download the http://mirrors.ubuntu.com/mirrors.txt. This is the list I downloaded from the Netherlands:

http://ftp.telfort.nl/pub/mirror/ubuntu/
http://ubuntu.mirror.cambrium.nl/ubuntu/
http://ftp.snt.utwente.nl/pub/os/linux/ubuntu/
http://nl3.archive.ubuntu.com/ubuntu/
http://nl.archive.ubuntu.com/ubuntu/
http://ubuntu.mirror.atratoip.net/ubuntu/
http://ubuntu.tiscali.nl/
http://osmirror.rug.nl/ubuntu/
http://mirror.nl.leaseweb.net/ubuntu/
http://mirror.i3d.net/pub/ubuntu/
http://ftp.tudelft.nl/archive.ubuntu.com/
http://mirrors.nl.eu.kernel.org/ubuntu/

Compared to the one from Singapore:

http://linux.ntuoss.org/ubuntu/
http://mirror.nus.edu.sg/ubuntu/
http://download.nus.edu.sg/mirror/ubuntu/
http://ubuntu.oss.eznetsols.org/ubuntu/
http://archive.ubuntu.com/ubuntu/

The tudelft seemed the most reliable source and when I replaced my mirrors with this one I managed to finally upgrade the server to 12.04.

So much for Ubuntu being the most user friendly Linux distro around. And shame on the mirrors in Singapore for being of such poor standard.

Kernel hording

Ubuntu logo ubuntu.comAfter my previous successful and speedy upgrade I thought I would continue to the 12.04 precise. However, I found myself running out of space of the /boot drive. That left me wondering why I made it this small but I think it is really a default setup. This is the message I saw when performing the do-release-upgrade:

Not enough free disk space

The upgrade has aborted. The upgrade needs a total of 24.7 M free
space on disk '/boot'. Please free at least an additional 13.9 M of
disk space on '/boot'. Empty your trash and remove temporary packages
of former installations using 'sudo apt-get clean'.

The recommended sudo apt-get clean didn’t really free anything, the next thing recommended was editing the size of the boot partition but I didn’t have the nerve to do that on a running system so I searched on…
Turns out I have been hording my old kernels. Then I found the following tool…. but…
Install yum-yutils:apt-get instal yum-utils
Run:package-cleanup --oldkernels --count=3 --keepdevel
And get:

Traceback (most recent call last):
  File "/usr/bin/package-cleanup", line 384, in 
    util = PackageCleanup()
  File "/usr/bin/package-cleanup", line 59, in __init__
    self.main()
  File "/usr/bin/package-cleanup", line 337, in main
    self._remove_old_kernels(opts.kernelcount, opts.keepdevel)
  File "/usr/bin/package-cleanup", line 273, in _remove_old_kernels
    (kver,krel) = runningkernel.split('-')
ValueError: too many values to unpack

Anyway, it is pretty easy to clean up the old kernel by hand.

rm /boot/*2.6.38-11-server
rm /boot/*2.6.38-12-server
rm /boot/*2.6.38-13-server
rm /boot/*2.6.38-14-server

Ubuntu release upgrade

Ubuntu logo ubuntu.comAfter my previous problem trying to update my Ubuntu server running 10.04 I tried to do a release upgrade.

Before I was able to do this I had to change the sources.list again, this time I used the mirror schema as recommended here.

Old:

deb http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ lucid main restricted

New:

deb mirror://mirrors.ubuntu.com/mirrors.txt lucid main restricted
deb-src mirror://mirrors.ubuntu.com/mirrors.txt lucid main restricted

The download of 430MB was pretty quick and took around 5 min to complete. Installation took a lot longer…

Ubuntu repository Singapore failures

Ubuntu logo ubuntu.comI just notice that when trying to update some of the Ubuntu server I have running that they can not find the archives. This is the error I get:

Err http://sg.archive.ubuntu.com lucid Release.gpg
Could not connect to sg.archive.ubuntu.com:80 (111.90.255.252). - connect (111: Connection refused)

I found some info about archives being hosted on the Amazon ec2 cloud so I decided to switch repository. To do this problem open the sources.list found under /etc/apt/sources.list

Original entries from sources.list

deb http://sg.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://sg.archive.ubuntu.com/ubuntu/ lucid main restricted

New entries in sources.list

deb http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ lucid main restricted

Now I am able to connect but I end up with the following error:

Fetched 1 B in 3s (0 B/s)
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_natty-security_main_source_Sources Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

Not much I can do about this. The same error occurs on different network locations and using different archives and different version of Ubuntu. Let’s hope they fix it soon.
You can check the mirrors that are available for your location here.