Bug 1293986 - ostree admin instutil grub2-generate crashes, needs better definition for [bootversion]
ostree admin instutil grub2-generate crashes, needs better definition for [bo...
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: ostree (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jonathan Lebon
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-23 17:11 EST by Chris Murphy
Modified: 2016-05-30 10:29 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-30 10:29:47 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Chris Murphy 2015-12-23 17:11:29 EST
Description of problem:

Regardless of what I try for [bootversion] I get a crash,
ostree admin instutil -v grub2-generate 
**
ERROR:src/libostree/ostree-bootloader-grub2.c:154:_ostree_bootloader_grub2_generate_config: assertion failed: (grub2_boot_device_id != NULL)
Aborted (core dumped)



Version-Release number of selected component (if applicable):
ostree-2015.11-2.fc23.x86_64


How reproducible:
Almost always regardless of what I specify for [bootversion], exceptions are integer values above 2 for which it just says it's an invalid bootversion.



Steps to Reproduce:
1. Help says it wants [BOOTVERSION] as a parameter but it won't accept any variation of VERSION or ID provided by rpm-ostree status. The failure suggests it's looking for grub2_boot_device_id but all variations to specify that also fail.



Actual results:

Crash

Expected results:

Either fail without crashing, or help could better define what parameter this command is expecting.


Additional info:
Comment 1 Jonathan Lebon 2015-12-24 12:49:20 EST
(In reply to Chris Murphy from comment #0)
> Description of problem:
> 
> Regardless of what I try for [bootversion] I get a crash,
> ostree admin instutil -v grub2-generate 
> **
> ERROR:src/libostree/ostree-bootloader-grub2.c:154:
> _ostree_bootloader_grub2_generate_config: assertion failed:
> (grub2_boot_device_id != NULL)
> Aborted (core dumped)

Right, as mentioned on the mailing list, this shouldn't be manually called by the user, AFAICT.

---

Related to what you're trying to do, I believe the following PR should fix your grub2-mkconfig woes:

https://github.com/GNOME/ostree/pull/165

In the meantine, as a workaround, you can directly set the _OSTREE_GRUB2_BOOTVERSION env var to the current bootversion (e.g. if /boot/loader is pointing to loader.1, then it's 1).
Comment 2 Jen Krieger 2016-01-27 09:37:45 EST
Hey Chris-
Can you let us know if Jonathan's above comment worked for you?
Comment 3 Chris Murphy 2016-03-09 22:26:32 EST
-bash-4.3# ls -l /boot
total 22
drwxr-xr-x. 3 root root  1024 Dec 31  1969 efi
drwxr-xr-x. 6 root root  1024 Mar  9 20:23 grub2
lrwxrwxrwx. 1 root root     8 Mar  9 15:53 loader -> loader.0
drwxr-xr-x. 3 root root  1024 Mar  9 20:23 loader.0
drwx------. 2 root root 12288 Mar  9 15:51 lost+found
drwxr-xr-x. 3 root root  1024 Mar  9 15:52 ostree

-bash-4.3# export _OSTREE_GRUB2_BOOTVERSION=0
-bash-4.3# ostree admin instutil -v grub2-generate 
**
ERROR:src/libostree/ostree-bootloader-grub2.c:154:_ostree_bootloader_grub2_generate_config: assertion failed: (grub2_boot_device_id != NULL)
Aborted (core dumped)
-bash-4.3# rpm -q ostree
ostree-2015.11-2.fc23.x86_64
-bash-4.3# ostree admin status
* fedora-atomic 1a68c7b9c0ad54d438752c12666752639b502fe8c6f24004de60d68c01919062.0
    Version: 23.79
    origin refspec: fedora-atomic:fedora-atomic/f23/x86_64/docker-host
Comment 4 Jonathan Lebon 2016-03-10 10:45:30 EST
Hi Chris,

As mentioned earlier, the `grub2-generate` subcommand is not designed for running by the user. You should however be able to do e.g.

# bootver=$(readlink /boot/loader)
# _OSTREE_GRUB2_BOOTVERSION=${bootver#*.} grub2-mkconfig

And always have it output a functioning grub configuration file, regardless of the bootversion. Can you confirm that this works?
Comment 5 Chris Murphy 2016-03-10 15:05:14 EST
Yes this works.
Comment 6 Jonathan Lebon 2016-05-30 10:29:47 EDT
This should definitely be fixed in ostree-2016.5-3.fc23, now in stable.

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