Kernel panics if initramfs was built using dash(1) as /bin/sh
If dash(1) is used as /bin/sh
, mkinitfs
produces a corrupt
initramfs with the following error message only and even returns 0
instead of an error code:
>$ mkinitfs
>/usr/bin/lddtree: 219: /usr/bin/lddtree: Bad substitution
>$ echo $?
>0
The resulting image causes the kernel to panic on reboot (exact wording might vary):
failed to execute init (error code: –2)
This is due to dash(1)
not supporting the shell substitution used in
lddtree
:
>$ sed -n 219p $(which lddtree)
for lib in ${libs//,/ } ; do
I highly suggest using more detailed error checks during the process of
(re)building the initramfs, otherwise user might ignore the above
mentioned error message or even miss them in case mkinitfs(1)
is being
scripted since it silently returns 0.
(from redmine: issue id 5636, created on 2016-05-26)
- Changesets:
- Revision d089f392 by Natanael Copa on 2016-05-30T16:58:21Z:
main/lddtree: remove bashism
ref #5636