0

I am using Ubuntu 14.04. When I run sudo apt-get autoremove, it generated the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-extra-4.4.0-34-generic (4.4.0-34.53~14.04.1) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-34-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.4.0-34-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-34-generic (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic-lts-xenial:
 linux-image-generic-lts-xenial depends on linux-image-extra-4.4.0-34-generic; however:
  Package linux-image-extra-4.4.0-34-generic is not configured yet.

dpkg: error processing package linux-image-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-lts-xenial:
 linux-generic-lts-xenial depends on linux-image-generic-lts-xenial (= 4.4.0.34.24); however:
  Package linux-image-generic-lts-xenial is not configured yet.

dpkg: error processing package linux-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-image-generic-lts-xenial:
 linux-signed-image-generic-lts-xenial depends on linux-image-extra-4.4.0-34-generic; however:
  Package linux-image-extra-4.4.0-34-generic is not configured yet.

dpkg: error processing package linux-signeNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                    No apport report written because the error message indicates its a followup error from a previous failure.
              No apport report written because MaxReports is reached already
                                                                            No apport report written because MaxReports is reached already
                                                          d-image-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-generic-lts-xenial:
 linux-signed-generic-lts-xenial depends on linux-signed-image-generic-lts-xenial (= 4.4.0.34.24); however:
  Package linux-signed-image-generic-lts-xenial is not configured yet.

dpkg: error processing package linux-signed-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-extra-4.4.0-34-generic
 linux-image-generic-lts-xenial
 linux-generic-lts-xenial
 linux-signed-image-generic-lts-xenial
 linux-signed-generic-lts-xenial
E: Sub-process /usr/bin/dpkg returned an error code (1)

Also, there is a warning saying “The volume boot has only 0 bytes disk space remaining”. I was trying the answers from here. Then I got

linux-image-3.19.0-58-generic
linux-image-3.19.0-59-generic
linux-image-3.19.0-61-generic
linux-image-3.19.0-64-generic
linux-image-3.19.0-65-generic
linux-image-3.19.0-66-generic
linux-image-4.4.0-34-generic

I am not sure if it will be safe to remove all linux-image-3.19.0-xx-generic kernels. Should I keep some? Thanks.

Edit:

output of blkid -o list:

device     fs_type label    mount point    UUID
-------------------------------------------------------------------------------
/dev/ram0                   (not mounted)  
/dev/ram1                   (not mounted)  
/dev/ram2                   (not mounted)  
/dev/ram3                   (not mounted)  
/dev/ram4                   (not mounted)  
/dev/ram5                   (not mounted)  
/dev/ram6                   (not mounted)  
/dev/ram7                   (not mounted)  
/dev/ram8                   (not mounted)  
/dev/ram9                   (not mounted)  
/dev/ram10                  (not mounted)  
/dev/ram11                  (not mounted)  
/dev/ram12                  (not mounted)  
/dev/ram13                  (not mounted)  
/dev/ram14                  (not mounted)  
/dev/ram15                  (not mounted)  
/dev/sda1                   (not mounted)  
/dev/sdb1                   /boot/efi      
/dev/sdb2                   /boot          
/dev/sdb3                   (not mounted)  
/dev/mapper/ubuntu--vg-root
                            /              
/dev/mapper/ubuntu--vg-swap_1
                            <swap>         
Gejun
  • 123
  • 1
  • 8

3 Answers3

1

You only need to keep the 3.19.x kernels if you have problems with the 4.4.x kernels or want to boot an older kernel for some other reason. Otherwise it's safe to remove them.

  • Thanks. The problem is that when I run sudo apt-get purge linux-image-3.19.0-58-generic, I received the same error as above. – Gejun Aug 27 '16 at 16:34
0

Here is my interpretation: The first error reported seems to be "gzip: stdout: No space left on device" and then an installation fails (probably related to this out of space error). It is followed by a cascade of dependency issues, since installation of this first package fails.

How many partitions do you have? If you have separate partitions for /home and /, it might happen that you see some available space on the drive but still get an out of space notice since the available space is on a different partition.

Copper
  • 51
  • 8
  • Right, I have /home and /. What can I do to fix this problem? Thanks. – Gejun Aug 27 '16 at 16:35
  • To avoid misunderstanding, you will always have /home and /. What I am pointing to is whether they are on different primary/logical partitions of your hard drive. If unsure, please post the output of "blkid -o list". – Copper Aug 27 '16 at 21:50
  • the output added – Gejun Aug 28 '16 at 14:30
  • As far as I understand, you do not have a separate /home partition (else we would have seen something mounted such as "/dev/sdbx /home". So nothing to generate space here. Is it a dual boot? You seem to have an sdb3 that is not mounted. If some space available there, you can perhaps try to steal some space from sdb3, say using gparted, this might help: http://askubuntu.com/questions/66000/how-to-merge-partitions – Copper Aug 28 '16 at 18:43
  • On the other hand, you seem to be running an old version of Ubuntu. If there are no compatibility issues etc., it might be an excellent timing for a reinstall, during which you can re-define the partition sizes (select "Something else" option during installation and resize.). – Copper Aug 28 '16 at 18:49
  • If you need an urgent fix, you could probably get rid of the unnecessary archieved packages. They are stored under "/var/cache/apt/archives". You can manually delete *.deb's or type "sudo apt-get clean". With this generated small space, try to run your "sudo apt-get autoremove" again. This should first fix the dependency issues and then remove unneeded packages. – Copper Aug 28 '16 at 18:51
  • thanks so much for your explanation. Is it possible to resize /boot partition without reinstalling Ubuntu? Will upgrading from 14.04 to 16.04 work? How can I resize /boot if I have to reinstall new system? Thanks again. – Gejun Sep 04 '16 at 21:15
  • If you are re-installing, there will be a menu describing the OS already found (if any) and asking what you would like to do with them. Choose "something else" to arrange partitions. http://askubuntu.com/questions/343268/how-to-use-manual-partitioning-during-installation. Else, you might try booting from a live CD/USB and try to crop some space from sdb3 and merge with sdb2 using Gparted. – Copper Sep 05 '16 at 13:21
0

Even if you try to remove some kernels, you will get those errors, because it still needs a small portion of storage in /boot to clear kernels.

My suggestion is creating an Ubuntu Live USB, booting from it and move 1 or 2 kernel image to another location. Make sure you don't remove those which you will boot. I suggest keeping linux-image-3.19.0-66-generic kernel.

After making some room, boot to regular Ubuntu, and remove other kernels you didn't moved manually. This way you will get some room cleanly. Then again boot using USB and put those moved kernel files in their location.

Now, again boot to regular Ubuntu and remove unnecessary kernels, keeping only one. You should be to do so without any warning.

Anwar
  • 76,649
  • So when booting with USB, do I still use the command like sudo apt-get purge linux-image-3.16.0-23-generic to remove old kernels? Or remove manually? Thanks. – Gejun Aug 28 '16 at 14:34
  • @AndersonZhu manually. Just use nautilus with root and move them somewhere else. I'd move the oldest files from /boot – Anwar Aug 28 '16 at 14:36
  • The other problem is that after removing some old kernels, I still have "not enough free disk space" when updating. How can I solve this? Is it possible to increase the size of /boot partition? Thanks again. – Gejun Sep 04 '16 at 21:09
  • Yes. It's possible to increase the size under some consideration. First you need to have some free space right after it. and then you'd resize the partition. Search AskUbuntu site for similar question. I believe, this is already answered. @AndersonZhu – Anwar Sep 05 '16 at 03:38