[packages/dracut] - bash is *required* for dracut initramfs to work correctly, rel 3

Jan Palus atler at pld-linux.org
Sun Oct 31 11:56:00 CET 2021


On 31.10.2021 09:21, Jan Rękorajski wrote:
> On Sun, 31 Oct 2021, Jan Palus wrote:
> 
> > On 30.10.2021 23:23, baggins wrote:
> > > commit 63a4b90ecfdd4ac023ab8542fd6af60f4c80516e
> > > Author: Jan Rękorajski <baggins at pld-linux.org>
> > > Date:   Sat Oct 30 23:21:06 2021 +0200
> > > 
> > >     - bash is *required* for dracut initramfs to work correctly, rel 3
> > 
> > At some point dracut started to pretend mksh is supported as /bin/sh
> > inside initramfs but that's simply not true. Default fallback is
> > whatever system /bin/sh is linked which in our case is mksh hence broken
> > initramfs in some cases. Going back to previous default "dash" helped in
> > my case (lvm) -- are you sure it really needs bash? And perhaps maybe
> 
> I know for certain that mksh does not. And very silently at that. Initramfs
> just doesn't detect encrypted partitions.
> 
> > let's leave a possibility to customize shell and instead of hardcoding
> > bash use:
> > 
> > add_dracutmodules+=" bash "
> > 
> > which effectively changes default shell.
> 
> I'm not so sure. What I found in the code is that dracut first installs
> /bin/sh and then shell modules (00bash, 00dash, 00mksh) as needed.
> But, those modules do not create /bin/sh if it already exists, and since
> that symlink is installed first it will not be re-created.

Works for me. The place where dracut installs /bin/sh -> mksh is at first
script with /bin/sh shebang:

https://github.com/dracutdevs/dracut/blob/15398458685d376fef56b1bf6fe09ae7c68324c1/src/install/dracut-install.c#L531

Hence shell modules (bash/dash/mksh) are ordered with 00 before any such
script could be installed.

> > 
> > (At some point I was going to add `add_dracutmodules+=" dash "` but must
> > have forgotten).
> 
> Dracut already requires and installs bash into the initramfs for its own
> needs. I'd rather stick to my "fix" to make absolutely sure it's there
> and as /bin/sh to avoid new surprises.
> 
> Besides /etc/dracut.conf.d/01-dist.conf is marked in package as
> config(noreplace) and you may end up with .rpmnew and effectively a
> noop.

True. We could add a new file like 00-default-shell.conf though.


More information about the pld-devel-en mailing list