Red Hat Bugzilla – Bug 1466036
Close file descriptor, flush buffers on grub.cfg and directory before exiting
Last modified: 2017-08-15 02:47:49 EDT
+++ This bug was initially created as a clone of Bug #1464611 +++
Description of problem:
Running grubby even to add kernel parameters to the command-line and then rebooting "hard" (power outage or open file descriptor in /boot) often results in boot issues.
Booting manually, or mounting (and playing the journal) of the /boot filesystem repairs the issue most of the time.
Version-Release number of selected component (if applicable):
Looking at upstream ( https://github.com/rhboot/grubby ) all versions up to and including 34b1436ccbd56eab8024314cab48f2fc880eef08 seem problematic as they do not fflush(fileno(out)) + fclose(out), nor fsync() the destination directory after rename.
Steps to Reproduce:
1. Create a VM with IP=192.168.122.10
NB: using XFS for /boot makes the bug more prone to appear
2. Run "ssh root@$192.168.122.10 grubby --args elevator=deadline --update-kernel DEFAULT && virsh destroy vm"
3. Run "virsh start vm"
VM is stopped at grub prompt due to a missing grub.cfg configuration file: this is typically repaired by a filesystem journal replay.
writeConfig() doesn't close its configuration file before rename() is called, nor when/before the process exits successfully.
fsync() is not called on the configuration file nor on the configuration directory.
Upstream PR: https://github.com/rhboot/grubby/pull/24
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.