Comment 38 for bug 1918427

Revision history for this message
dann frazier (dannf) wrote : Re: [Bug 1918427] Re: curtin: install flash-kernel in arm64 UEFI unexpected

On Fri, Mar 19, 2021 at 10:01 AM Ryan Harper <email address hidden> wrote:
>
> * dann frazier <email address hidden> [2021-03-18 16:30]:
> > On Thu, Mar 18, 2021 at 12:25 PM Ryan Harper <email address hidden> wrote:
> > >
> > > * dann frazier <email address hidden> [2021-03-18 12:11]:
> > > > On Thu, Mar 18, 2021 at 10:25 AM Ryan Harper <email address hidden> wrote:
> > > > >
> > > > > * dann frazier <email address hidden> [2021-03-17 20:30]:
> > > > > > On Tue, Mar 16, 2021 at 10:05 AM Ryan Harper <email address hidden> wrote:
> > > > > > >
> > > > > > > Hi Dan,
> > > > > > >
> > > > > >
> > > > > > 1) flash-kernel could get installed post-divert. In that case,
> > > > > > flash-kernel's own postinst will cause it to run and then fail. This
> > > > > > happens today if you start with a cloud image w/o flash-kernel
> > > > > > pre-baked because Ubuntu's kernel recommends flash-kernel, causing it
> > > > > > to be installed along with the kernel. Official cloud images happen to
> > > > >
> > > > > Hrm, so if we take a squashfs rootfs (with no flash-kernel present)
> > > > > chroot into it and install the linux-image-generic package pulling in
> > > > > flash-kernel this fails due to postinst of flash-kernel expecting
> > > > > initramfs to already be generated? This doesn't seem like a curtin bug.
> > > >
> > > > If done so in a chroot that exposes the kernel interfaces (/proc &
> > > > /sys) that claim to be hardware that requires the initramfs to be
> > > > post-processed, yes.
> > >
> > > Maybe I'm missing something but if I install linux-image-generic
> > > it populates /boot with vmlinuz-$version (and a few more things)
> > > and /lib/modules/$version and the kernels postinst will invoke
> > > update-initramfs. The /boot/initrd.img-$version is *generated* at
> > > that time during the kernel's postinstall
> > >
> > > Now, in the arm case IIUC, the kernel package has a dep on flash-kernel
> > > being present as it's "needed" to generate the initramfs ... so how can
> > > flash-kernel's postinst *fail* if it is the tool that's generating said
> > > initramfs file?
> >
> > What flash-kernel does is generate wrapped versions of *exisiting*
> > vmlinuz and initrd.img files. It doesn't generate those files, rather
> > post-processes them.
> > The kernel doesn't depend on flash-kernel, it just recommends it like
> > it does GRUB on x86.
>
> Yes, I get that but it still looks like a packaging bug if dpkg installs
> flash-kernel first and /boot is not populated with existing initrds; one
> could easily see this happen in a debootstrap.

Given that a failure to produce a wrapped initrd could cause a system
to become unbootable, it does seem to me like a hard failure here is
warranted. But, perhaps we could provide a "shhhh... it's ok, just
chill" mechanism. Maybe a FLASH_KERNEL_SKIP=1 environment variable?

> Is the "liveness" of the chroot what's tripping up flash-kernel? We
> currently run inside a chroot which mounts /dev /proc /run and /sys; we
> could drop those but it also seems reasonable to have flash-kernel not
> expect existing initrds?

Certainly a non-live chroot can avoid this by leading f-k to believe
it does not recognize the system. In fact, ISTR bind mounting certain
files in build chroots to trick f-k into doing nothing.

 -dann

> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1918427
>
> Title:
> curtin: install flash-kernel in arm64 UEFI unexpected
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/cloud-images/+bug/1918427/+subscriptions
>
> Launchpad-Notification-Type: bug
> Launchpad-Bug: product=cloud-images; status=Confirmed; importance=Undecided; assignee=None;
> Launchpad-Bug: distribution=ubuntu; sourcepackage=curtin; component=main; status=Confirmed; importance=Undecided; assignee=None;
> Launchpad-Bug: distribution=ubuntu; sourcepackage=linux; component=main; status=In Progress; importance=Undecided; <email address hidden>;
> Launchpad-Bug-Tags: patch
> Launchpad-Bug-Information-Type: Public
> Launchpad-Bug-Private: no
> Launchpad-Bug-Security-Vulnerability: no
> Launchpad-Bug-Commenters: crichton dannf raharper tjjh89017 ubuntu-kernel-bot
> Launchpad-Bug-Reporter: Date Huang (tjjh89017)
> Launchpad-Bug-Modifier: Ryan Harper (raharper)
> Launchpad-Message-Rationale: Assignee
> Launchpad-Message-For: dannf