Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 824282 - genkernel does not put the initramfs in the same place as the kernel
Summary: genkernel does not put the initramfs in the same place as the kernel
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-17 22:32 UTC by Anthony Youngman
Modified: 2021-11-20 22:25 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Youngman 2021-11-17 22:32:25 UTC
I thought I'd solved it ...

genkernel initramfs --lvm --mdadm --kerneldir=.

I DO NOT want gentoo, or SUSE, or any other distro mucking about with my live /boot partition. So WHY OH WHY is specifying --no-automount-boot triggering a fatal error if I've got a boot partition!!!

I have a single boot partition, with more than one distro each in its own lv. This is NOT a configuration supported by grub-mkconfig, and last time I let SUSE into the /boot partition it rendered my computer unbootable - SUSE trashed both itself and gentoo.

Basically, I want distros to put their boot config into THEIR /boot and not crap all over the real partition.

And oh sh** it gets worse ... genkernel is looking for the kernel modules in /var/tmp/genkernel/... OF COURSE IT CAN'T FIND THEM! I DIDN'T USE GENKERNEL TO COMPILE THE KERNEL! I JUST WANT TO BUILD AN INITRAMFS!

I didn't intend to - I don't like pointing the "default kernel" at a kernel that is not even properly installed - but even doing an eselect kernel set hasn't fixed that. WHY OH WHY DOES genkernel initramfs ASSUME THAT I DID A GENKERNEL KERNEL. Why doesn't it do what (ime) it's ALWAYS done in the past and look for the kernel modules where the kernel modules are supposed to be installed!
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-17 22:41:07 UTC
(In reply to Anthony Youngman from comment #0)
> I thought I'd solved it ...
> 
> genkernel initramfs --lvm --mdadm --kerneldir=.
> 
> I DO NOT want gentoo, or SUSE, or any other distro mucking about with my
> live /boot partition. So WHY OH WHY is specifying --no-automount-boot
> triggering a fatal error if I've got a boot partition!!!

Please just keep things polite and simply describing the problem.

> 
> I have a single boot partition, with more than one distro each in its own
> lv. This is NOT a configuration supported by grub-mkconfig, and last time I
> let SUSE into the /boot partition it rendered my computer unbootable - SUSE
> trashed both itself and gentoo.
> 
> Basically, I want distros to put their boot config into THEIR /boot and not
> crap all over the real partition.
> 
> And oh sh** it gets worse ... genkernel is looking for the kernel modules in
> /var/tmp/genkernel/... OF COURSE IT CAN'T FIND THEM! I DIDN'T USE GENKERNEL
> TO COMPILE THE KERNEL! I JUST WANT TO BUILD AN INITRAMFS!
> 

I think we'll need some output and the genkernel version.

> I didn't intend to - I don't like pointing the "default kernel" at a kernel
> that is not even properly installed - but even doing an eselect kernel set
> hasn't fixed that. WHY OH WHY DOES genkernel initramfs ASSUME THAT I DID A
> GENKERNEL KERNEL. Why doesn't it do what (ime) it's ALWAYS done in the past
> and look for the kernel modules where the kernel modules are supposed to be
> installed!

You could just not use genkernel...? It's not required. There are various options. Especially if you have a rather specific setup.

genkernel prefers that you build the whole thing with it, not just the initramfs.
Comment 2 Anthony Youngman 2021-11-17 23:30:04 UTC
You can see a successful genkernel initramfs, followed by editing genkernel.conf to tell it NOT to automount /boot, followed by a failed genkernel.

And if you're supposed to do everything with genkernel, why does it give you the option of only doing bits of it?

But why does just not mounting the boot partition cause it all to blow up?

thewolery /usr/src/linux-5.10.76-gentoo-r1 # genkernel initramfs --lvm --mdadm
* Gentoo Linux Genkernel; Version 4.2.5
* Using genkernel configuration from '/etc/genkernel.conf' ...
* Running with options: initramfs --lvm --mdadm

* Working with Linux kernel 5.10.76-gentoo-r1 for x86_64
* Using kernel config file '/usr/share/genkernel/arch/x86_64/generated-config' ...

* mount: >> Boot partition was temporarily mounted on '/boot' ...

* Current kernel's LOCALVERSION is set to ''; Will ignore set --kernel-localversion value '-x86_64' because kernel was not build ...

* initramfs: >> Initializing ...
*         >> Appending devices cpio data ...
*         >> Appending base_layout cpio data ...
*         >> Appending util-linux cpio data ...
*         >> Appending eudev cpio data ...
*         >> Appending devicemanager cpio data ...
*         >> Appending auxiliary cpio data ...
*         >> Appending busybox cpio data ...
*         >> Appending lvm cpio data ...
*         >> Appending mdadm cpio data ...
*         >> Appending modprobed cpio data ...
*         >> Appending modules cpio data ...
*         >> Appending linker cpio data ...
*         >> Deduping cpio ...
*         >> Pre-generating initramfs' /etc/ld.so.cache ...
*         >> Compressing cpio data (.xz) ...
*
* You will find the initramfs in '/boot/initramfs-5.10.76-gentoo-r1.img'.

* WARNING... WARNING... WARNING...
* Additional kernel parameters that *may* be required to boot properly:
* - Add "domdadm" for MDRAID support
* - Add "dolvm" for LVM support

* mount: >> Automatically unmounting boot partition from '/boot' as it was previously ...

* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
*
* Make sure you have the latest ~arch genkernel before reporting bugs.
thewolery /usr/src/linux-5.10.76-gentoo-r1 # vi /etc/genkernel.conf
thewolery /usr/src/linux-5.10.76-gentoo-r1 # genkernel initramfs --lvm --mdadm
* Gentoo Linux Genkernel; Version 4.2.5
* Using genkernel configuration from '/etc/genkernel.conf' ...
* Running with options: initramfs --lvm --mdadm

* Working with Linux kernel 5.10.76-gentoo-r1 for x86_64
* Using kernel config file '/usr/share/genkernel/arch/x86_64/generated-config' ...
* ERROR: Boot partition is not mounted on '/boot' and I am not allowed to mount due to set --no-mountboot option!
* Please consult '/var/log/genkernel.log' for more information and any
* errors that were reported above.
*
* Report any genkernel bugs to bugs.gentoo.org and
* assign your bug to genkernel@gentoo.org. Please include
* as much information as you can in your bug report; attaching
* '/var/log/genkernel.log' so that your issue can be dealt with effectively.
*
* Please do *not* report kernel compilation failures as genkernel bugs!
*
thewolery /usr/src/linux-5.10.76-gentoo-r1 #
Comment 3 Anthony Youngman 2021-11-17 23:32:31 UTC
thewolery /usr/src/linux-5.10.76-gentoo-r1 # genkernel --version
4.2.5
thewolery /usr/src/linux-5.10.76-gentoo-r1 #


And why not use genkernel if it (is supposed to) does the job? I've seen all the documentation about all the things you have to do, and a simple genkernel was so much easier.
Comment 4 Ben Kohler gentoo-dev 2021-11-18 13:54:21 UTC
Your commentary is making it hard to make sense of what bug you are reporting.  It also seems like you are reporting 2 different issues.

The first one seems to be undesired behavior when passing --no-automount-boot while /boot is defined in fstab but (purposely) not mounted.  Is that correct?
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2021-11-18 16:26:32 UTC
I tend to close this friendly bug report as INVALID. This is not a support forum.

Please read MAN page. Get familiar with "--no-install" option. Using that option will result in something like (in this example I used "all" and not just "initramfs" action):

> [...]
> * Kernel compiled successfully!
> *
> * You will find the kernel image in '/var/tmp/genkernel/kernel-x86_64-5.10.76-gentoo-r1-x86_64'.
> * You will find the initramfs in '/var/tmp/genkernel/initramfs-x86_64-5.10.76-gentoo-r1-x86_64'.
> *
> [...]

It will not touch or require /boot.

Keep in mind: When you only use genkernel for initramfs generation, don't forget to pass --kernel-config to genkernel so genkernel will know which kernel options are set. If you do not do that you will likely end up with an initramfs your kernel doesn't support.
Comment 6 Anthony Youngman 2021-11-18 23:17:23 UTC
(In reply to Ben Kohler from comment #4)
> Your commentary is making it hard to make sense of what bug you are
> reporting.  It also seems like you are reporting 2 different issues.
> 
> The first one seems to be undesired behavior when passing
> --no-automount-boot while /boot is defined in fstab but (purposely) not
> mounted.  Is that correct?

Yes. Undesired as in genkernel is effectively saying "wah wah I won't do what you tell me".

If I have --automount-boot set, genkernel works fine.

If I have --no-automount-boot set, genkernel goes "wah wah you won't let me mount boot sulk sulk fatal error".

By all means throw up a warning, but for **** sake it's got a /boot, just let it put the initramfs in the boot directory instead of the boot partition!

Telling it not muck about with my boot partition should not cause it to fall over in a heap, especially when the reason I don't want it mucking about is because it is going to trash my boot setup and leave me with an unbootable system!

I want a *clean* gentoo boot setup in my boot DIRECTORY, because my boot partition is SHARED BETWEEN DISTROS
Comment 7 Anthony Youngman 2021-11-18 23:18:30 UTC
(In reply to Anthony Youngman from comment #6)
> (In reply to Ben Kohler from comment #4)
> > Your commentary is making it hard to make sense of what bug you are
> > reporting.  It also seems like you are reporting 2 different issues.
> > 
> > The first one seems to be undesired behavior when passing
> > --no-automount-boot while /boot is defined in fstab but (purposely) not
> > mounted.  Is that correct?
> 
> Yes. Undesired as in genkernel is effectively saying "wah wah I won't do
> what you tell me".
> 
> If I have --automount-boot set, genkernel works fine.
> 
> If I have --no-automount-boot set, genkernel goes "wah wah you won't let me
> mount boot sulk sulk fatal error".
> 
> By all means throw up a warning, but for **** sake it's got a /boot, just
> let it put the initramfs in the boot directory instead of the boot partition!
> 
> Telling it not muck about with my boot partition should not cause it to fall
> over in a heap, especially when the reason I don't want it mucking about is
> because it is going to trash my boot setup and leave me with an unbootable
> system!
> 
> I want a *clean* gentoo boot setup in my boot DIRECTORY, because my boot
> partition is SHARED BETWEEN DISTROS

and I don't want the distros stomping all over each other (and trashing themselves as well in the process).
Comment 8 Ben Kohler gentoo-dev 2021-11-18 23:24:50 UTC
I can't handle your attitude, count me out for any further troubleshooting.  Good luck.
Comment 9 Anthony Youngman 2021-11-18 23:41:48 UTC
(In reply to Ben Kohler from comment #8)
> I can't handle your attitude, count me out for any further troubleshooting. 
> Good luck.

I'm sorry if I'm upsetting you. All I want is for --no-automount-boot to do exactly what it says it does.

Changing that one option from --automount-boot to --no-automount-boot should not trigger a fatal error - after all it's still got a /boot to work with.

That's why I'm frustrated - it's just not doing what it says on the tin ...
Comment 10 Anthony Youngman 2021-11-18 23:52:49 UTC
(In reply to Thomas Deutschmann from comment #5)
> I tend to close this friendly bug report as INVALID. This is not a support
> forum.
> 
> Please read MAN page. Get familiar with "--no-install" option. Using that
> option will result in something like (in this example I used "all" and not
> just "initramfs" action):
> 
> > [...]
> > * Kernel compiled successfully!
> > *
> > * You will find the kernel image in '/var/tmp/genkernel/kernel-x86_64-5.10.76-gentoo-r1-x86_64'.
> > * You will find the initramfs in '/var/tmp/genkernel/initramfs-x86_64-5.10.76-gentoo-r1-x86_64'.
> > *
> > [...]
> 
> It will not touch or require /boot.
> 
> Keep in mind: When you only use genkernel for initramfs generation, don't
> forget to pass --kernel-config to genkernel so genkernel will know which
> kernel options are set. If you do not do that you will likely end up with an
> initramfs your kernel doesn't support.

Except that using --no-install simply makes the problem worse! Adding that to the command line now causes genkernel to crash with "can't find linux kernel modules".

Let's start at the very beginning. I have a WORKING genkernel command line. The only problem is that the initramfs ends up in the wrong place.

Adding --no-automount-boot now causes my command line to fail with a fatal error, basically "you won't let me do what I want". WHY!

Adding --no-install (which I don't want to do because I want it to install the initramfs in MY choice of /boot directory, not IT'S choice of boot directory) now makes matters worse because it appears to be looking in a DIFFERENT place for it's input files! wtf?

So the summary basically is that ,

Starting with a *working* genkernel command and adding an option (--no-autmount-boot) to change the target location causes a completely unnecessary fatal error.
Trying to fix that by adding a further option (--no-install) which should also only change the target location causes a further fatal error because the command can no longer find its input files!
Comment 11 Anthony Youngman 2021-11-20 22:25:42 UTC
I had an idea ...

But basically, running THE SAME command, namely

genkernel initramfs --lvm --mdadm

(1) if I comment out /boot in fstab, it works fine
(2) if I set --no-automount-boot, genkernel refuses to run with a fatal error.