Discussion:
dracut vs. genkernel
Stefan G. Weichinger
2013-06-12 11:06:58 UTC
Permalink
Greets, gentoo-users ...

I am currently trying to find out why my LVM2-volumes aren't activated
correctly at boot time. I am using packages from the overlay
systemd-love as I run systemd as init-system (why? that's another
discussion ;-) ).

Until now I always was kind of lazy and used genkernel (or lately
"genkernel-next") to build and install my kernels/modules. Yes, it's
uncool, but so far it worked for me and it was comfortable.

In my discussion with one of the devs of the systemd-love-overlay he
pointed me at dracut to generate my initramfs. Never used it before and
so I am still learning (yes, it booted already).

I found infos in the Gentoo Wiki but I would also hear your opinions and
experience:

How do you generate your kernel and initramfs with dracut? Any handy
scripts available ... any tricks or hints?

Where are the advantages of dracut compared to genkernel? The udev-approach?

Thanks, Stefan
Stefan G. Weichinger
2013-06-12 11:08:44 UTC
Permalink
Post by Stefan G. Weichinger
How do you generate your kernel and initramfs with dracut? Any handy
scripts available ... any tricks or hints?
Additional fact here:

I boot with grub2 ... so I need to have an initramfs generated that is
detected by grub2-mkconfig. For now I simply let it use the name of the
genkernel-initramfs ... how do you handle this?

Stefan
Canek Peláez Valdés
2013-06-12 15:53:45 UTC
Permalink
Post by Stefan G. Weichinger
Post by Stefan G. Weichinger
How do you generate your kernel and initramfs with dracut? Any handy
scripts available ... any tricks or hints?
I boot with grub2 ... so I need to have an initramfs generated that is
detected by grub2-mkconfig. For now I simply let it use the name of the
genkernel-initramfs ... how do you handle this?
I use this script to generate my initramfs:

--------------------------------------------------------------------------------
#!/bin/sh

KVER=$(readlink /usr/src/linux | sed "s/^linux-//g")

echo "Creating initrd for kernel version ${KVER}..."

FIRMWARE=""

for i in $(find /lib64/firmware -type f); do
FIRMWARE+=" ${i}"
done

/usr/bin/dracut -f -H -I "${FIRMWARE}" /boot/initrd-${KVER} ${KVER}
--------------------------------------------------------------------------------

I use this command to generate my GRUB2 config:

grub2-mkconfig -o /boot/grub2/grub.cfg

Everything just works. However, I don't use LVM, and I don't use the
systemd-love overlay.

Regards.
--
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México
Stefan G. Weichinger
2013-06-12 17:50:33 UTC
Permalink
Post by Canek Peláez Valdés
--------------------------------------------------------------------------------
#!/bin/sh
KVER=$(readlink /usr/src/linux | sed "s/^linux-//g")
echo "Creating initrd for kernel version ${KVER}..."
FIRMWARE=""
for i in $(find /lib64/firmware -type f); do
FIRMWARE+=" ${i}"
done
/usr/bin/dracut -f -H -I "${FIRMWARE}" /boot/initrd-${KVER} ${KVER}
--------------------------------------------------------------------------------
grub2-mkconfig -o /boot/grub2/grub.cfg
Everything just works. However, I don't use LVM, and I don't use the
systemd-love overlay.
Nice script, thanks!

I will have to adapt it a bit to be able to use it with

linux -> /usr/src/linux-git ....

But for stuff like gentoo-sources it just works, yes!

Stefan
Stefan G. Weichinger
2013-06-12 18:24:27 UTC
Permalink
Post by Stefan G. Weichinger
I will have to adapt it a bit to be able to use it with
linux -> /usr/src/linux-git ....
I hacked something ... can't share right now as I shamelessly used
function from genkernel to read in the kernel version ;-)

S
Michael Hampicke
2013-06-12 15:54:58 UTC
Permalink
Post by Stefan G. Weichinger
I am currently trying to find out why my LVM2-volumes aren't activated
correctly at boot time. I am using packages from the overlay
systemd-love as I run systemd as init-system (why? that's another
discussion ;-) ).
When you find a solution, I'd be interested :) Having the same problem,
also running grub2, systemd, lvm.

This is my current work-around

$ cat /etc/systemd/system/lvm.service
[Unit]
Description=Load LVM

[Service]
Type=oneshot
ExecStart=/sbin/pvscan
ExecStart=/sbin/vgscan --mknodes
ExecStart=/sbin/vgchange --sysinit -a ly
ExecStart=/usr/bin/sleep 1
ExecStart=/bin/mount -o noatime /dev/vg1/a /mnt/a
ExecStart=/bin/mount -o noatime /dev/vg1/b /mnt/b

[Install]
WantedBy=multi-user.target
Stefan G. Weichinger
2013-06-12 18:26:38 UTC
Permalink
Post by Michael Hampicke
This is my current work-around
$ cat /etc/systemd/system/lvm.service [Unit] Description=Load LVM
[Service] Type=oneshot ExecStart=/sbin/pvscan
ExecStart=/sbin/vgscan --mknodes ExecStart=/sbin/vgchange --sysinit
-a ly ExecStart=/usr/bin/sleep 1 ExecStart=/bin/mount -o noatime
/dev/vg1/a /mnt/a ExecStart=/bin/mount -o noatime /dev/vg1/b
/mnt/b
[Install] WantedBy=multi-user.target
Yes, looks like a workaround ;-)

I will check back if I find something ...

S

Loading...