I'm using Ubuntu installed inside windows with Wubi.

During upgrade to 12.04 I came across a rather devious trap. About 25% through the installation of packages, I get the message that packages can't be installed due to lack of disk space on /usr. And of course, its down to 140M when I check.

So what to do? Can't interrupt, can't continue. Since I have a huge disk that seems accessible, which is /host, namely the USB HDD I have Ubuntu installed on, I figure what the heck, perhaps I can copy over some files there and then make links to them in /usr. So I tried sudo mv /usr/lib /host/usr, but all this did was cause error messages and leave the files in place, while creating copies in /host/usr, a behaviour I found oddly disconcerting: What happened? Did some files get moved and some not?

So I figured, perhaps I can check and see if I can remove some stuff with apt-get, but that gave the error that there was a lock on the dpkg something or other, "perhaps it is used by another process?".

What's left to do? I clicked through the warnings of packages not being installed and rebooted, and now startup is aborted and I end up at the text-only login prompt.

So, my installation is screwed, I'll probably just reinstall and do it without Wubi this time.

My question is two-fold:

  1. Why wouldn't an installation process check disk space required before I click ok? Especially when it cannot be interrupted.
  2. Is there a way to get around these kind of traps, where you need space now. What tricks are there?
  • 1
    This is a bug. The upgrade needs > 2GB free space (I'd say minimum 3GB), but the check only thinks it needs ~1.5GB: bugs.launchpad.net/ubuntu/+source/update-manager/+bug/986272 – bcbc May 10 '12 at 16:48
  • 1
    @bcbc This is an answer, not a comment. I'd be curious to see any tips for clearing disk space too. I read in another answer that you could use apt-get clear, but I am not sure that would affect the /usr partition. – TLP May 11 '12 at 13:26
  • @TLP there's no such apt-get command as clear. I hit this same issue. Note that if you run sudo apt-get clean during the upgrade, it deletes the necessary files and fails. What a frustrating bug! I've wasted hours upgrading from version 9 to 10 and now to 12 on a small robot with inadequate storage for such an upgrade. Looks like I'll have to do a fresh install from a USB key. – Drew Noakes Oct 20 '12 at 0:00

Upgrade manager running out of space

As mentioned in comment, this is a bug. This isn't supposed to happen. Make sure you have 3GB or more before running the upgrade.

Freeing up space while the upgrade is running

You can't use apt-get since the update-manager is already holding the package locks. You also can't manually delete the package cache since it's probably got all the packages in it you've just downloaded.

All you can do is move personal data and manually delete non-essential files:

  1. Move personal data from Documents, Pictures etc. to /host
  2. Delete large files in Downloads e.g. ISOs
  3. Clear your browser cache manually e.g. ~/.mozilla/firefox/Cache or ~/cache/google-chrome/Default/Cache. This can free up 1GB sometimes.
  4. Manually remove older kernels by looking in /boot and deleting all but the latest vmlinuz-..., initrd.img-..., System.map-..., abi-... and config-... (this can free up a couple of hundred MB if you have a lot of old kernels).
  5. Use the disk usage analyzer to look for large logfiles or hidden data that you can delete or move.

I still think this is simply a bug that must be fixed, rather than trying to find a solution. Running around deleting or moving data isn't a really great solution (and obviously carries some risk if you accidentally remove something essential or of personal value.

  • The space you refer to all sit on other partitions, though. Cache, documents, pictures and even /boot, I think. I went with the standard options when installing, which seems silly now, because most of them are near empty, while /usr is full. – TLP May 11 '12 at 17:00
  • I thought you said you were running a Wubi install. The only reason to have a separate virtual partition for /usr is if you installed on a FAT32 partition (4GB file maximum size) or you created it manually. – bcbc May 11 '12 at 17:03
  • I am running a Wubi install, and chose the max size I could for the Ubuntu install, which was not a lot. It created partitions for me, as I recall, though at the moment I cannot check what they were. /usr was created with something like 3,9Gb, according to output from df. Then there was perhaps 4-6 other partitions of varying sizes. I've no idea if the external HDD uses FAT32, but I am running WinXP. – TLP May 11 '12 at 17:12
  • It must be a FAT32 partition then. In that case there's not much you can do (at least from my answer). sudo apt-get autoremove might free up space (but you cannot run it during an upgrade). Here's a link that has a suggestion: serverfault.com/a/383584 – bcbc May 11 '12 at 17:27
  • No prob. My /usr is currently 4.2GB. Not sure how that would work with a Wubi FAT32 install. I also couldn't see a lot of space saving there (even /usr/share/doc wouldn't bring it down to less than 4GB). Maybe it's time to consider migrating or at least installing Wubi on an NTFS partition (where you can have a 30GB virtual disk) – bcbc May 11 '12 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.