Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #84247

Bug#1084232: initramfs-tools: fails with "No space left on device" due to 2 temporary initrd copies in /boot

From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#1084232: initramfs-tools: fails with "No space left on device" due to 2 temporary initrd copies in /boot
Date 2024-10-08 20:20 +0200
Message-ID <JvmYp-eR2-1@gated-at.bofh.it> (permalink)
References <JuIeB-hpHw-1@gated-at.bofh.it> <Jv1AB-JG-5@gated-at.bofh.it> <Jv7wl-4DO-1@gated-at.bofh.it> <JuIeB-hpHw-1@gated-at.bofh.it> <Jv7wl-4DO-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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.

Back to linux.debian.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#1084232: initramfs-tools: fails with "No space left on device" due to 2 temporary initrd copies in /boot Vincent Lefevre <vincent@vinc17.net> - 2024-10-07 00:50 +0200
  Bug#1084232: initramfs-tools: fails with "No space left on device" due to 2 temporary initrd copies in /boot Vincent Lefevre <vincent@vinc17.net> - 2024-10-07 01:00 +0200
  Processed: Re: initramfs-tools: fails with "No space left on  device" due to 2 temporary initrd copies in /boot "Debian Bug Tracking System" <owner@bugs.debian.org> - 2024-10-07 01:00 +0200
  Processed: Re: Bug#1084232: initramfs-tools: fails with "No space  left on device" due to 2 temporary initrd copies in /boot "Debian Bug Tracking System" <owner@bugs.debian.org> - 2024-10-07 21:30 +0200
  Bug#1084232: initramfs-tools: fails with "No space left on device" due to 2 temporary initrd copies in /boot Ben Hutchings <ben@decadent.org.uk> - 2024-10-07 21:30 +0200
    Bug#1084232: initramfs-tools: fails with "No space left on device" due to 2 temporary initrd copies in /boot Vincent Lefevre <vincent@vinc17.net> - 2024-10-08 03:50 +0200
      Bug#1084232: initramfs-tools: fails with "No space left on device" due to 2 temporary initrd copies in /boot Ben Hutchings <ben@decadent.org.uk> - 2024-10-08 20:20 +0200
        Bug#1084232: initramfs-tools: fails with "No space left on device" due to 2 temporary initrd copies in /boot Vincent Lefevre <vincent@vinc17.net> - 2024-10-09 03:00 +0200

csiph-web