Hello,
First of all, thanks for all the hard work you all put into this distro. It looks great :).
I would like to report a problem with the dracut version that I found in OMA. This error is possibly present in the upstream dracut version as well, but I haven’t taken the time to investigate that yet.
-
OpenMandriva Lx version: Lx3.02 Build 1180
-
Desktop environment (KDE, LXQT…): Default KDE that comes with OMA
-
Description of the issue (screenshots if relevant):
For OEM development purposes, I have generated a custom initrd with dracut dracut-045-3-omv2015.0.x86_64.rpm. However, I cannot boot the system with that initrd, as I get the following error on my screen:
dracut-initqueue[327]: /sbin/dmsquash-live-root: 169: /sbin/dmsquash-live-root: Syntax error: "(" unexpected (expecting "fi")
And after a timeout I am taken to the dracut rescue shell. Here’s a screenshot of the problem:
- Relevant informations (hardware involved, software version, logs or output…):
Detailed version information of dracut:
# rpm -q --info dracut
Name : dracut Relocations: (not relocatable)
Version : 045 Vendor: OpenMandriva
Release : 3 Build Date: sáb 29 abr 2017 17:38:56 -03
Install Date: seg 19 jun 2017 11:08:10 -0 Build Host: 10cores.openmandriva.org
Group : System/Base Source RPM: dracut-045-3.src.rpm
Size : 783792 License: GPLv2+
Signature : RSA/SHA1, qua 10 mai 2017 09:46:51 -03, Key ID 180922d8bf81de15
Packager : tpg <tpgxyz@gmail.com>
URL : https://dracut.wiki.kernel.org/
Summary : Next generation initrd image generator
Architecture: x86_64
Description :
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
Unlike existing implementations, dracut does hard-code as little as possible
into the initramfs. Dracut contains various modules which are driven by the
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
NFS, iSCSI, NBD, FCoE with the dracut-network package.
Procedure to reproduce the problem:
-
generate the initrd with dmsquash live and dash shell:
dracut /boot/initrd_live.img --force --add-drivers ‘isofs iso9660 ext4 sata_sis ata_piix pata_atiixp sata_via sata_nv ahci loop dm_snapshot usbcore usb_storage dm_mod dm_crypt’ --modules ‘dracut-systemd systemd-initrd base dm dmsquash-live terminfo rootfs-block kernel-modules resume dash i18n’
-
Boot OMA Lx3.02 and press ‘e’ to edit GRUB’s boot options. Edit kernel options and include the following options at the end (the rd.live.dir=oem does not need to exist, as the error occurs before any actual use of that dir):
linux … rd.live.image rd.live.dir=oem
-
Edit the initrd to use the one that was just created
initrd /boot/initrd_live.img
-
Press F10 to boot
I would upload a screenshot of this grub editing, but I can’t because I am a new user.
Main symptom: You should end up with the following error on the screen:
dracut-initqueue[327]: /sbin/dmsquash-live-root: 169: /sbin/dmsquash-live-root: Syntax error: "(" unexpected (expecting "fi")
Possible root cause: I did investigate this for a while, and I believe that I have found the root cause of the problem:
-
dracut aims to be POSIX compliant, and therefore uses /bin/dash is /bin/sh whenever possible, as stated in their wiki main page: Home · dracutdevs/dracut Wiki · GitHub
-
If we observe the dmsquash-live-root.sh (located at /usr/lib/dracut/modules.d/90dmsquash-live/dmsquash-live-root.sh) script at line 169, this is what is happening there:
163 if [ -z "$setup" -o -n "$readonly_overlay" ]; then 164 if [ -n "$setup" ]; then 165 warn "Using temporary overlay." 166 elif [ -n "$devspec" -a -n "$pathspec" ]; then 167 [ -z "$m" ] && 168 m=' Unable to find a persistent overlay; using a temporary one.' 169 m=($'\n' "$m" $'\n' 170 ' All root filesystem changes will be lost on shutdown.' 171 $'\n' ' Press any key to continue') 172 echo -e "\n\n\n${m[*]}\n\n\n" > /dev/kmsg
-
I’ve created a tiny script to try to reproduce this syntax error:
#!/bin/dash if /bin/true ; then [ -z "$m" ] && m=' Unable to find a persistent overlay; using a temporary one.' m=($'\n' "$m" $'\n' ' All root filesystem changes will be lost on shutdown.' $'\n' ' Press any key to continue') echo $m fi
I get the following error after executing this code:
./dracut_shell_test.sh: 6: ./dracut_shell_test.sh: Syntax error: "(" unexpected (expecting "fi")
As a quick and dirty workaround, I changed lines 169-171 of the script to look like this:
169 m=$'\n'"$m"$'\n'' All root filesystem changes will be lost on shutdown.'$'\n'' Press any key to continue')
And then generated the initrd again. After this change, my live initrd could boot normally. I hope all of this helps in solving the problem for other users.
Thanks!
Felipe