[SRU] remove orphaned initrd old-dkms files in /boot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
initramfs-tools (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
If a dkms package is installed which has REMAKE_INITRD or the same setting has been manually configured by a user then when a kernel is removed its possible for an ".old-dkms" file to be left in /boot with no associated kernel.
bug 1515513 dealt with removing old-dkms initrd files using the kernel's prerm hook, but that is only executed for the kernel version being removed: any other old-dkms file generated prior to that would not be removed by the hook, taking space in the /boot directory and being carried forward with every upgrade.
Note: Filling up the /boot partition causes updates and upgrades to fail.
[Test Case]
As the fix for bug 1515513 is available on Xenial and Bionic it is no longer possible to reproduce this by simply installing and updating kernels - dkms 2.2.0.3-
This assumes a new Xenial/Bionic schroot.
1) create files to work as a placeholders for old dkms files (there are 4 possible namings for these files)
touch /boot/initrd-
2) install 3 old kernels, r8168-dkms, and the current initramfs-tools
* xenial:
apt-get install -y linux-image-
* bionic:
apt-get install -y linux-image-
3) install the headers for the old kernels (forces dkms to run)
* xenial:
apt-get install -y linux-headers-
* bionic:
apt-get install -y linux-headers-
4) verify that there are 7 old-dkms, the 4 manually created ones and one for each installed kernel
ls -1 /boot/*.old-dkms
5) install the initramfs-tools from proposed that contains this fix
apt-get install -y initramfs-tools
6) verify that the manually created old-dkms files were removed and that there are only 3 files now, one for each installed kernel
ls /boot/*.old-dkms
7) mark kernel images and headers as automatically installed
apt-mark auto linux-image-
8) autoremove the older kernel
apt-get autoremove -y
9) verify that there are now only 2 old-dkms, one for each installed kernel
ls -1 /boot/*.old-dkms
These steps guarantees that:
- orphaned old-dkms are correctly removed from /boot
- non-orphaned old-dkms are kept
- when kernel is removed the related old-dkms are also deleted
[Regression Potential]
Somebody out there might expect the .old-dkms file to be kept, but that seems like an odd expectation.
One notices *.old-dkms files being left behind still sitting on the disk after purging the related kernel. This can cause /boot to become full, and when it gets really bad, even sudo apt-get autoremove won't fix the problem - only deleting the old-dkms files manually solves the problem.
description: | updated |
tags: | added: xenial |
tags: | added: patch |
Changed in dkms (Ubuntu): | |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in initramfs-tools (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
description: | updated |
Changed in dkms (Ubuntu): | |
status: | Confirmed → Invalid |
Changed in dkms (Ubuntu Xenial): | |
status: | New → Invalid |
Changed in dkms (Ubuntu Bionic): | |
status: | New → Invalid |
description: | updated |
summary: |
- remove /boot/initrd.img-*.old-dkms files left behind + [SRU] remove orphaned initrd old-dkms files in /boot |
description: | updated |
attaching xenial sru patch