Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Do you use an initramfs?
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  

Do you use an initramfs?
Yes, most distros do so I guess it's the right move
2%
 2%  [ 2 ]
Yes, I use genkernel so it's a no-brainer
7%
 7%  [ 7 ]
Yes, I've got a system setup that requires one
26%
 26%  [ 24 ]
Yes (Other - please explain)
5%
 5%  [ 5 ]
No, I do my own kernel so it's just more work
39%
 39%  [ 36 ]
No, it's just something else to go wrong
10%
 10%  [ 10 ]
No (Other - please explain)
8%
 8%  [ 8 ]
What's an initramfs?
0%
 0%  [ 0 ]
Total Votes : 92

Author Message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Mon Nov 11, 2013 12:23 pm    Post subject: Reply with quote

greyspoke wrote:
As a matter of interest, why is that (the last bit about being in sync)? I have raid and lvm in my initramfs on a simple system, and haven't been punctilious about updating the versions in the initramfs, yet haven't seen any problems. I can see that if I create new raid devices or volumes with a new version of the software then I ought to update that in the initramfs in case there isn't forward compatibility.

Exactly what you just said, I guess. But the point here is to have general advice and scripts that keep your system running no matter what. If we can't guarantee things are kept running, then they're not kept running. I for one do not want to have to enumerate the situations wherein an lvm upgrade in rootfs will remain compatible with whatever version is still in initramfs: I just want the one version on rootfs in use, and that's why I set my machine up as it is.
tw04l124 wrote:
For lvm and luks you need an initramfs.

If rootfs is on lvm or luks, then yes. If rootfs is a standard partition on your hard-disk, then no, you don't.
Again, this is exactly the same as the traditional cut-off point to require an initrd.

Which is kinda my point: nothing's really changed. The early-boot bring-up is exactly the same whether you do it via udev in an initramfs, or udev starting after localmount. The requirement for the former is the same as it always was: you need modules or devices loaded to access rootfs, have /usr on a network drive, or you have a modular kernel along the lines of a binary distro.

The network drive case can be mitigated on a source-distro, where you have kernel modules built-in for your mobo, not to require an initramfs, though it's not something I've done; again, nothing's changed, AFAICT.

The only change is that we've been told that udev needs local drives (ie the equivalent of localmount) accessible before it starts. Which is an initscript ordering, given the kernel most of us setup before we even reboot into our initial Gentoo install.
Back to top
View user's profile Send private message
greyspoke
Apprentice
Apprentice


Joined: 08 Jan 2010
Posts: 171

PostPosted: Tue Nov 12, 2013 9:11 am    Post subject: Reply with quote

steveL wrote:
greyspoke wrote:
As a matter of interest, why is that (the last bit about being in sync)? I have raid and lvm in my initramfs on a simple system, and haven't been punctilious about updating the versions in the initramfs, yet haven't seen any problems. I can see that if I create new raid devices or volumes with a new version of the software then I ought to update that in the initramfs in case there isn't forward compatibility.

Exactly what you just said, I guess. But the point here is to have general advice and scripts that keep your system running no matter what. If we can't guarantee things are kept running, then they're not kept running. I for one do not want to have to enumerate the situations wherein an lvm upgrade in rootfs will remain compatible with whatever version is still in initramfs: I just want the one version on rootfs in use, and that's why I set my machine up as it is.

...

Oh I agree, but I kind of fell into having an initramfs shortly after starting with Gentoo. When I set up my machine I didn't need one, my root was on a raid partition but not lvm and the kernel autothingy coped with that. Then an mdadm upgrade meant I needed an initramfs, then the /usr and/var things happened (they were logical volumes) and so on. Fortunately I realised I should probably upgrade the versions in the initramfs before I got caught out by something.
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1972

PostPosted: Tue Nov 12, 2013 9:58 am    Post subject: Reply with quote

greyspoke wrote:
...
As a matter of interest, why is that (the last bit about being in sync)? I have raid and lvm in my initramfs on a simple system, and haven't been punctilious about updating the versions in the initramfs, yet haven't seen any problems. I can see that if I create new raid devices or volumes with a new version of the software then I ought to update that in the initramfs in case there isn't forward compatibility.

I build my (hand-rolled) initramfs into the kernel, and so its contents are always reasonably up to date. It probably costs an extra couple of seconds on each kernel build, but means I don't have to worry about (in my case) mdadm getting out of date.
_________________
Greybeard
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Mon Nov 18, 2013 8:18 pm    Post subject: Reply with quote

The initramfs seems very kernel dependent beyond the modules inside of it... I think initramfs is a good idea but too many dependencies and makes it hard to maintain.

I ended up rolling my own, and it does help quite a bit. The main thing I like about them is that it's pretty much needed for any self booting removable media to guarantee (or almost guarantee) it locating the right root disk...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Randy Andy
Veteran
Veteran


Joined: 19 Jun 2007
Posts: 1148
Location: /dev/koelsch

PostPosted: Tue Nov 19, 2013 2:23 pm    Post subject: Reply with quote

eccerr0r wrote:
The main thing I like about them is that it's pretty much needed for any self booting removable media to guarantee (or almost guarantee) it locating the right root disk...


Especially for this case, I found a solution in using root=PARTUUID= for the kernel command line since kernel >= 2.6.37, compiled with CONFIG_EFI_PARTITION=y support and GPT partitioned storage devices, as I wrote into my early post of this thread, on page 1. :wink:

Regards, Andy.
_________________
If you want to see a Distro done right, compile it yourself!
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Tue Nov 19, 2013 3:04 pm    Post subject: Reply with quote

That's neat they fixed the kernel to understand UUID at boot time. I know that it didn't like labels at boot time.
Does it work for MBR?

I've been trying to build a bootable connection-agnostic media that is FAT32/MBR formatted with a Linux compatible container, so I can use the storage on the media with Windows and digital cameras/other portable, non-linux devices as well... I think this also needs initramfs, just like my root-on-lvm-on-RAID5 setup.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1246
Location: Edinburgh, UK

PostPosted: Tue Nov 19, 2013 5:51 pm    Post subject: Reply with quote

eccerr0r wrote:
That's neat they fixed the kernel to understand UUID at boot time. I know that it didn't like labels at boot time.
Does it work for MBR?

I've been trying to build a bootable connection-agnostic media that is FAT32/MBR formatted with a Linux compatible container, so I can use the storage on the media with Windows and digital cameras/other portable, non-linux devices as well... I think this also needs initramfs, just like my root-on-lvm-on-RAID5 setup.


Depends how globally generic/portable you need it to be. Random example: I stuck a second (ext2) partition and a bootloader onto a FAT32 thumbdrive. You'd think Windows and/or typical embedded devices wouldn't be troubled by this, but it prevented a Kodak photo kiosk from reading it.

You can't bank on much sanity when it comes to the foibles of embedded device OSes. After all, no one (who matters to them or could call them out on it) ever gets to see how shitty their code is O.o
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Tue Nov 19, 2013 8:23 pm    Post subject: Reply with quote

Well, the nice thing is that you can install grub on VFAT partition, and you have a container file that contains the ext2 partition; and the initramfs/kernel sits on the vfat partition...

This should be very compatible with any FAT device - only one partition still is visible - it should be fairly universally compatible.

Only exception is if the device hides stuff in the MBR. Then this would cause problems.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Randy Andy
Veteran
Veteran


Joined: 19 Jun 2007
Posts: 1148
Location: /dev/koelsch

PostPosted: Wed Nov 20, 2013 12:49 pm    Post subject: Reply with quote

eccerr0r wrote:
That's neat they fixed the kernel to understand UUID at boot time. I know that it didn't like labels at boot time.
Does it work for MBR?


Hi eccerr0r.

No. They improved the kernel to read out the Partition unique GUID (/dev/disk/by-partuuid/) without the need of a initramfs, which is different to the UUID (/dev/disk/by-uuid/)
The Partition unique GUID exist/ could only used, for GPT partitioned devices.

If you use blkid to show device information, you could see a UUID and a PARTUUID simulaneously which are different.
For GPT devices you could also specify a new Label which is called PARTLABEL (/dev/disk/by-partlabel/), but this could also be used only with the help of a initramfs.

So for now, we have lots of different possibilities for naming and mounting a GPT device, which could be:
by-path
UUID
PARTUUID
LABEL
PARTLABEL


Converting MBR schemes to GPT is easy and possible without loosing the data on the devices, but for thumbdrives a bit more tricky/risky.
But using GPT thumbdrives for older Windows versions is often like playing roulette.

Best, Andy.
_________________
If you want to see a Distro done right, compile it yourself!
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Wed Nov 20, 2013 3:01 pm    Post subject: Reply with quote

Ah there's the difference, GPT stores Partition UUID per partition versus MBR which does not have any identifier per partition. For MBR partition it depends on the underlying filesystem to expose a UUID, which still requires a user-space application to detect (maybe in the near future it won't?). Unfortunately for older devices and non-DOS devices probably don't understand GPT at all, so likely stuck with using MBR for a while...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Wed Nov 20, 2013 3:25 pm    Post subject: Reply with quote

Actually, MBR has PARTUUID as well. It's a pseudo-uuid, comprising of the disk identifier/NT disk signature and partition number. Something like 2b38f5ec-01 (first partition on the disk with a 2b38f5ec identifier). blkid from util-linux-2.24 will show it. If your partitions don't have it, you need to add a disk identifier to your disk - run fdisk, press x to enter expert mode, then press i. Kernels starting with 3.8 (I think) can boot from MBR disks with root=PARTUUID=2b38f5ec-01
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Wed Nov 20, 2013 4:01 pm    Post subject: Reply with quote

I guess if the disk has a user created-unique UUID that's stored in the MBR somehow, then that works. Unfortunately this is somewhat nonstandard as this was not defined in the MSDOS days... and Windows/NT disk signatures is an add-on...

There's still a lot of esoteric boot situations that initramfs is needed however! I've held out so long against using them but eventually caved in and started using it where it made sense. Root filesystem on LVM on mdraid I guess still needs this, or has someone found a solution to this too?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
k9dog
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jun 2009
Posts: 103
Location: Denmark

PostPosted: Sat Mar 19, 2022 6:59 pm    Post subject: Reply with quote

Use initramfs to boot raids, usb sticks etc atm.

I lack a method of seeing what modules are used by the initrd, those used for fx. USB stick, so have a hard time adding them to kernel. Alternatively I could add more just guessing, but I'd prefer not adding all unneeded modules for the early start. Atm. just adding fir a Gentoo startup.

So currently stuck with the initramfs on usb and raids, but I'm using genkernel just for creating it for an initial entry to disks. Nothing else.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sat Mar 19, 2022 7:54 pm    Post subject: Reply with quote

I mostly use an initrd fro root on raid, root in LVM and root in LVM on top of raid.

I have one system where I have root in LVM without an initrd. It works but logical volume manager is not happy.
I get to keep the pieces when ii fails too.
I really need to make it an initrd.

As I make my initrds to be kernel agnostic, I rarely make a new initrd. They are like firmware. Never updated, so I don't get much practice.
_________________
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
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Sat Mar 19, 2022 8:03 pm    Post subject: Reply with quote

I try to avoid using an initrd whenever i can. It's just extra complexity, and i don't want complexity in areas where it's not needed. I've also specifically made the software raid in my server using 0.90 metadata so the kernel can autodetect the arrays and i don't need an initrd.

My VPS has it's root in lvm, so i can't avoid having an initrd there. In that case i use genkernel to create it, i've placed the correct commandline for that in a script so i don't have to look it up every time :)
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4000
Location: Bavaria

PostPosted: Sat Mar 19, 2022 8:15 pm    Post subject: Reply with quote

I hate initramfs and see it the same as Helen Koike does (https://listman.redhat.com/archives/dm-devel/2019-February/msg00108.html).

LVM can be useful on servers with many disks, but not for a simple desktop or notebook with one or two disks. I have no need for it. The same with a raid; yes for servers.

I would never do a full disk encryption (because it is senseless) but of course I encrypt /home (no swap) on my notebook. I do this with fscrypt because it is (in my opinion) the best solution.

I do my own kernel configuration, so I have no need ever for initramfs.
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 483
Location: Gainesville, FL, USA

PostPosted: Sun Mar 20, 2022 3:14 am    Post subject: Reply with quote

NeddySeagoon wrote:
I have one system where I have root in LVM without an initrd. It works but logical volume manager is not happy.
I get to keep the pieces when ii fails too.
I really need to make it an initrd.

I'm impressed you can make root-on-LVM work without an initrd!

I've got a Busybox-based setup that assembles my initrd using a shell script. No kernel modules go in it, just Busybox, a statically linked LVM, and a few little scripts and configuration files. It can boot to a little rescue shell where it's even possible to rebuild the initrd.

NeddySeagoon wrote:
As I make my initrds to be kernel agnostic, I rarely make a new initrd. They are like firmware. Never updated, so I don't get much practice.

That's the great benefit of building those disk and video drivers in the kernel. That's what I do every time.

It's another of my tools I might get around to documenting and posting someday.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2913
Location: Edge of marsh USA

PostPosted: Sun Mar 20, 2022 4:28 am    Post subject: Reply with quote

Only to load Intel microcode. Does that count?
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/17.1/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3311
Location: Rasi, Finland

PostPosted: Sun Mar 20, 2022 8:04 am    Post subject: Reply with quote

I've developed my own little tool (I've not yet found a good name for the tool...) to build up the initramfs cpio. Since it only gathers files (smartly) into cpio, I needed to write the init script(s) there. That way I've learned how initramfs really works. This way I managed to write a good rescue environment there. And the rescue part of it is the real reason I use initramfs. It's nice to have ready to use rescue environment rather than trying to find that old, dusty, bitten by dog, USB rescue stick. :P
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Mar 20, 2022 11:38 am    Post subject: Reply with quote

Zucca,

You know about the kernel provided tool?
/usr/src/linux/usr/gen_init_cpio
_________________
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
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3311
Location: Rasi, Finland

PostPosted: Sun Mar 20, 2022 11:56 am    Post subject: Reply with quote

NeddySeagoon wrote:
You know about the kernel provided tool?
/usr/src/linux/usr/gen_init_cpio
Yes. I looked at it but it lacks (lacked?) some feature I currently don't remember.

The tool I developed only kind of extends cpio. It can handle some dependencies, like module and firmware and those which are found by ldd. But that's it.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Mon Mar 28, 2022 6:26 pm    Post subject: Reply with quote

holy necro...

Seems that microcode no longer requires initramfs to load, but I do wonder how the kernel vulnerabilities work when microcode is updated, seems it needs to re-check (among a lot of other things that do CPU-checks like mdraid speed checks and technically even bogomips) after a microcode upgrade?

root on lvm is actually still nice for desktop/laptop SSDs if you're prone to reconfiguring partition sizes frequently, it helps reduce partition moves which is a lot of unnecessary wear on the SSD. For mechanical HDDs, gparted will do just fine and will keep fragmentation down.

Also I still haven't cleaned up my cache target LVM initramfs. Sigh. If only I had a lot of spare SSDs lying around to experiment with.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 170
Location: Ancient Rome

PostPosted: Tue Apr 12, 2022 6:44 pm    Post subject: Reply with quote

It started because of luks+lvm, at first it was genkernel, but I felt it was doing too much of work behind curtain, I don't understood it and I didn't have enough knowledge to check how it is working, so I went with custom initramfs.
Few years with only custom initramfs until I bought two books on humble bundle: "Introducing ZFS on Linux" and "Hand-on Booting". First book convinced me to try ZFS - instead of having systems with mdraid, cryptsetup, lvm2 and btrfs, I can only use one tool. But there was one problem: making custom initramfs that works with ZFS. Every time I was failing this because ZFS doesn't have static use flag and I was getting initramfs that doesn't worked or when using emerge with ROOT variable I was getting over 100MB initramfs. The second book came to rescue: there was lots of information about dracut, so I tried it and it just worked.
Now every machine I have has dracut, except two: old dell laptop that wasn't powered on in at least 3 years and my old router/nas just in case I would broke it.
Also having booting into rescue environment by adding "rd.break" to kernel command line is much more convenient than searching for thumb drive with Gentoo.
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Wed Apr 13, 2022 1:27 pm    Post subject: Reply with quote

I use an initramfs built with genkernel on a laptop running Gentoo Testing (~amd64) but no initramfs on another laptop running Gentoo Stable (amd64). Both also use an initrd solely to load the latest Intel microcode for their respective CPU. In my use cases I don't find any advantage in using an initramfs as far as building/rebuilding the kernel is concerned, as I'm not doing anything fancy in the installations and, when building/rebuilding a kernel I often want to view or change something in the kernel config in any case. If I need to install Gentoo on another machine in future, I would opt not to use an initramfs unless it were essential for some particular reason.
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
linksLarry
n00b
n00b


Joined: 19 May 2022
Posts: 30

PostPosted: Thu May 19, 2022 7:06 pm    Post subject: Re: Do you use an initramfs? Reply with quote

Huh, guess I can't answer polls with links?! (Or I havn't figured it out)

I am with the (currently) 5% in the yes (other) category.

My reason is simple, I did not wan't to change my bios (I think legacy or something is needed, if I am wrong I will gladly ditch the fluff)

I built my computer with Windows (I know, gross; but with $5,000ish on the line I wanted to know it worked) and used to switch between fedora and gentoo nvme's like they were usb's. Now I am challenging myself to stick with no java gentoo, but it ain't easy! No github, only yahoo email option, and I'm sure i'll find other problem sites.

THANK YOU FORUM DEVS FOR NOT REQUIRING JAVA

tbh your question has me considering a change.
_________________
Moo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
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