Bug 1177470

Summary: grub2-mkconfig create broken config with btrfs raid1 luks
Product: [Fedora] Fedora Reporter: Jonas Jonsson <jonas>
Component: grub2Assignee: Peter Jones <pjones>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: bcl, bugzilla, lkundrak, mads, pjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 12:35:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
0001-Generate-proper-syntax-for-btrfs-RAID1-on-luks.patch none

Description Jonas Jonsson 2014-12-27 18:58:02 UTC
Created attachment 973574 [details]
0001-Generate-proper-syntax-for-btrfs-RAID1-on-luks.patch

Description of problem:
When creating a grub configuration with /boot on raid1 btrfs luks partitions it contains syntax errors.

The system has two disks, each with the same GPT
 Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048            4095   1024.0 KiB  EF02  Grub2 data
    2            4096         8388574   4.0 GiB     8300  Linux

Both vda2 and vdb2 are encrypted with luks and have entries in /etc/crypttab
 luks-d82cd76c-abe0-47e7-9dd1-8164f710370b UUID=d82cd76c-abe0-47e7-9dd1-8164f710370b
 luks-9b147ec3-1fd2-4bd1-877d-8490d00bcb43 UUID=9b147ec3-1fd2-4bd1-877d-8490d00bcb43

grub2-install worked fine and /boot/grub2/i386-pc/load.cfg is correct
 cryptomount -u 9b147ec31fd24bd1877d8490d00bcb43
 cryptomount -u d82cd76cabe047e79dd18164f710370b

/etc/default/grub have the line
 GRUB_ENABLE_CRYPTODISK=y

Beside the minor annoyance that the list of insmod contain many duplicates, there are two syntax errors.

Each kernel entry contains the following four lines
        cryptomount -u 9b147ec31fd24bd1877d8490d00bcb43
        d82cd76cabe047e79dd18164f710370b
        set root='cryptouuid/9b147ec31fd24bd1877d8490d00bcb43
        cryptouuid/d82cd76cabe047e79dd18164f710370b'

This is obvious broken syntax. I've attached a patch for these problems. With the patch, the four lines are now.
        cryptomount -u 9b147ec31fd24bd1877d8490d00bcb43
        cryptomount -u d82cd76cabe047e79dd18164f710370b
        set root='cryptouuid/9b147ec31fd24bd1877d8490d00bcb43'
        set root='cryptouuid/d82cd76cabe047e79dd18164f710370b'

Version-Release number of selected component (if applicable):
grub2-2.02-0.13.fc21.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Setup a system with /boot on encrypted raid1 btrfs
2. run grub2-mkconfig

Actual results:
Broken config

Expected results:
Working config

Comment 1 Jaroslav Reznik 2015-03-03 16:39:46 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 2 Chris Murphy 2015-03-13 20:12:49 UTC
This should work one day but there are two problems at the moment. 

One is /boot on Btrfs isn't working due to bug 1200539 (anaconda runs grub2-mkconfig before initramfs appears) and bug 864198 (grubby doesn't fix bug 1200539 when /boot is on Btrfs).

Two is Anaconda/Fedora don't support encrypted /boot.

So I'm curious first off whether upstream GRUB2 works, and if not then the bug probably needs to be filed with them, and get it fixed upstream.

Comment 3 Jonas Jonsson 2015-03-17 09:29:27 UTC
From what I can tell, this problem exists in the Grub git repository as well.

Want me to file a bug upstream?

Comment 4 Fedora End Of Life 2016-07-19 12:35:16 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.