Bug 1293986 - ostree admin instutil grub2-generate crashes, needs better definition for [bootversion]
Summary: ostree admin instutil grub2-generate crashes, needs better definition for [bo...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: ostree
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jonathan Lebon
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-23 22:11 UTC by Chris Murphy
Modified: 2016-05-30 14:29 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-30 14:29:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Chris Murphy 2015-12-23 22:11:29 UTC
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 17:49:20 UTC
(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 14:37:45 UTC
Hey Chris-
Can you let us know if Jonathan's above comment worked for you?

Comment 3 Chris Murphy 2016-03-10 03:26:32 UTC
-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 15:45:30 UTC
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 20:05:14 UTC
Yes this works.

Comment 6 Jonathan Lebon 2016-05-30 14:29:47 UTC
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.