5

Whenever I update Linux, for example from 4.4.0.65 to 4.4.0.66 :

  1. the Software Update tool downloads about 40 previous versions of initrd.img-4.4.0.XX-generic before trying the newest version
  2. /boot fills up
  3. the current version does not load, as boot is out of room
  4. the system is (sometimes) configured to a version that does not exist, and tries to boot it on startup

I have dealt with this for a long time, since version 29.

The only workaround I have found takes me an hour each update. I open command line during the update, and delete versions as they are downloaded. Eventually the update tool is satisfied that it has downloaded all previous versions, downloads the latest version, and configures the system.

Here is the output from dpkg -l | grep linux-image

rc  linux-image-3.19.0-15-generic                        3.19.0-15.15                                  amd64        Linux kernel image for version 3.19.0 on 64 bit x86 SMP
rc  linux-image-4.2.0-34-generic                         4.2.0-34.39                                   amd64        Linux kernel image for version 4.2.0 on 64 bit x86 SMP
ii  linux-image-4.2.0-35-generic                         4.2.0-35.40                                   amd64        Linux kernel image for version 4.2.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-21-generic                         4.4.0-21.37                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-22-generic                         4.4.0-22.40                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-28-generic                         4.4.0-28.47                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-31-generic                         4.4.0-31.50                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-34-generic                         4.4.0-34.53                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-36-generic                         4.4.0-36.55                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-38-generic                         4.4.0-38.57                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-42-generic                         4.4.0-42.62                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-43-generic                         4.4.0-43.63                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-45-generic                         4.4.0-45.66                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-47-generic                         4.4.0-47.68                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-51-generic                         4.4.0-51.72                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-53-generic                         4.4.0-53.74                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-57-generic                         4.4.0-57.78                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-59-generic                         4.4.0-59.80                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-62-generic                         4.4.0-62.83                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-63-generic                         4.4.0-63.84                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-64-generic                         4.4.0-64.85                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-65-generic                         4.4.0-65.86                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-66-generic                         4.4.0-66.87                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-3.19.0-15-generic                  3.19.0-15.15                                  amd64        Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
rc  linux-image-extra-4.2.0-34-generic                   4.2.0-34.39                                   amd64        Linux kernel extra modules for version 4.2.0 on 64 bit x86 SMP
ii  linux-image-extra-4.2.0-35-generic                   4.2.0-35.40                                   amd64        Linux kernel extra modules for version 4.2.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-21-generic                   4.4.0-21.37                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-22-generic                   4.4.0-22.40                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-28-generic                   4.4.0-28.47                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-31-generic                   4.4.0-31.50                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-34-generic                   4.4.0-34.53                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-36-generic                   4.4.0-36.55                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-38-generic                   4.4.0-38.57                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-42-generic                   4.4.0-42.62                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-43-generic                   4.4.0-43.63                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-45-generic                   4.4.0-45.66                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-47-generic                   4.4.0-47.68                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-51-generic                   4.4.0-51.72                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-53-generic                   4.4.0-53.74                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-extra-4.4.0-57-generic                   4.4.0-57.78                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-59-generic                   4.4.0-59.80                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-62-generic                   4.4.0-62.83                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-63-generic                   4.4.0-63.84                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-64-generic                   4.4.0-64.85                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-extra-4.4.0-65-generic                   4.4.0-65.86                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-extra-4.4.0-66-generic                   4.4.0-66.87                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-generic                                  4.4.0.66.70                                   amd64        Generic Linux kernel image

Here are the errors from 'sudo apt-get autoremove'

Setting up linux-firmware (1.157.8) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-65-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-42-generic
Setting up linux-image-4.4.0-66-generic (4.4.0-66.87) ...
Internal Error: Could not find image (/boot/vmlinuz-4.4.0-66-generic)
dpkg: error processing package linux-image-4.4.0-66-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-extra-4.4.0-66-generic:
 linux-image-extra-4.4.0-66-generic depends on linux-image-4.4.0-66-generic; however:
  Package linux-image-4.4.0-66-generic is not configured yet.

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

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 4.4.0.66.70); however:
  Package linux-image-generic is not configured No 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 yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
Setting up linux-image-extra-4.4.0-65-generic (4.4.0-65.86) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-65-generic /boot/vmlinuz-4.4.0-65-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-65-generic /boot/vmlinuz-4.4.0-65-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-65-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-65-generic /boot/vmlinuz-4.4.0-65-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-65-generic /boot/vmlinuz-4.4.0-65-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-65-generic /boot/vmlinuz-4.4.0-65-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-65-generic /boot/vmlinuz-4.4.0-65-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.0-65-generic
Found initrd image: /boot/initrd.img-4.4.0-65-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Errors were encountered while processing:
 linux-image-4.4.0-66-generic
 linux-image-extra-4.4.0-66-generic
 linux-image-generic
 linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • Do you have a separate boot partition? If so, of what size? Exactly how are you deleting the older kernels (it's important)? If you upgrade using the terminal, what error messages do you see (details matter)? Please edit your question to add the output of dpkg -l | grep linux-image (keep the formating, please). – user535733 Mar 15 '17 at 14:16
  • 1
    Have you tried: sudo apt-get autoremove? – chili555 Mar 15 '17 at 16:03
  • To user535733, I do have a separate boot partition, 250MB in size. I always just deleted the old kernels with "sudo rm". I usually use the auto update program, but updating with the kernel I get – user2692216 Mar 16 '17 at 14:44
  • @user535733, I do have a separate boot partition, 250MB in size. I always just deleted the old kernels with 'sudo rm'. I usually use the auto update program, currently my computer will not update over command line. I added the output from 'dpkg -l | grep linux-image' to the post, it was too large. – user2692216 Mar 16 '17 at 14:52
  • @chili555, I just tried 'sudo apt-get autoremove'. On the positive, I do not sit and delete prior versions, on the negative the upgrade to the latest version failed, I am posting the errors in the output at the end. – user2692216 Mar 16 '17 at 15:23
10

For me, this was a problem with update-initramfs and old, stale files not getting removed from /var/lib/initramfs-tools during previous kernel upgrades (probably due to apt previously erroring out for one reason or another).

cd /var/lib/initramfs-tools

Delete files for old kernel versions (don't delete the one for the current kernel version, obviously).

cd /boot

Delete old versions of initrd in /boot.

Then run:

/usr/sbin/update-initramfs -u -k all

This should succeed and only create (or update) an initrd file in /boot for your current kernel version.

  • Had the same issue and was wondering why. Checked /etc/initramfs-tools/* but found nothing related. Didn't realise they were actually in /var/lib/initramfs-tools/ – Terry Wang Jun 20 '18 at 3:05
  • That is the proper solution, I'd been wondering for years why old inird files kept reappearing (even after running uninstall --purge) and filling my small /boot partition. – dargaud Nov 12 '18 at 11:10
  • Solved this for me as well. – Halsafar Jan 28 at 17:13
1

The initrd.img files are not downloaded, they are generated since you have the corresponding kernel (linux-image) packages installed: Apt notices that the kernel package is installed but the corresponding initrd is missing, so it regenerates the initrd.

To stop it, uninstall the kernel packages with sudo apt remove linux-image-4.2.0-35-generic (and similarly for other versions). That is the proper way to uninstall an old kernel.

0

My problems were caused by incorrectly deleting files from boot using 'sudo rm'.

The first problem was that old packages were being automatically loaded and filling /boot. To automatically remove the old packages I was able to use 'sudo apt-get autoremove'.

However, I was still unable to upgrad, and got the following errors:

Errors were encountered while processing: linux-image-4.4.0-66-generic linux-image-extra-4.4.0-66-generic linux-image-generic linux-generic E: Sub-process /usr/bin/dpkg returned an error code (1)

I read a similar issue here: Cannot apt upgrade due to kernel package problems and followed the steps in the answer section as follows...

I attempted 'wajig remove linux-headers-4.4.0-66.generic' and 'sudo apt-get upgrade' but it still returned: Errors were encountered while processing: linux-image-4.4.0-66-generic linux-image-extra-4.4.0-66-generic linux-image-generic

So, I made a backup copy of /var/lib/dpkg/status, and then opened /var/lib/dpkg/status in gedit.

I searched for "4.4.0-66" in /var/lib/dpkg/status and removed the entire section that started with "Package: linux-image-4.4.0-66-generic" because the second line of the section said "Status: install ok half-configured".

After this, 'sudo apt-get upgrade' was able to correctly install the latest kernel.

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.