On Tue, 2024-10-08 at 03:41 +0200, Vincent Lefevre wrote: > On 2024-10-07 21:23:40 +0200, Ben Hutchings wrote: > > Control: tag -1 moreinfo > > > > On Mon, 2024-10-07 at 00:39 +0200, Vincent Lefevre wrote: > > > Package: initramfs-tools > > > Version: 0.145 > > > Severity: normal > > > > > > When updating an initrd file, update-initramfs keeps 2 temporary > > > copies in /boot, > > > > I don't believe this is the case. A successful run of > > "update-initramfs -u" will do: > > > > 1. Hard-link initrd.img-<version> to initrd.img-<version>.dpkg-bak > > 2. Create new initramfs as initrd.img-<version>.new > > 3. Move initrd.img-<version>.new to initrd.img-<version> > > 4. Remove initrd.img-<version>.dpkg-bak (unless backup_initramfs is > > enabled) > > > > There is 1 temporary copy created in step 2, and after step 4 there are > > 0 temporary copies. > > > > Step 1 does have a fallback to copying if hard-linking fails. That > > could happen if your /boot uses VFAT or some other un-Unix-like > > filesystem, but that's not supported by Debian. But maybe there's some > > other reason it can fail? > > Indeed, with 3 installed kernels: > > Filesystem Size Used Avail Use% Mounted on > /dev/nvme0n1p2 456M 295M 137M 69% /boot > > So there isn't enough space for a 4th kernel + a temporary copy > (90 MB each at maximum compression + 9 MB for the vmlinuz file).
OK. But 'apt autoremove' should normally remove one of the old kernels. And I don't see how this answers my question about the claim of 2 temporary copies. > > > > though its space is typically *very* limited > > > (456 MB by default). This means that one can keep a limited number > > > of kernels. With the 456 MB default size and maximum compression > > > (COMPRESS=lzma and COMPRESSLEVEL=9), only 3 kernels are possible. > > > > > > The temporary copies should be stored on the main file system, > > > which is not space limited. > > [...] > > > > The initramfs must be replaced atomically, otherwise we can end up with > > a previously working image being deleted or replaced with a truncated > > image. So there has to be 1 temporary copy. > > The temporary copy could be on the main file system. The goal is > anyway to keep *at least* an additional working kernel in /boot > in case the rebuild of the kernel gets broken (which cannot be > detected until booting on this kernel). So, if anything goes wrong > (either at install time or when booting on the rebuilt kernel), it > is possible to boot on the working kernel to fix things. Unfortunately there is currently nothing with that global view of which kernel and initramfs images are known good. Also, if we delete an initramfs before rebuilding it, we should remove that kernel/initramfs from the boot menu until it's been rebuilt, but there's currently no mechanism to do that. I do see a need here for a proper re-think of the way we manage kernel and initramfs images in /boot, but this is not something that can be done through a quick fix in initramfs-tools. Ben. -- Ben Hutchings It is easier to write an incorrect program than to understand a correct one.
signature.asc
Description: This is a digitally signed message part