Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do I know initramfs is working?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
hrnick
Guru
Guru


Joined: 31 Aug 2002
Posts: 425
Location: Sweden

PostPosted: Mon Feb 05, 2024 11:52 am    Post subject: How do I know initramfs is working? Reply with quote

I have tried to set up initramfs according to the Gentoo Wiki using genkernel after reading that Separate /usr now requires an initramfs. From what I understand any workarounds will no longer be supported and will be decommissioned, starting today. The question is; how do I know that I have set up initramfs correctly and that it's working?

There is something related to initramfs in /boot...
Code:
$ find /boot/ -iname *initr*
/boot/initramfs-6.6.10-gentoo-x86_64.img.old
/boot/initramfs-6.7.1-gentoo-r1-x86_64.img


...and something is being unpacked when booting...
Code:
$ dmesg | grep initr
[    0.436268] Unpacking initramfs...
[    1.149086] Freeing initrd memory: 9192K


Is this enough to feel comfortable that my system will be able to boot once all the workarounds have been decommissioned or is there any other way of telling? Any help would be appreciated!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54263
Location: 56N 3W

PostPosted: Mon Feb 05, 2024 1:18 pm    Post subject: Reply with quote

hrnick,

In theory, an initrd will only be required on systems that have /usr on a separate filesystem to / (root)

Until the separate /usr workarounds have been removed. there is no way to test.
My setup does not currently need an initrd and I have both /usr and /var on their own logical volumes.

I've made and tested an initrd and I shall be testing weekly to see if its required or not.

I also do lots of other not recommend things, partly because I can and partly because I don't like automation I don't understand.

The intent is that both root and /usr must be available before localmount runs as bits of /usr will be required before then.

-- edit --

I suppose you could edit the localmount script to run
Code:
df
when it starts and finishes.
That will only show that the initrd met the intent of the change.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
hrnick
Guru
Guru


Joined: 31 Aug 2002
Posts: 425
Location: Sweden

PostPosted: Mon Feb 05, 2024 8:40 pm    Post subject: Reply with quote

NeddySeagoon wrote:
In theory, an initrd will only be required on systems that have /usr on a separate filesystem to / (root)

This is the setup I have, that's why I have been eager to set this up correctly...

Quote:
Until the separate /usr workarounds have been removed. there is no way to test.
My setup does not currently need an initrd and I have both /usr and /var on their own logical volumes.

So there will be exciting times ahead then, I'll make sure to have my bootable Gentoo USB stick ready. :D

Quote:
I suppose you could edit the localmount script to run
Code:
df
when it starts and finishes.
That will only show that the initrd met the intent of the change.

So both / and /usr are mounted before mount -at is run by /etc/init.d/localmount, I guess that's the sign I am looking for then?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54263
Location: 56N 3W

PostPosted: Mon Feb 05, 2024 9:05 pm    Post subject: Reply with quote

hrnick,

Yes, correct. That's as good as it gets today.
Now we can wait for the breakage. :)
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
hrnick
Guru
Guru


Joined: 31 Aug 2002
Posts: 425
Location: Sweden

PostPosted: Mon Feb 05, 2024 9:08 pm    Post subject: Reply with quote

Thanks for your help! I'll start making popcorn and keep that USB stick ready. :D
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1541
Location: South America

PostPosted: Mon Feb 05, 2024 9:16 pm    Post subject: Reply with quote

NeddySeagoon wrote:
My setup does not currently need an initrd and I have both /usr and /var on their own logical volumes.

Same. The rootfs is an ext4 partition, the kernel has all needed support for mounting it built-in, /usr is an LVM logical volume, everything needed by OpenRC (and an s6-based init system) before filesystems in /etc/fstab are mounted lives in /bin, /lib64 and /sbin, including vgchange, so all is good.

Well, except for (the soon to become EWONTFIX, I suppose) bug 902829, which forces me to make a copy of libcrypto in /lib64 each time I see dev-libs/openssl scheduled for update, but that's life I guess :)

hrnick wrote:
So both / and /usr are mounted before mount -at is run by /etc/init.d/localmount, I guess that's the sign I am looking for then?
/usr would be mounted before even OpenRC starts running, yeah. I don't know how an initramfs created by dracut or Genkernel manages running the udev daemon in a way that doesn't conflict with the service manager later, though.

Also, OpenRC's localmount creates a /run/openrc/usr_premounted file if it finds that /usr is already mounted, you can check that for a clue.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)


Last edited by GDH-gentoo on Mon Feb 05, 2024 9:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54263
Location: 56N 3W

PostPosted: Mon Feb 05, 2024 9:26 pm    Post subject: Reply with quote

GDH-gentoo,

Quote:
Also, OpenRC's localmount creates a /run/openrc/usr_premounted ...


Openrc used to shout at me about /usr already mounted until I set it noauto in fstab..
I noticed that was missing.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1541
Location: South America

PostPosted: Mon Feb 05, 2024 9:38 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Openrc used to shout at me about /usr already mounted until I set it noauto in fstab..
I noticed that was missing.

Are you still on OpenRC 0.17?
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54263
Location: 56N 3W

PostPosted: Mon Feb 05, 2024 9:40 pm    Post subject: Reply with quote

GDH-gentoo.

Yep.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1541
Location: South America

PostPosted: Mon Feb 05, 2024 9:53 pm    Post subject: Reply with quote

Then there's your answer :wink:
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
sublogic
Apprentice
Apprentice


Joined: 21 Mar 2022
Posts: 222
Location: Pennsylvania, USA

PostPosted: Mon Feb 05, 2024 11:42 pm    Post subject: Reply with quote

hrnick wrote:
I have tried to set up initramfs according to the Gentoo Wiki using genkernel [...]

Genkernel handles /usr on a separate partition out of the box. It installs a file /etc/initramfs.mounts that you can edit as needed.

The /init in the initramfs finds the root device, mounts it on /newroot, checks /newroot/etc/initramfs.mounts and mounts what you specified, taking parameters from /newroot/etc/fstab . In fact, mounting /usr seems to be enabled by default. I don't have a separate /usr, never customized for one, and sure enough, my /run/initramfs/init.log has a harmless note:
Code:
Failed (1): 'mountpoint -q /newroot/usr'
because it tried anyway.

hrnick wrote:
The question is; how do I know that I have set up initramfs correctly and that it's working?

To test, boot with a debug option (how to do that depends on your bootloader). The /init will pause three times to a rescue shell:
  1. Before starting udev;
  2. before setting up the root filesystem;
  3. before switch_root.
Type exit twice to get past the first two. At the third, look at /newroot/usr . If it's populated, you are ready. Exit again to switch_root and finish booting.
Back to top
View user's profile Send private message
hrnick
Guru
Guru


Joined: 31 Aug 2002
Posts: 425
Location: Sweden

PostPosted: Tue Feb 06, 2024 7:38 am    Post subject: Reply with quote

GDH-gentoo wrote:
Also, OpenRC's localmount creates a /run/openrc/usr_premounted file if it finds that /usr is already mounted, you can check that for a clue.

sublogic wrote:
Genkernel handles /usr on a separate partition out of the box. It installs a file /etc/initramfs.mounts that you can edit as needed.

/run/openrc/usr_premounted exists and /etc/initramfs.mounts seems to be set up to mount /usr already so those are other good signs. Thanks guys!

sublogic wrote:
To test, boot with a debug option (how to do that depends on your bootloader). The /init will pause three times to a rescue shell:
  1. Before starting udev;
  2. before setting up the root filesystem;
  3. before switch_root.
Type exit twice to get past the first two. At the third, look at /newroot/usr . If it's populated, you are ready. Exit again to switch_root and finish booting.

So this would probably be a next step to feel more comfortable that everything is set up correctly. Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
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