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

2021-11-02 Thread Andrzej Zawadzki
   On 01.11.2021 23:15, Jan Rekorajski wrote:

On Sun, 31 Oct 2021, Jan Palus wrote:


On 31.10.2021 09:21, Jan Rekorajski wrote:

On Sun, 31 Oct 2021, Jan Palus wrote:


On 30.10.2021 23:23, baggins wrote:

commit 63a4b90ecfdd4ac023ab8542fd6af60f4c80516e
Author: Jan Rekorajski [1]
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:

[2]https://github.com/dracutdevs/dracut/blob/15398458685d376fef56b1bf6fe09ae7c68
324c1/src/install/dracut-install.c#L531

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

Tested dash, works. Generic initramfs detected and booted off encrypted root.

   So, can I safely remove entry:

   hold = dracut*

   from my config?

   Last dracut, that works with LUKS was dracut-054. (always good to have
   PLD Rescue ;-) )

   Thanks for fix!

   --

   Andrzej Zawadzki

References

   1. mailto:bagg...@pld-linux.org
   2. 
https://github.com/dracutdevs/dracut/blob/15398458685d376fef56b1bf6fe09ae7c68324c1/src/install/dracut-install.c#L531
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


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

2021-11-01 Thread Jan Rękorajski
On Sun, 31 Oct 2021, Jan Palus wrote:

> 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 
> > > > 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.

Tested dash, works. Generic initramfs detected and booted off encrypted root.

> > > (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.

Feel free to change it to a config if you prefer.

-- 
Jan Rękorajski| PLD/Linux
SysAdm | bagginspld-linux.org | http://www.pld-linux.org/
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


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

2021-10-31 Thread Jan Palus
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 
> > > 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.
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


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

2021-10-31 Thread Jan Rękorajski
On Sun, 31 Oct 2021, Jan Palus wrote:

> On 30.10.2021 23:23, baggins wrote:
> > commit 63a4b90ecfdd4ac023ab8542fd6af60f4c80516e
> > Author: Jan Rękorajski 
> > 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.

> 
> (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.

-- 
Jan Rękorajski| PLD/Linux
SysAdm | bagginspld-linux.org | http://www.pld-linux.org/
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


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

2021-10-30 Thread Jan Palus
On 30.10.2021 23:23, baggins wrote:
> commit 63a4b90ecfdd4ac023ab8542fd6af60f4c80516e
> Author: Jan Rękorajski 
> 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
let's leave a possibility to customize shell and instead of hardcoding
bash use:

add_dracutmodules+=" bash "

which effectively changes default shell.

(At some point I was going to add `add_dracutmodules+=" dash "` but must
have forgotten).

> 
> If /bin/sh is not bash then dracut initramfs is unable to grok encrypted 
> partitions.
> 
>  bash.patch  | 10 ++
>  dracut.spec |  4 +++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> ---
> diff --git a/dracut.spec b/dracut.spec
> index c9484a0..4384e98 100644
> --- a/dracut.spec
> +++ b/dracut.spec
> @@ -2,7 +2,7 @@ Summary:  Initramfs generator using udev
>  Summary(pl.UTF-8):   Generator initramfs wykorzystujący udev
>  Name:dracut
>  Version: 055
> -Release: 2
> +Release: 3
>  License: GPL v2+
>  Group:   Base
>  Source0: 
> https://www.kernel.org/pub/linux/utils/boot/dracut/%{name}-%{version}.tar.xz
> @@ -13,6 +13,7 @@ Patch1: os-release.patch
>  Patch2:  arch-libdir.patch
>  Patch3:  systemd-paths.patch
>  Patch4:  cryptsetup.patch
> +Patch5:  bash.patch
>  URL: https://dracut.wiki.kernel.org/
>  BuildRequires:   asciidoc
>  BuildRequires:   dash
> @@ -185,6 +186,7 @@ Bashowe dopełnianie składni dla polecenia dracut.
>  %patch2 -p1
>  %patch3 -p1
>  %patch4 -p1
> +%patch5 -p1
>  
>  %{__sed} -i -e 's,@libexecdir@,%{_libexecdir},g' 
> modules.d/50plymouth/module-setup.sh
>  %{__sed} -i -e 's,@lib@,%{_lib},g' modules.d/95resume/module-setup.sh
> diff --git a/bash.patch b/bash.patch
> new file mode 100644
> index 000..e51aae7
> --- /dev/null
> +++ b/bash.patch
> @@ -0,0 +1,10 @@
> +--- dracut-055/modules.d/00bash/module-setup.sh~ 2021-05-27 
> 14:34:19.0 +0200
>  dracut-055/modules.d/00bash/module-setup.sh  2021-10-30 
> 23:03:00.931687353 +0200
> +@@ -27,6 +27,6 @@
> + inst /bin/bash
> + 
> + # Prefer bash as default shell if no other shell is preferred.
> +-[[ -L $initdir/bin/sh ]] || ln -sf bash "${initdir}/bin/sh"
> ++ln -sf bash "${initdir}/bin/sh"
> + 
> + }
> 
> 
>  gitweb:
> 
> http://git.pld-linux.org/gitweb.cgi/packages/dracut.git/commitdiff/63a4b90ecfdd4ac023ab8542fd6af60f4c80516e
> 
> ___
> pld-cvs-commit mailing list
> pld-cvs-com...@lists.pld-linux.org
> http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en