Bug 995816 - /bin/dracut-initqueue: line 72: syntax error near unexpected token `fi'
Summary: /bin/dracut-initqueue: line 72: syntax error near unexpected token `fi'
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dracut
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: dracut-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 996126
TreeView+ depends on / blocked
 
Reported: 2013-08-11 09:57 UTC by Steve Tyler
Modified: 2013-08-14 13:12 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 996126 (view as bug list)
Environment:
Last Closed: 2013-08-14 10:29:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
rdsosreport-2.txt captured with rd.debug on kernel command-line (288.83 KB, text/plain)
2013-08-11 09:57 UTC, Steve Tyler
no flags Details
dracut-initqueue-1 (2.01 KB, text/plain)
2013-08-11 10:01 UTC, Steve Tyler
no flags Details

Description Steve Tyler 2013-08-11 09:57:01 UTC
Created attachment 785364 [details]
rdsosreport-2.txt captured with rd.debug on kernel command-line

Description of problem:
[   13.419009] localhost dracut-initqueue[331]: /bin/dracut-initqueue: line 72: syntax error near unexpected token `fi'
[   13.422436] localhost dracut-initqueue[331]: /bin/dracut-initqueue: line 72: `    fi'

Version-Release number of selected component (if applicable):
rawhide boot.iso
Linux version 3.11.0-0.rc4.git2.1.fc20.x86_64

$ file boot.iso 
boot.iso: # ISO 9660 CD-ROM filesystem data 'Fedora rawhide x86_64           ' (bootable)
$ sha256sum boot.iso
31a186235adaaae33300de26a820a571e364cfabeafa131d1998053514db7356  boot.iso

How reproducible:
Always.

Steps to Reproduce:
1. $ qemu-kvm -m 4096 -hda f20-test-1.img -cdrom ~/xfr/fedora/rawhide/boot.iso -vga std -boot menu=on

Actual results:
dracut shell

Expected results:
installer welcome menu

Additional info:

Comment 1 Steve Tyler 2013-08-11 10:01:02 UTC
Created attachment 785366 [details]
dracut-initqueue-1

There needs to be a "then" on line 65:

$ less -N dracut-initqueue-1
...
     65     if [ $main_loop -gt $RDRETRY ];
     66         if ! [ -d /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ] ; then
     67             action_on_fail "Could not boot." && break
     68         fi
     69         warn "Not all disks have been found."
     70         warn "You might want to regenerate your initramfs."
     71         break
     72     fi
     73 done
...

Comment 2 Steve Tyler 2013-08-11 10:14:07 UTC
Bug introduced with this commit:

systemd/dracut-initqueue.sh: continue to boot if finished failed
author	Harald Hoyer <harald>	2013-08-05 09:23:16 (GMT)
http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/modules.d/98systemd/dracut-initqueue.sh?id=226e3710b4236c69a8f821b6a5c53a264fe4892a

Comment 3 Steve Tyler 2013-08-11 11:47:58 UTC
After an update, installed rawhide systems may hang during booting with the message in the bug summary displayed.

The easy workaround is to boot an earlier kernel.

The hard workaround is to boot into rescue mode from an F19 installer disc[1], fix dracut-initqueue.sh[2], and rebuild the initramfs with:
# dracut -f --kver <latest kernel version>

[1] You could probably do this after booting an earlier kernel, but I did not test that method.

[2] Per Comment 1. The full path is:
/usr/lib/dracut/modules.d/98systemd/dracut-initqueue.sh

Tested with:
$ qemu-kvm -m 4096 -hda f20-test-1.img -cdrom ~/xfr/fedora/F19/Fedora-19-x86_64-DVD.iso -vga std -boot menu=on

Comment 4 Steve Tyler 2013-08-11 12:16:45 UTC
(In reply to Steve Tyler from comment #3)
> After an update, installed rawhide systems may hang during booting with the
> message in the bug summary displayed.
...

Eventually, a dracut shell prompt is displayed with a message suggesting that you buy a USB stick as a dracut debugging aid ... :-)

Comment 5 Steve Tyler 2013-08-11 12:56:21 UTC
(In reply to Steve Tyler from comment #0)
...
> Version-Release number of selected component (if applicable):
> rawhide boot.iso
> Linux version 3.11.0-0.rc4.git2.1.fc20.x86_64
...

Here are some timestamps from boot.iso:

$ isoinfo -lR -i boot.iso | egrep 'squash|vmlinuz'
-rwxr-xr-x   2    0    0         5652376 Aug  7 2013 [  31354 00]  vmlinuz 
-rw-r--r--   1    0    0       223023104 Aug 10 2013 [  47272 00]  squashfs.img 
-rwxr-xr-x   2    0    0         5652376 Aug  7 2013 [  31354 00]  vmlinuz

Comment 6 Steve Tyler 2013-08-11 16:49:46 UTC
(In reply to Steve Tyler from comment #2)
> Bug introduced with this commit:
> 
> systemd/dracut-initqueue.sh: continue to boot if finished failed
> author	Harald Hoyer <harald>	2013-08-05 09:23:16 (GMT)
> http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/modules.d/98systemd/
> dracut-initqueue.sh?id=226e3710b4236c69a8f821b6a5c53a264fe4892a

In the future, it might be a good idea to do a bash syntax check using
the bash "-n" option
before committing any changes.

Doing that would have caught this problem immediately:

$ bash -n dracut-initqueue-1 
dracut-initqueue-1: line 72: syntax error near unexpected token `fi'
dracut-initqueue-1: line 72: `    fi'

$ bash -c 'help set' | less -N
...
     16       -n  Read commands but do not execute them.
...

Comment 7 Jakub Filak 2013-08-12 13:11:27 UTC
(In reply to Steve Tyler from comment #3)
> [1] You could probably do this after booting an earlier kernel, but I did
> not test that method.
> 
I tested this method and it works.

Comment 8 Harald Hoyer 2013-08-14 10:58:22 UTC
(In reply to Steve Tyler from comment #6)
> (In reply to Steve Tyler from comment #2)
> > Bug introduced with this commit:
> > 
> > systemd/dracut-initqueue.sh: continue to boot if finished failed
> > author	Harald Hoyer <harald>	2013-08-05 09:23:16 (GMT)
> > http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/modules.d/98systemd/
> > dracut-initqueue.sh?id=226e3710b4236c69a8f821b6a5c53a264fe4892a
> 
> In the future, it might be a good idea to do a bash syntax check using
> the bash "-n" option
> before committing any changes.
> 
> Doing that would have caught this problem immediately:
> 
> $ bash -n dracut-initqueue-1 
> dracut-initqueue-1: line 72: syntax error near unexpected token `fi'
> dracut-initqueue-1: line 72: `    fi'
> 
> $ bash -c 'help set' | less -N
> ...
>      16       -n  Read commands but do not execute them.
> ...

There is already a "syncheck" target in the upstream Makefile, which does exactly that.

Added "syncheck" as a requirement to the "archive" and "rpm" target now.

Thanks and sorry for the inconvenience!

Comment 9 Steve Tyler 2013-08-14 11:37:22 UTC
Thanks, Harald. Doing the syncheck in the Makefile is even better ...

I don't see a recent commit message here:
http://git.kernel.org/cgit/boot/dracut/dracut.git/log/Makefile

Comment 10 Harald Hoyer 2013-08-14 13:04:51 UTC
(In reply to Steve Tyler from comment #9)
> Thanks, Harald. Doing the syncheck in the Makefile is even better ...
> 
> I don't see a recent commit message here:
> http://git.kernel.org/cgit/boot/dracut/dracut.git/log/Makefile

pushed

Comment 11 Steve Tyler 2013-08-14 13:12:57 UTC
Thanks:

Makefile: do syncheck before creating the archive or rpm
http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/Makefile?id=919a7c4d6e9f88be38e3f3ec588d0bc9ae5bbe68


Note You need to log in before you can comment on or make changes to this bug.