Skip to contentSkip to conversation

dracut-systemd: ensure grep is installed as needed by rootfs-generator

PATCH In review NeilBrown 3 participants 9 messages Apr 9, 2015 – Dec 16, 2015 7 messages not in the archive

lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 dracut-systemd: ensure grep is installed as needed by rootfs-generator

rootfs-generator uses 'grep', but it is not installed in the initramfs by default.
So explicitly install it when installing rootfs-generator.sh

modules.d/98dracut-systemd/module-setup.sh +1 -0
index d9175573c777..780b39a2b4a1 100755
@@ -41,6 +41,7 @@ install() {
     inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount
     inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot
 
+    inst_multiple grep
     inst_script "$moddir/rootfs-generator.sh" $systemdutildir/system-generators/dracut-rootfs-generator
 
     for i in \

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Quoted 15 lines · NeilBrown

rootfs-generator uses 'grep', but it is not installed in the initramfs by default. So explicitly install it when installing rootfs-generator.sh

(quoted diff) +0 -0

b/modules.d/98dracut-systemd/module-setup.sh index d9175573c777..780b39a2b4a1 100755 --- a/modules.d/98dracut-systemd/module-setup.sh +++ b/modules.d/98dracut-systemd/module-setup.sh @@ -41,6 +41,7 @@ install() { inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot

Quoted 5 lines

+ inst_multiple grep inst_script "$moddir/rootfs-generator.sh"
$systemdutildir/system-generators/dracut-rootfs-generator

for i in \

I removed the usage of "grep" from rootfs-generator.sh for this simple case of finding a string in a small file.

<http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=d3d52b20e9374a6553c7a6cbe9ff0a9e08df10f9>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVNmDKAAoJEANOs3ABTfJwBKkQAJw1LBHJmY9K/7bOYcO5e/ay KPFignkvBBkimRewfPViKP1kRBW5Vj678sSQLEWrdXf21XUPnu4y1i6Elz0R7qzq efXs0MsuI13WVXi8nuQ4UPeqvNicMkA8QWfbuQEO0isoTRjs00lz56G9noKbAAJV vO1tu1TmroKp2IsaUkZTC6AzvYs2aS0kEfk45F6L09jsi0BXztLCF3ud4xpsw0LR LTBGEkH4MzluDPxxZijGHGTXuuB1o73/t8L83qTtoi7xLnq6RimBdt+XTNW7khv3 q2X3wVyBzO2yW3H5aOMgU2UqfnVgzE0VXljUqUiLi34jIBkO17HPqKM+J25d2WL+ Sz2p3tRbwmxPEmTZurxDiJN9f0A/vV0xldAF0Gbbjm8tEUSLhD2GDjCiLgaSyjtb KGEiQK5ZYtcE1u7Jxa0r8QuPeulJuM6CPx7xvAbyVWATJ97+LjvGfmAC78Xq3bXx ftHPWy8v9WsVv4REhza6bAuRexF20Gs59t/Kg7O/Rmp2ZXp9ElMwlhjmos/BmZCr q8oNyPfNo7/YUkI2tV+raKXuzhwZKWwp2E2soaUr3E9u0ZGaorS4Fwv3VmFNe/rK KAxVSJJ4hQDKEGL+k/vEW/3olnxkNT77aB4xIgX+mhDkMhayGfo5/tyrTHoUrihN Bwg8TjLCoW/dO7XOCIFq
=iT9u
-----END PGP SIGNATURE-----

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw
Quoted 22 lines · On Tue, 21 Apr 2015 16:38:06 +0200 Harald Hoyer…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Quoted 18 lines · NeilBrown

rootfs-generator uses 'grep', but it is not installed in the initramfs by default. So explicitly install it when installing rootfs-generator.sh

(quoted diff) +0 -0

b/modules.d/98dracut-systemd/module-setup.sh index d9175573c777..780b39a2b4a1 100755 --- a/modules.d/98dracut-systemd/module-setup.sh +++ b/modules.d/98dracut-systemd/module-setup.sh @@ -41,6 +41,7 @@ install() { inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot

+ inst_multiple grep inst_script "$moddir/rootfs-generator.sh"
$systemdutildir/system-generators/dracut-rootfs-generator

Quoted 7 lines
Quoted 2 lines

for i in \

I removed the usage of "grep" from rootfs-generator.sh for this simple case of finding a string in a small file.

<http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=d3d52b20e9374a6553c7a6cbe9ff0a9e08df10f9>

Just as good. Thanks.

NeilBrown

#5 lore raw

dracut is too "clever" at identifying modules to exclude.

In reply to NeilBrown

If I have booted a kernel with md/raid built in (no modules) and I use dracut to build the initramfs for a different kernel which has the md code compiled as separate modules, then it does not include the required md modules in the initramfs.

As a particular instance this happen when the root filesystem is on RAID0. The 'raid0.ko' module is not included and boot fails.

https://bugzilla.opensuse.org/show_bug.cgi?id=935993

This only happens when 'host-only' is selected (which is the default for openSUSE).

the modules.d/90mdraid/module-setup.sh code calls

instmods =drivers/md

instmods calls
module_is_host_only "raid0"
and this incorrectly fails.

If raid0.ko didn't have any alias this would succeed, but it does.

$ modinfo -F alias raid0
md-level-0
md-raid0
md-personality-2

However these aliases don't appear in any modalias file in /sys/devices, in /proc/crypto, or in /proc/modules.

Maybe you could parse /proc/mdstat..

if [ -f /proc/mdstat ]; then
while read _d _c _a _m _x; do
if [ "$_c" = ':' -a "$_a" = 'active' ]; then

      host_modalias["md-$_m"]=1

fi
done < /proc/mdstat
fi

but it all seems rather fragile. There are probably other modules that might miss out accidentally. dm?

Do we really need the host_modalias stuff?

Thanks,
NeilBrown

A message that is not in the archive (sent off-list or not yet received): 87r3l023ha.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/[email protected]

#7 lore raw

Re: dracut is too "clever" at identifying modules to exclude.

Quoted 22 lines · Neil Brown

If I have booted a kernel with md/raid built in (no modules) and I use dracut to build the initramfs for a different kernel which has the md code compiled as separate modules, then it does not include the required md modules in the initramfs.

As a particular instance this happen when the root filesystem is on RAID0. The 'raid0.ko' module is not included and boot fails.

https://bugzilla.opensuse.org/show_bug.cgi?id=935993

This only happens when 'host-only' is selected (which is the default for openSUSE).

the modules.d/90mdraid/module-setup.sh code calls

instmods =drivers/md

instmods calls
module_is_host_only "raid0"
and this incorrectly fails.

Quoted 6 lines

If raid0.ko didn't have any alias this would succeed, but it does.

$ modinfo -F alias raid0
md-level-0
md-raid0
md-personality-2

Huh? Is the module not loaded?

Quoted 22 lines

However these aliases don't appear in any modalias file in /sys/devices, in /proc/crypto, or in /proc/modules.

Maybe you could parse /proc/mdstat..

if [ -f /proc/mdstat ]; then
while read _d _c _a _m _x; do
if [ "$_c" = ':' -a "$_a" = 'active' ]; then

      host_modalias["md-$_m"]=1

fi
done < /proc/mdstat
fi

but it all seems rather fragile. There are probably other modules that might miss out accidentally. dm?

Do we really need the host_modalias stuff?

Thanks,
NeilBrown

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: dracut is too "clever" at identifying modules to exclude.

Quoted 23 lines · Harald Hoyer
Quoted 22 lines · Neil Brown

If I have booted a kernel with md/raid built in (no modules) and I use dracut to build the initramfs for a different kernel which has the md code compiled as separate modules, then it does not include the required md modules in the initramfs.

As a particular instance this happen when the root filesystem is on RAID0. The 'raid0.ko' module is not included and boot fails.

https://bugzilla.opensuse.org/show_bug.cgi?id=935993

This only happens when 'host-only' is selected (which is the default for openSUSE).

the modules.d/90mdraid/module-setup.sh code calls

instmods =drivers/md

instmods calls
module_is_host_only "raid0"
and this incorrectly fails.

Quoted 8 lines
Quoted 6 lines

If raid0.ko didn't have any alias this would succeed, but it does.

$ modinfo -F alias raid0
md-level-0
md-raid0
md-personality-2

Huh? Is the module not loaded?

No, because the running kernel has "md/raid built in (no modules)".

Thanks,
NeilBrown

Quoted 23 lines
Quoted 23 lines

However these aliases don't appear in any modalias file in /sys/devices, in /proc/crypto, or in /proc/modules.

Maybe you could parse /proc/mdstat..

if [ -f /proc/mdstat ]; then
while read _d _c _a _m _x; do
if [ "$_c" = ':' -a "$_a" = 'active' ]; then

      host_modalias["md-$_m"]=1

fi
done < /proc/mdstat
fi

but it all seems rather fragile. There are probably other modules that might miss out accidentally. dm?

Do we really need the host_modalias stuff?

Thanks,
NeilBrown

A message that is not in the archive (sent off-list or not yet received): 87vbabzv6a.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/[email protected]

#11 lore raw

Re: dracut is too "clever" at identifying modules to exclude.

Quoted 32 lines · Neil Brown
Quoted 30 lines · Harald Hoyer
Quoted 28 lines · Neil Brown

If I have booted a kernel with md/raid built in (no modules) and I use dracut to build the initramfs for a different kernel which has the md code compiled as separate modules, then it does not include the required md modules in the initramfs.

As a particular instance this happen when the root filesystem is on RAID0. The 'raid0.ko' module is not included and boot fails.

https://bugzilla.opensuse.org/show_bug.cgi?id=935993

This only happens when 'host-only' is selected (which is the default for openSUSE).

the modules.d/90mdraid/module-setup.sh code calls

instmods =drivers/md

instmods calls
module_is_host_only "raid0"
and this incorrectly fails.

If raid0.ko didn't have any alias this would succeed, but it does.

$ modinfo -F alias raid0
md-level-0
md-raid0
md-personality-2
Quoted 30 lines
Quoted 1 line

Huh? Is the module not loaded?

No, because the running kernel has "md/raid built in (no modules)".

Thanks,
NeilBrown

Quoted 23 lines
Quoted 23 lines

However these aliases don't appear in any modalias file in /sys/devices, in /proc/crypto, or in /proc/modules.

Maybe you could parse /proc/mdstat..

if [ -f /proc/mdstat ]; then
while read _d _c _a _m _x; do
if [ "$_c" = ':' -a "$_a" = 'active' ]; then

      host_modalias["md-$_m"]=1

fi
done < /proc/mdstat
fi

but it all seems rather fragile. There are probably other modules that might miss out accidentally. dm?

Do we really need the host_modalias stuff?

Thanks,
NeilBrown

Interesting... so we have to blow up the initramfs with the entire drivers/md in the case, where you switch from "compiled in" to "not compiled in"..

I guess that happens not that often, so better be safe than sorry.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

Re: dracut is too "clever" at identifying modules to exclude.

Quoted 60 lines · Harald Hoyer
Quoted 59 lines · Neil Brown
Quoted 23 lines · Harald Hoyer
Quoted 22 lines · Neil Brown

If I have booted a kernel with md/raid built in (no modules) and I use dracut to build the initramfs for a different kernel which has the md code compiled as separate modules, then it does not include the required md modules in the initramfs.

As a particular instance this happen when the root filesystem is on RAID0. The 'raid0.ko' module is not included and boot fails.

https://bugzilla.opensuse.org/show_bug.cgi?id=935993

This only happens when 'host-only' is selected (which is the default for openSUSE).

the modules.d/90mdraid/module-setup.sh code calls

instmods =drivers/md

instmods calls
module_is_host_only "raid0"
and this incorrectly fails.

Quoted 8 lines
Quoted 6 lines

If raid0.ko didn't have any alias this would succeed, but it does.

$ modinfo -F alias raid0
md-level-0
md-raid0
md-personality-2

Huh? Is the module not loaded?

No, because the running kernel has "md/raid built in (no modules)".

Thanks,
NeilBrown

Quoted 20 lines
Quoted 20 lines

However these aliases don't appear in any modalias file in /sys/devices, in /proc/crypto, or in /proc/modules.

Maybe you could parse /proc/mdstat..

if [ -f /proc/mdstat ]; then
while read _d _c _a _m _x; do
if [ "$_c" = ':' -a "$_a" = 'active' ]; then

      host_modalias["md-$_m"]=1

fi
done < /proc/mdstat
fi

but it all seems rather fragile. There are probably other modules that might miss out accidentally. dm?

Do we really need the host_modalias stuff?

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Thanks,
NeilBrown

Interesting... so we have to blow up the initramfs with the entire drivers/md in the case, where you switch from "compiled in" to "not compiled in"..

I guess that happens not that often, so better be safe than sorry.

remove host_modalias

<https://github.com/haraldh/dracut/commit/07a081f352497258862ae164d11d9e6dc2c5b959>

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw

Re: dracut is too "clever" at identifying modules to exclude.

Quoted 65 lines · Harald Hoyer
Quoted 64 lines · Harald Hoyer
Quoted 62 lines · Neil Brown
Quoted 23 lines · Harald Hoyer
Quoted 22 lines · Neil Brown

If I have booted a kernel with md/raid built in (no modules) and I use dracut to build the initramfs for a different kernel which has the md code compiled as separate modules, then it does not include the required md modules in the initramfs.

As a particular instance this happen when the root filesystem is on RAID0. The 'raid0.ko' module is not included and boot fails.

https://bugzilla.opensuse.org/show_bug.cgi?id=935993

This only happens when 'host-only' is selected (which is the default for openSUSE).

the modules.d/90mdraid/module-setup.sh code calls

instmods =drivers/md

instmods calls
module_is_host_only "raid0"
and this incorrectly fails.

Quoted 8 lines
Quoted 6 lines

If raid0.ko didn't have any alias this would succeed, but it does.

$ modinfo -F alias raid0
md-level-0
md-raid0
md-personality-2

Huh? Is the module not loaded?

No, because the running kernel has "md/raid built in (no modules)".

Thanks,
NeilBrown

Quoted 23 lines
Quoted 23 lines

However these aliases don't appear in any modalias file in /sys/devices, in /proc/crypto, or in /proc/modules.

Maybe you could parse /proc/mdstat..

if [ -f /proc/mdstat ]; then
while read _d _c _a _m _x; do
if [ "$_c" = ':' -a "$_a" = 'active' ]; then

      host_modalias["md-$_m"]=1

fi
done < /proc/mdstat
fi

but it all seems rather fragile. There are probably other modules that might miss out accidentally. dm?

Do we really need the host_modalias stuff?

Thanks,
NeilBrown

Quoted 8 lines
Quoted 4 lines

Interesting... so we have to blow up the initramfs with the entire drivers/md in the case, where you switch from "compiled in" to "not compiled in"..

I guess that happens not that often, so better be safe than sorry.

remove host_modalias

<https://github.com/haraldh/dracut/commit/07a081f352497258862ae164d11d9e6dc2c5b959>

Thanks a lot for resolving this!

NeilBrown