Bug 1636492 - failed to write boot loader configuration: ( ../grub-core/script/lexer.c:337:syntax error)
Summary: failed to write boot loader configuration: ( ../grub-core/script/lexer.c:337:...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: 29
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-05 14:07 UTC by Damian Wrobel
Modified: 2018-10-08 06:28 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-10-08 06:28:42 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
anaconda log (3.19 MB, text/x-vhdl)
2018-10-05 14:07 UTC, Damian Wrobel
no flags Details
complete journal log (4.24 MB, text/plain)
2018-10-05 14:08 UTC, Damian Wrobel
no flags Details
boot/grub2/grub.cfg.new (5.75 KB, text/plain)
2018-10-05 14:10 UTC, Damian Wrobel
no flags Details
boot/grub2/device.map (84 bytes, text/plain)
2018-10-05 14:10 UTC, Damian Wrobel
no flags Details
boot/grub2/grubenv (1.00 KB, text/plain)
2018-10-05 14:11 UTC, Damian Wrobel
no flags Details
entire etc directory (4.24 MB, application/x-xz)
2018-10-05 14:12 UTC, Damian Wrobel
no flags Details

Description Damian Wrobel 2018-10-05 14:07:26 UTC
Created attachment 1490857 [details]
anaconda log

Description of problem:

Fedora 29beta netinstall[1] fails to install grub bootloader.

Version-Release number of selected component (if applicable):
Fedora-Workstation-netinst-x86_64-29_Beta-1.5.iso[1]

Steps to Reproduce:
Standard install with the following partitioning:

# fdisk -l /dev/sda
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd8ebaf59

Device     Boot   Start        End    Sectors   Size Id Type
/dev/sda1          2048    2099199    2097152     1G 83 Linux
/dev/sda2  *    2099200    2508799     409600   200M  6 FAT16
/dev/sda3       2508800 1953523711 1951014912 930.3G 8e Linux LVM

# df -h
Filesystem                       Size  Used Avail Use% Mounted on
devtmpfs                         5.8G     0  5.8G   0% /dev
tmpfs                            5.9G   16K  5.9G   1% /dev/shm
tmpfs                            5.9G   65M  5.8G   2% /run
tmpfs                            5.9G     0  5.9G   0% /sys/fs/cgroup
/dev/sdb                         594M  594M     0 100% /run/install/repo
/dev/mapper/live-rw              2.0G  1.7G  202M  90% /
tmpfs                            5.9G  194M  5.7G   4% /tmp
/dev/mapper/fedora_samsung-root  147G  5.1G  135G   4% /mnt/sysimage
/dev/sda1                        976M  127M  782M  14% /mnt/sysimage/boot
/dev/sda2                        200M  8.0K  200M   1% /mnt/sysimage/boot/efi
tmpfs                            5.9G     0  5.9G   0% /mnt/sysimage/dev/shm
/dev/dm-4                        755G   73M  716G   1% /mnt/sysimage/home
/dev/mapper/fedora_samsung-tmp   7.9G   37M  7.4G   1% /mnt/sysimage/tmp

/home was setup using luks2 encryption

Actual results:
journalctl -u anaconda excerpt:

Oct 05 13:24:03 samsung anaconda[1580]: program: Generating grub configuration file ...
Oct 05 13:24:03 samsung anaconda[1580]: program: Found linux image: /boot/vmlinuz-4.18.11-301.fc29.x86_64
Oct 05 13:24:03 samsung anaconda[1580]: program: Found initrd image: /boot/initramfs-4.18.11-301.fc29.x86_64.img
Oct 05 13:24:03 samsung anaconda[1580]: program: Found linux image: /boot/vmlinuz-0-rescue-e2cd7b59ab32457fa6f3d3511426f6ea
Oct 05 13:24:03 samsung anaconda[1580]: program: Found initrd image: /boot/initramfs-0-rescue-e2cd7b59ab32457fa6f3d3511426f6ea.img
Oct 05 13:24:03 samsung anaconda[1580]: program: device-mapper: reload ioctl on osprober-linux-sdb1  failed: Device or resource busy
Oct 05 13:24:03 samsung anaconda[1580]: program: Command failed.
Oct 05 13:24:03 samsung anaconda[1580]: program: device-mapper: reload ioctl on osprober-linux-sdb2  failed: Device or resource busy
Oct 05 13:24:03 samsung anaconda[1580]: program: Command failed.
Oct 05 13:24:03 samsung anaconda[1580]: program: device-mapper: reload ioctl on osprober-linux-sdb3  failed: Device or resource busy
Oct 05 13:24:03 samsung anaconda[1580]: program: Command failed.
Oct 05 13:24:03 samsung anaconda[1580]: program: error: ../grub-core/script/lexer.c:337:$.
Oct 05 13:24:03 samsung anaconda[1580]: program: error: ../grub-core/script/lexer.c:337:syntax error.
Oct 05 13:24:03 samsung anaconda[1580]: program: error: ../grub-core/script/lexer.c:337:Incorrect command.
Oct 05 13:24:03 samsung anaconda[1580]: program: error: ../grub-core/script/lexer.c:337:syntax error.
Oct 05 13:24:03 samsung anaconda[1580]: program: Syntax error at line 79
Oct 05 13:24:03 samsung anaconda[1580]: program: Syntax errors are detected in generated GRUB config file.
Oct 05 13:24:03 samsung anaconda[1580]: program: Ensure that there are no errors in /etc/default/grub
Oct 05 13:24:03 samsung anaconda[1580]: program: and /etc/grub.d/* files or please file a bug report with
Oct 05 13:24:03 samsung anaconda[1580]: program: /boot/grub2/grub.cfg.new file attached.
Oct 05 13:24:03 samsung anaconda[1580]: program: Return code: 1
Oct 05 13:24:03 samsung anaconda[1580]: anaconda: bootloader: bootloader.write failed: failed to write boot loader configuration


Expected results:
boot loader should be installed without errors.

Additional info:
Relevant logs will be attached.

[1] https://download.fedoraproject.org/pub/fedora/linux/releases/test/29_Beta/Workstation/x86_64/iso/Fedora-Workstation-netinst-x86_64-29_Beta-1.5.iso

Comment 1 Damian Wrobel 2018-10-05 14:08:45 UTC
Created attachment 1490858 [details]
complete journal log

Comment 2 Damian Wrobel 2018-10-05 14:10:15 UTC
Created attachment 1490859 [details]
boot/grub2/grub.cfg.new

Comment 3 Damian Wrobel 2018-10-05 14:10:46 UTC
Created attachment 1490860 [details]
boot/grub2/device.map

Comment 4 Damian Wrobel 2018-10-05 14:11:24 UTC
Created attachment 1490861 [details]
boot/grub2/grubenv

Comment 5 Damian Wrobel 2018-10-05 14:12:26 UTC
Created attachment 1490862 [details]
entire etc directory

Comment 6 Damian Wrobel 2018-10-05 16:31:08 UTC
The offending line seems to be:
   set boot_counter=\$((\${boot_counter}-1))
from the etc/grub.d/01_fallback_counting file.

According to the shebang "#!/usr/bin/sh" using $(()) might be problematic. So I've tried to change it using "expr" but that didn't work for me also. Thus, to have bootable system I simple disable this part temporary as following:

$ diff -u 01_fallback_counting.orig 01_fallback_counting 
--- 01_fallback_counting.orig	2018-10-05 18:28:35.340154316 +0200
+++ 01_fallback_counting	2018-10-05 18:28:40.231194283 +0200
@@ -6,8 +6,8 @@
   if  [ "\${boot_counter}" = "0" -o "\${boot_counter}" = "-1" ]; then
     set default=1
     set boot_counter=-1
-  else
-    set boot_counter=\$((\${boot_counter}-1))
+#  else
+#    set boot_counter=\$((\${boot_counter}-1))
   fi
   save_env boot_counter
 fi

After that grub2-mkconfig stopped to complain.

Comment 7 Damian Wrobel 2018-10-08 06:28:42 UTC
Seems to be fixed by grub2-tools-2.02-62.fc29.x86_64 (which removed the /etc/grub.d/01_fallback_counting problematic file entirely).


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