Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] missing initramfs.linux.img when dual booting
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Sat Aug 24, 2024 2:31 pm    Post subject: [Solved] missing initramfs.linux.img when dual booting Reply with quote

Hello,

I am trying to install Gentoo on a laptop dualbooting with Arch. I started installing Arch as it was the only distribution that recognized my Broadcom wireless chipset, allowing me to have an internet connection. Unfortunately the Live Gentoo cd did not see my wireless card.

Here is how I partitioned the ssd:

Quote:
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST500LT012-1DG14
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xc5fc872e

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 8390655 6291456 3G 82 Linux swap / Solaris
/dev/sda3 8390656 260048895 251658240 120G 83 Linux
/dev/sda4 260048896 847251455 587202560 280G 5 Extended
/dev/sda5 260050944 511709183 251658240 120G 83 Linux


Arch is fully functional and is installed on /dev/sda3, with /dev/sda1 with the bootloader. Gentoo is installed on /dev/sda5.

After I was done installing Gentoo, and running "Make" for the kernel to build its files, I ran

Quote:
grub-mkconfig -o /boot/grub/grub.cfg
in Arch, which gave me the following message:

Quote:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: intel-ucode.img initramfs-linux-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Gentoo Linux on /dev/sda5
Adding boot menu entry for UEFI Firmware Settings ...
done
.

I did not install Grub on Gentoo, and relied on the Arch bootloader to do the job.

When I reboot the laptop, I have the option to log into Arch or Gentoo, but when I go for the Gentoo option, I receive the message:

Quote:
' /boot/initramfs-linux.img' not found


I followed the Gentoo handbook and built the initramfs through dracut and when i chroot and ls boot, this is what I see:

Quote:

System.map-6.6.47-gentoo config-6.6.47-gentoo vmlinuz-6.6.47-gentoo
amd-uc.img initramfs-6.6.47-gentoo.img


so, there is an initramfs-6.6.47-gentoo.img, but the error refers to a generic initramfs-linux.img file.

My laptop is an Acer Aspire E15 which is about 8 years old, with an Intel Core I3 processor.

What am I missing?

As an aside, I installed Grub the first time I installed Gentoo, it found Arch, but when I tried to dualboot, grub did not work, it did not even find the two distributons

Any help is much appreciated.


Last edited by enrico68 on Sat Aug 31, 2024 3:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Sat Aug 24, 2024 3:32 pm    Post subject: Reply with quote

I have a feeling that Arch is the culprit (maybe), as, when looking into its /boot directory, there is a initramfs-linux.img, whereas in Gentoo /boot there is a initramfs-6.6.47-gentoo.img, which Arch won't recognize. I wish I could just install Gentoo, but, like I said, the live cd does not see my wireless card...and if I try to install Grub and run it from Gentoo, when I restart the system, I get into a black screen...pretty messy...
Back to top
View user's profile Send private message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 366
Location: Nijmegen

PostPosted: Sat Aug 24, 2024 7:48 pm    Post subject: Reply with quote

On Gentoo kernels are installed versioned, so this:

Code:
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img


Is not a Gentoo kernel, that's an Arch kernel (why the accompanying initramfs is not there I do not know).

When you use one GRUB to dual-boot multiple distributions there are a couple of things to note. For one, grub-install installs a grub that is hardcoded to load the grub.cfg as well as grub modules from a specific location on a specific disk, so you may end up loading a different grub.cfg then you think you are loading. Secondly, grub-mkconfig will by default only look for kernels in /boot of the currently loaded distro, so if Gentoo and Arch don't share a /boot partition then running grub-mkconfig in Arch will probably not find the Gentoo kernels (which is what seems to be happening since I see no Gentoo kernels in the output).

Quote:
As an aside, I installed Grub the first time I installed Gentoo, it found Arch, but when I tried to dualboot, grub did not work, it did not even find the two distributons


Please clarify further what you mean with "did not work". Note that running grub-install on Gentoo will install a different GRUB, that reads a different grub.cfg (from Gentoo's /boot instead of Arch's /boot), in a different location (ESP/EFI/Gentoo instead of ESP/EFI/Arch), and it will have a separate entry in the UEFI.
_________________
OS: Gentoo 6.8.10-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 438

PostPosted: Sun Aug 25, 2024 8:56 am    Post subject: Reply with quote

I guess, you are booting in BIOS legacy mode?

Please share the complete grub.cfg from Arch Linux. And also the "ls -l" of the Gentoo /boot location.

And if you want to install Grub on Gentoo, please provide the value of GRUB_PLATFORMS from your /etc/portage/make.conf and the complete Gentoo grub.cfg.
Back to top
View user's profile Send private message
Weezer
n00b
n00b


Joined: 19 Apr 2024
Posts: 18

PostPosted: Sun Aug 25, 2024 11:14 am    Post subject: Reply with quote

As someone who "octuple" boots on a legacy type system, here is what I've found to work well.

Firstly, convert your disk to gpt bios-boot in order to be able to use gpt rather than mbr for your disk partitioning (allows up to 128 partitions rather than four with extended). You might be too far along to mess with that although it could be done. I believe the Arch Installation Wiki talks about it and basically you just have to put a 1MB bios-boot partition at the beginning of your disk, then you can use gpt for disk partitioning.

Second, os-prober is notorious for not working well (I've fought with it many times), so I don't rely on it. I suggest installing grub on your Gentoo installation (I believe you already did) and letting Gentoo make it's own grub.cfg, then use the menu entires within that to create a "custom.cfg" with only those menu entries. Put that in your Arch's /boot/grub/ directory along with it's (Arch's) grub.cfg and you should then be able to boot. The custom.cfg needs only the menu entries from Gentoo, nothing else. I should also clarify to NOT run the grub-install commands from Gentoo. Simply create the grub.cfg so you can use the menu entries.

The only downside to this is that when you update your kernel(s) in Gentoo, you have to manually edit your custom.cfg to reflect the new kernel versions. I get around that by using symlinks. Similar to what Arch does, I symlink my kernels in the Gentoo's /boot/ directory to something like:

ln -s initramfs-6.10.6-gentoo.img initramfs-linux.img
ln -s vmlinuz-6.10.6-gentoo vmlinux-linuz

and use the generic entries in the custom.cfg file. I simply update the symlinks when new kernels are installed (wrote a script for that).

Once set up, you rarely need to edit the menu entries. When you do make grub configuration changes, you do have to either manually edit the custom.cfg file or use grub to re-create the entries and put those in the custom.cfg file.

I use this same method for every "distro" I have and it works well (once set up). Just pick one distro to be the maintainer of "GRUB" so to speak and use custom.cfg for all the rest.

I'm sure there are better ways but this might get you going at least.
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Mon Aug 26, 2024 5:00 am    Post subject: Reply with quote

Hello Andrew, and thank you for helping me out.

AndrewAmmerlaan wrote:
grub-mkconfig will by default only look for kernels in /boot of the currently loaded distro, so if Gentoo and Arch don't share a /boot partition then running grub-mkconfig in Arch will probably not find the Gentoo kernels (which is what seems to be happening since I see no Gentoo kernels in the output).


Pardon my novice question: how do I share a /boot partition between the two distributions? I have always dual booted with Windows, in UEFI, using two separate disks, this time I am dual booting two linux distros in mbr (my motherboard is from 2012 and only works in legacy mode) using the same disk. How do I make sure that when I run grub-mkconfig in Gentoo, it will find the Arch initramfs -linux.img and vmlinuz-linuz as well? This is the part that I am missing and that I would like to understand...I would really be thankful if you could explain it to me, this is my project, and I want to learn how to properly install multiple linux distros using the same disk.

Thank you and looking forward to your reply,

Enrico :wink:
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Mon Aug 26, 2024 5:23 am    Post subject: Reply with quote

Weezer wrote:
As someone who "octuple" boots on a legacy type system, here is what I've found to work well.


Hello Weezer, it is kind of what I am trying to accomplish, so I am glad you replied to my post!

Weezer wrote:
Firstly, convert your disk to gpt bios-boot in order to be able to use gpt rather than mbr for your disk partitioning (allows up to 128 partitions rather than four with extended).

Would that work even if my motherboard is in Legacy mode?

Weezer wrote:
Second, os-prober is notorious for not working well (I've fought with it many times), so I don't rely on it. I suggest installing grub on your Gentoo installation (I believe you already did) and letting Gentoo make it's own grub.cfg, then use the menu entires within that to create a "custom.cfg" with only those menu entries. Put that in your Arch's /boot/grub/ directory along with it's (Arch's) grub.cfg and you should then be able to boot. The custom.cfg needs only the menu entries from Gentoo, nothing else. I should also clarify to NOT run the grub-install commands from Gentoo. Simply create the grub.cfg so you can use the menu entries
The only downside to this is that when you update your kernel(s) in Gentoo, you have to manually edit your custom.cfg to reflect the new kernel versions. I get around that by using symlinks. Similar to what Arch does, I symlink my kernels in the Gentoo's /boot/ directory to something like:

ln -s initramfs-6.10.6-gentoo.img initramfs-linux.img
ln -s vmlinuz-6.10.6-gentoo vmlinux-linuz

and use the generic entries in the custom.cfg file. I simply update the symlinks when new kernels are installed (wrote a script for that).

Once set up, you rarely need to edit the menu entries. When you do make grub configuration changes, you do have to either manually edit the custom.cfg file or use grub to re-create the entries and put those in the custom.cfg file.

I use this same method for every "distro" I have and it works well (once set up). Just pick one distro to be the maintainer of "GRUB" so to speak and use custom.cfg for all the rest.

I'm sure there are better ways but this might get you going at least.


Let's see if I understand this: once I run mk-config in Gentoo, I manually edit the custom.cfg file with the generic initramfs-linux.img and vmlinux-linuz and use the sym links that point to those two generic entries in Gentoo's grub. After doing that, I copy the custom cfg. file into Arch's grub.config file and let Arch be the maintainer of Grub. Am I correct?

Enrico
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Mon Aug 26, 2024 5:30 am    Post subject: Reply with quote

Hello Mueggli,


sMueggli wrote:
I guess, you are booting in BIOS legacy mode?
Correct.

Quote:
Please share the complete grub.cfg from Arch Linux. And also the "ls -l" of the Gentoo /boot location.

And if you want to install Grub on Gentoo, please provide the value of GRUB_PLATFORMS from your /etc/portage/make.conf and the complete Gentoo grub.cfg.


I am sorry, but I believe I mixed things up when installing Gentoo through Arch, to the point that when I chrooted with Gentoo he prompt said: arch...something was not right. Unfortunately like I said in my previous post, Gentoo does not see my Wifi card, although I fund out a driver that will work, I still have to figure out how to feed it to Gentoo to make it connect to my router....
Back to top
View user's profile Send private message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 366
Location: Nijmegen

PostPosted: Mon Aug 26, 2024 8:10 am    Post subject: Reply with quote

enrico68 wrote:
Pardon my novice question: how do I share a /boot partition between the two distributions? I have always dual booted with Windows, in UEFI, using two separate disks, this time I am dual booting two linux distros in mbr (my motherboard is from 2012 and only works in legacy mode) using the same disk. How do I make sure that when I run grub-mkconfig in Gentoo, it will find the Arch initramfs -linux.img and vmlinuz-linuz as well? This is the part that I am missing and that I would like to understand...I would really be thankful if you could explain it to me, this is my project, and I want to learn how to properly install multiple linux distros using the same disk.


For the mbr layout, create a new ~500MB primary (e.g. ext4) partition, and register this new partition in the /etc/fstab of both Gentoo and Arch to be mounted at /boot. Then temporarily mount the new partition at some temporary location (e.g. /mnt/boot), and copy the current contents of /boot on both Arch and Gentoo to this new partition. This way the kernels for both distro's are on the same partition and grub-mkconfig will find all of them always, without the need for os-prober. A potential problem you might encounter is that the grub settings (including kernel command line) of the distro in which you execute grub-mkconfig will apply to all kernels, not just the ones belonging to that distro.
_________________
OS: Gentoo 6.8.10-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
Weezer
n00b
n00b


Joined: 19 Apr 2024
Posts: 18

PostPosted: Mon Aug 26, 2024 10:44 am    Post subject: Reply with quote

enrico68 wrote:
Would that work even if my motherboard is in Legacy mode?

I am sure it will, one computer I use in this scenario is from 2007. Nothing involving EFI anywhere to be seen... I have 28 partitions on said machine. It's a really simple solution and oft unknown. No fighting with primary/extended partitions. Simply put a 1MB bios-boot partition at the beginning of the drive and you're off and running just like normal using gpt.

As you stated that you have Arch and Gentoo installed, you would have to move the data off, repartition, and move the data back on. It is fairly easy if you have somewhere to put the data, but you may just want to try it at a later time (also depending on your comfort level with something like that). You would have to change the UUIDs and re-install grub also. This is a bit of a process and you may not want to do all that at this point. If you wanted to start over, or ever do, you should look into that.

enrico68 wrote:
Let's see if I understand this: once I run mk-config in Gentoo, I manually edit the custom.cfg file with the generic initramfs-linux.img and vmlinux-linuz and use the sym links that point to those two generic entries in Gentoo's grub. After doing that, I copy the custom cfg. file into Arch's grub.config file and let Arch be the maintainer of Grub. Am I correct?


I think you are on the right track... In the custom.cfg you would use the generic entries and symlink those in your /boot directory to the correct kernel entries. I gave the commands above. That way you don't have to update your grub.cfg upon a kernel upgrade, but you do have to update your symlinks to point to the updated kernels.

What I do is let Gentoo create it's grub.cfg, copy only the menu entries from Gentoo's grub.cfg into a "custom.cfg". Edit the custom.cfg to use the generic symlinks instead of the actual kernel versions. Place that custom.cfg in Arch's /boot/grub/ directory and you should be good to go. Arch should recognize the custom.cfg automagically without any further input. And, yes, Arch should then be the only maintainer of grub from then on. Only manipulate the custom.cfg if needed.

You could also have Gentoo be the maintainer of grub, just reverse what I've laid out and put Arch grub menu entries into a custom.cfg in Gentoo's /boot/grub/. That's just a matter of preference or whichever is currently managing grub.

Here is my Gentoo's boot dir:

config-6.10.5-gentoo
config-6.10.6-gentoo
grub/
initramfs-6.10.5-gentoo.img
initramfs-6.10.6-gentoo.img
initramfs-linux-fallback.img -> initramfs-6.10.5-gentoo.img
initramfs-linux.img -> initramfs-6.10.6-gentoo.img
intel-uc.img
System.map-6.10.5-gentoo
System.map-6.10.6-gentoo
vmlinuz-6.10.5-gentoo
vmlinuz-6.10.6-gentoo
vmlinuz-linux -> vmlinuz-6.10.6-gentoo
vmlinuz-linux-fallback -> vmlinuz-6.10.5-gentoo


Then in custom.cfg, corresponding entry is (only the pertinent parts):

echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=etc,etc
echo 'Loading initial ramdisk ...'
initrd /intel-uc.img /initramfs-linux.img

Instead of:

echo 'Loading Linux 6.10.6-gentoo ...'
linux /vmlinuz-6.10.6-gentoo root=UUID=etc,etc
echo 'Loading initial ramdisk ...'
initrd /intel-uc.img /initramfs-6.10.6-gentoo.img

I also have fallback entries that point to the last kernel (see symlinks above).

IMHO - I wouldn't suggest sharing one /boot directory amongst different installs. Theoretically it could work, but that could also be a nightmare. Different kernels sometimes require different kernel-commands (ipv6.disable=1 fbcon=nodefer, etc etc). GRUB is going to apply the same settings to all kernels. Not sure I go that route but that's just me (never tried it).

Not sure if this helps or clouds things up, but there it is :)
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Mon Aug 26, 2024 12:04 pm    Post subject: Reply with quote

Quote:
For the mbr layout, create a new ~500MB primary (e.g. ext4) partition, and register this new partition in the /etc/fstab of both Gentoo and Arch to be mounted at /boot. Then temporarily mount the new partition at some temporary location (e.g. /mnt/boot), and copy the current contents of /boot on both Arch and Gentoo to this new partition. This way the kernels for both distro's are on the same partition and grub-mkconfig will find all of them always, without the need for os-prober. A potential problem you might encounter is that the grub settings (including kernel command line) of the distro in which you execute grub-mkconfig will apply to all kernels, not just the ones belonging to that distro.


Hi Andrew,

thank you very much for your precious support and guidance. I will try your system and see what I can accomplish. Like I said, this is my own project, and I chose it right to experiment and learn new tricks. Let's see how far I manage to get...

Best,

Enrico :wink:
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Mon Aug 26, 2024 12:13 pm    Post subject: Reply with quote

Quote:
Here is my Gentoo's boot dir:

config-6.10.5-gentoo
config-6.10.6-gentoo
grub/
initramfs-6.10.5-gentoo.img
initramfs-6.10.6-gentoo.img
initramfs-linux-fallback.img -> initramfs-6.10.5-gentoo.img
initramfs-linux.img -> initramfs-6.10.6-gentoo.img
intel-uc.img
System.map-6.10.5-gentoo
System.map-6.10.6-gentoo
vmlinuz-6.10.5-gentoo
vmlinuz-6.10.6-gentoo
vmlinuz-linux -> vmlinuz-6.10.6-gentoo
vmlinuz-linux-fallback -> vmlinuz-6.10.5-gentoo


Then in custom.cfg, corresponding entry is (only the pertinent parts):

echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=etc,etc
echo 'Loading initial ramdisk ...'
initrd /intel-uc.img /initramfs-linux.img

Instead of:

echo 'Loading Linux 6.10.6-gentoo ...'
linux /vmlinuz-6.10.6-gentoo root=UUID=etc,etc
echo 'Loading initial ramdisk ...'
initrd /intel-uc.img /initramfs-6.10.6-gentoo.img

I also have fallback entries that point to the last kernel (see symlinks above).

IMHO - I wouldn't suggest sharing one /boot directory amongst different installs. Theoretically it could work, but that could also be a nightmare. Different kernels sometimes require different kernel-commands (ipv6.disable=1 fbcon=nodefer, etc etc). GRUB is going to apply the same settings to all kernels. Not sure I go that route but that's just me (never tried it).

Not sure if this helps or clouds things up, but there it is :)


Hello Weezer,

wow, I feel like you did the dirty work for me...very clear indeed. Now I have to choose which method I want to try first between yours and Andrews'. Let's just say at least now I now more than I did just a few days ago, and the issue I had allowed me to ask and continue to learn and grow with Gentoo and Linux.

A big thank you for all your work, much appreciated! :)

Enrico
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Wed Aug 28, 2024 2:36 pm    Post subject: Reply with quote

Hi Weezer,

upon boot the system does not show Gentoo, just Arch.

Here is my custom grub.cfg in Arch. I decided to let Arch do the booting:

Code:
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry 'Gentoo' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-f2c0bfeb-9ea5-4261-93b4-5715bb9fded7 {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd0,3),msdos2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f2c0bfeb-9ea5-4261-93b4-5715bb9fded7
        else
          search --no-floppy --fs-uuid --set=root f2c0bfeb-9ea5-4261-93b4-5715bb9fded7
        fi
        echo    'Loading Linux linux ...'
        linux   /boot/vmlinuz-linux root=UUID=f2c0bfeb-9ea5-4261-93b4-5715bb9fded7 rw  loglevel=3 quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/intel-ucode.img /boot/initramfs-linux.img
}


### END /etc/grub.d/40_custom ###


Now I reboot and load Gentoo, to show you what I did in /boot....just give me a few minutes and I will be right back with more information...
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Wed Aug 28, 2024 2:53 pm    Post subject: Reply with quote

Here is what I see in /boot inside Gentoo:

Quote:


livecd /boot # ls
System.map amd-uc.img initramfs-linux.img vmlinuz
System.old initramfs-6.6.47-gentoo.img intel-ucode.img vmlinuz.old


I symlinked amd-uc.img to intel-ucode.img, and initramfs-gentoo to initramfs-linux.img because that is what the computer was looking for during bootup...Still, it seems I did not go very far...

What is it I am missing? First try not a great success....but I am not giving up until I see what I am looking for...

Waiting patiently for your precious inputs. At the end, I decided not to take Andrews's route right for the potential issues both of you mentioned when dealing with multiple kernels.

FYI: In Gentoo I only installed Grub, but did not run grub-mkconfig as you suggested, and I disabled os-prober in Arch.

Once this is settled, and I can boot into Gentoo, I have to make sure I have wifi connection, as I installed Gentoo through USB thethering as the Live CD would not see my Broadcom chipset. But one step at a time... :lol:
Back to top
View user's profile Send private message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 366
Location: Nijmegen

PostPosted: Thu Aug 29, 2024 6:45 am    Post subject: Reply with quote

Your custom grub.cfg has an entry named Gentoo, but the kernel and initramfs it references are not Gentoo kernels, that's the Arch kernel (unversioned)

Quote:
but did not run grub-mkconfig as you suggested


As I understand it, the idea here is to run grub-mkconfig on *both* distributions (without os-prober) and the concatenate the two config files together so it references all kernels with their proper initramfs.

Quote:
symlinked amd-uc.img to intel-ucode.img


I'd not do that, it's going to be confusing later. If you want the intel-ucode image then install sys-firmware/intel-microcode[initramfs]


In this configuration I'd actually recommend to do things the other way around, i.e. let Gentoo control the Grub instead of Arch. Because Gentoo installs the kernels versioned whereas Arch does not, which means the Arch part of the custom grub.cfg will probably never need to be updated whereas the Gentoo part of the custom grub.cfg will be constantly changing as kernel versions are added and removed. You might also have more luck with os-prober if you do things this way around. If os-prober still does not work, then you can use /etc/grub.d/ to re-create the static entry for Arch automatically and remove the need for concatenating the config files.

As a side note, sys-kernel/installkernel has the capability of updating a static symlink to the latest installed kernel, to utilize this manually create the symlinks vmlinuz and initramfs.img once, then installkernel will keep them up-to-date on consecutive kernel installs.
_________________
OS: Gentoo 6.8.10-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Thu Aug 29, 2024 6:53 am    Post subject: Reply with quote

I read through some of Grub options, and I trimmed down my custom grub.cfg like so:

Code:
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Gentoo Linux" {
        set root=(hd0,3)
        linux /boot/vmlinuz
        initrd  /boot/intel-ucode.img /boot/initramfs-linux.img
}
 

### END /etc/grub.d/40_custom ###


Now upon booting I see the Gentoo option, but when i choose it, I see a bunch of lines scrolling through the video, and then I get to a dark screen....
Back to top
View user's profile Send private message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 366
Location: Nijmegen

PostPosted: Thu Aug 29, 2024 7:01 am    Post subject: Reply with quote

Am I correct that you are booting a custom configured kernel for Gentoo? Could you please install our pre-configured distribution kernel first? Otherwise we are trying to solve multiple problems at the same time, black screen on a custom kernel usually means missing gpu/framebuffer drivers. But it will be a lot easier if we can first address the bootloader situation and then once this works find out why your custom kernel does not work.
_________________
OS: Gentoo 6.8.10-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 366
Location: Nijmegen

PostPosted: Thu Aug 29, 2024 7:05 am    Post subject: Reply with quote

Code:
/boot/initramfs-linux.img


You should name this initramfs.img instead, anything between "initramfs" and "img" is treated as a version identifier, and your kernel is named vmlinuz (without the "linux" version identifier). So many tools will get this confused and think this kernel has no initramfs, and that there is an initramfs with no associated kernel.
_________________
OS: Gentoo 6.8.10-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Thu Aug 29, 2024 9:26 am    Post subject: Reply with quote

AndrewAmmerlaan wrote:
Am I correct that you are booting a custom configured kernel for Gentoo? Could you please install our pre-configured distribution kernel first? Otherwise we are trying to solve multiple problems at the same time, black screen on a custom kernel usually means missing gpu/framebuffer drivers. But it will be a lot easier if we can first address the bootloader situation and then once this works find out why your custom kernel does not work.

Hello Andrew, you are correct, I am running a custom configured kernel, I will follow your suggestion as I trust your input and knowledge, and we will go from there.
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Thu Aug 29, 2024 9:30 am    Post subject: Reply with quote

AndrewAmmerlaan wrote:
Code:
/boot/initramfs-linux.img


You should name this initramfs.img instead, anything between "initramfs" and "img" is treated as a version identifier, and your kernel is named vmlinuz (without the "linux" version identifier). So many tools will get this confused and think this kernel has no initramfs, and that there is an initramfs with no associated kernel.

This is one more point where I likely failed at, and that is why I cannot dual boot. Your inputs are really precious and welcome.
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 189

PostPosted: Thu Aug 29, 2024 9:38 am    Post subject: Reply with quote

AndrewAmmerlaan wrote:
Your custom grub.cfg has an entry named Gentoo, but the kernel and initramfs it references are not Gentoo kernels, that's the Arch kernel (unversioned)

True, I renamed them as it is what the boot loader was looking for when I tried to boot up.

Quote:
but did not run grub-mkconfig as you suggested

As I understand it, the idea here is to run grub-mkconfig on *both* distributions (without os-prober) and the concatenate the two config files together so it references all kernels with their proper initramfs.


I will do that as well.

Quote:
symlinked amd-uc.img to intel-ucode.img

I'd not do that, it's going to be confusing later. If you want the intel-ucode image then install sys-firmware/intel-microcode[initramfs]

Another great tip...


Quote:
In this configuration I'd actually recommend to do things the other way around, i.e. let Gentoo control the Grub instead of Arch. Because Gentoo installs the kernels versioned whereas Arch does not, which means the Arch part of the custom grub.cfg will probably never need to be updated whereas the Gentoo part of the custom grub.cfg will be constantly changing as kernel versions are added and removed. You might also have more luck with os-prober if you do things this way around. If os-prober still does not work, then you can use /etc/grub.d/ to re-create the static entry for Arch automatically and remove the need for concatenating the config files.

As a side note, sys-kernel/installkernel has the capability of updating a static symlink to the latest installed kernel, to utilize this manually create the symlinks vmlinuz and initramfs.img once, then installkernel will keep them up-to-date on consecutive kernel installs.

Honestly, I skipped the part on sys-kernel/installkernel on purpose I have to give it another good read.

Now I have to put together all the pieces of the puzzle you gave me, and see what happens. I will report back either way.

In the meantime, I do not know how to thank you for giving me support in a kind but professional way, and I really appreciate it, many many thanks!! :wink:
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4848
Location: Bavaria

PostPosted: Thu Aug 29, 2024 9:42 am    Post subject: Reply with quote

enrico68,

if you configure your kernel yourself you have a lot of options to deal with the menu entries in grub ...

First of all:

enrico68 wrote:
[..] and then I get to a dark screen....

=>
AndrewAmmerlaan wrote:
[...] black screen on a custom kernel usually means missing gpu/framebuffer drivers. [...]

=>
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_Configuring_Kernel_Version_6.6#Part_3_-_Must_Haves

I also recommend a built-in microcode (for a manually configured kernel):
https://forums.gentoo.org/viewtopic-t-1065464.html

... and also built-in firmware:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_kernel_configuration#Driver_needs_Firmware

2. Do you need an initramfs for your manually configured kernel ? If really yes, do you know you can use an embedded initramfs also ? =>
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Initramfs_Overview#Special_Case:_Building_an_embedded_initramfs_with_a_CPIO_archive

3. You dont need a "make install" if you do the copying yourself ... If you dont want to work the whole time with "grub-mkconfig" you could make ONCE an entry in your grub configuration with a static name (e.g. vmlinuz-gentoo) (and a static intiramfs name too) and copy your kernel self; e.g.
cp /usr/src/linux/arch/x86/boot/bzImage /boot/vmlinuz-gentoo WITHOUT a version information.
Of course you should work with backups: copy your old kernel before this with:
mv /boot/vmlinuz-gentoo /boot/vmlinuz-gentoo.old
(and maybe use also two entries in your grub.cfg ... the other pointing to the old.kernel)

(see two examples:
1. with grub: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_kernel_configuration#Cheat_Sheets
2. With UEFI booting: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Boot_kernel_via_UEFI#Cheat_Sheets_for_a_standard_stub_kernel
)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Weezer
n00b
n00b


Joined: 19 Apr 2024
Posts: 18

PostPosted: Thu Aug 29, 2024 10:55 am    Post subject: Reply with quote

enrico68 wrote:
Hi Weezer,

upon boot the system does not show Gentoo, just Arch.

Here is my custom grub.cfg in Arch. I decided to let Arch do the booting:

Code:
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry 'Gentoo' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-f2c0bfeb-9ea5-4261-93b4-5715bb9fded7 {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd0,3),msdos2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f2c0bfeb-9ea5-4261-93b4-5715bb9fded7
        else
          search --no-floppy --fs-uuid --set=root f2c0bfeb-9ea5-4261-93b4-5715bb9fded7
        fi
        echo    'Loading Linux linux ...'
        linux   /boot/vmlinuz-linux root=UUID=f2c0bfeb-9ea5-4261-93b4-5715bb9fded7 rw  loglevel=3 quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/intel-ucode.img /boot/initramfs-linux.img
}


### END /etc/grub.d/40_custom ###


Now I reboot and load Gentoo, to show you what I did in /boot....just give me a few minutes and I will be right back with more information...


Hi Enrico - This doesn't look right to me.

It looks like you are trying to edit your grub.cfg in Arch. You don't need to do anything to Arch's grub.cfg.

Simply create a file named custom.cfg and put this in there:

menuentry 'Gentoo' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-f2c0bfeb-9ea5-4261-93b4-5715bb9fded7 {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,3),msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f2c0bfeb-9ea5-4261-93b4-5715bb9fded7
else
search --no-floppy --fs-uuid --set=root f2c0bfeb-9ea5-4261-93b4-5715bb9fded7
fi
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID=f2c0bfeb-9ea5-4261-93b4-5715bb9fded7 rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-linux.img
}

Nothing more, nothing less. Arch will see the custom.cfg without doing anything further. You should then be able to boot into Gentoo.

Forget about symlinking anything at the moment. Just use the Gentoo menu entries "as is" as created by Gentoo. When that is working you can do the symlinking later.

I use symlinks because my custom.cfg has seven different distro's in it. I don't want to continually edit it when kernel versions change.

Also, I mentioned that you should not run "grub-install" from Gentoo, not grub-mkconfig. Running grub-mkconfig is perfectly fine as that is how you get your menu entries to use in the custom.cfg file.

At this point, I would suggest removing all symlinks in your Gentoo /boot directory (if you made any). Re-run grub-mkconfig -o /boot/grub/grub.cfg and then copy the menu entries into custom.cfg which will be in Arch's /boot/grub/ directory.

Let me iterate that custom.cfg should be only the menu entries. Nothing preceding the entries and nothing after. I would post mine here but it is a very long file.

Andrew is not wrong about what hes is saying either, about versioning, etc. I simply use symlinks in the custom.cfg file so I don't have to manually edit at every kernel upgrade. The custom.cfg file NEVER changes once it is set up. I could call my symlinks franks-linux and franks-fallback-linux (dumb examples). They are just a pointer to the actual kernel entries.

In your Arch /boot/grub/ directory, you will have both:
grub.cfg
custom.cfg
Completely independent of each other.

You don't need os-prober because Arch will handle the Arch side of things and you will handle the custom.cfg (which when using symlinks, doesn't often change). The ONLY time custom.cfg changes is if you have to make changes due to configuration changes, etc. Then, you will either have to manually edit the custom.cfg file or re-create the entries within Gentoo and replace the entries in custom.cfg. Otherwise, you won't need to worry about anything grub related with Gentoo (you could actually uninstall it though not recommended). When I update my kernels in Gentoo, I re-create the symlinks to point to the new kernels. Done. No re-creating grub.cfg, etc.etc.

I hope I haven't made things more complicated whilst trying to make them easier. I think you arre close and once it "clicks", you will see what I'm doing....

Sorry I didn't see this earlier and I'll check back after a bit to see how we're doing. If you wan't to ignore all this and try os-prober I won't blame you :D
Back to top
View user's profile Send private message
Weezer
n00b
n00b


Joined: 19 Apr 2024
Posts: 18

PostPosted: Thu Aug 29, 2024 11:06 am    Post subject: Reply with quote

Pietinger and Andrew both are giving good advice as we may not be dealing with just grub issues here.

I should mention that I don't symlink anything related to ucode. I only symlink the kernel entries (because the version changes). That is really the only difference between the grub.cfg that Gentoo creates and the custom.cfg file. It should "just work" if done correctly prior to any symlinking.
Back to top
View user's profile Send private message
Weezer
n00b
n00b


Joined: 19 Apr 2024
Posts: 18

PostPosted: Thu Aug 29, 2024 11:27 am    Post subject: Reply with quote

AndrewAmmerlaan wrote:


As a side note, sys-kernel/installkernel has the capability of updating a static symlink to the latest installed kernel, to utilize this manually create the symlinks vmlinuz and initramfs.img once, then installkernel will keep them up-to-date on consecutive kernel installs.


I have been meaning to check this out myself, but I am so used to using a custom bash script I wrote I haven't bothered. It simply re-points the symlinks to the new kernel so I don't have to. Lazy :)

I think you are picking up what I'm doing here though. Esentially using each distro's grub to create it's own config, copying into a custom.cfg file, off and running. I think some of the confusion is that custom.cfg is it's own file with only menu entries from the other installation's grub.cfg. I use Arch as it was my first install on this machine, but I could use Debian, Void, Artix, etc. etc as the maintainer of Grub and do the exact same thing.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum