FS#38812 - [grub] Operations with "grub" package may break down working GRUB bootloader

Attached to Project: Arch Linux
Opened by Natrio (natrio) - Thursday, 06 February 2014, 09:39 GMT
Last edited by Ronald van Haren (pressh) - Thursday, 06 February 2014, 15:25 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Tobias Powalowski (tpowa)
Ronald van Haren (pressh)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

The GRUB consist of two independent sections:
* GRUB bootloader in /boot/grub and system disk areas, working without any OS and without any packages.
* Files and utils for install/configure, works under Arch Linux, and provides by "grub" package.

The "grub" package provides files ant utils, but doesn't install the bootloader.
With small, but very bad exeprion: "grub.cfg" file. This file is an important part of GRUB bootloader, but provides by "grub" package with bootloader-only (not /usr/) path: /boot/grub/grub.cfg

Moreover, the current "grub" package contains absolutely unworkable and useless version of this file (wrong UUID's, for example), despite the fact that when you install the package immediately generating significantly more actual version.
grub.install:
grub-mkconfig -o /boot/grub/grub.cfg.example

Possible situations in which the operation with package "grub" may break down the next booting the system:

* When uninstalling "grub" package (but not the bootloader!), the existing working GRUB bootloader file "grub.cfg" is automatically moved to "grub.cfg.pacsave", because same time it is a part of the package.

* When installing of "grub" package, the existing working "grub.cfg" may be raplaced by NOT TESTED "grub.cfg.pacsave" file, if it will by found in /boot/grub/
grub.install:
if [ -f /boot/grub/grub.cfg.pacsave ]; then
echo "Copying /boot/grub/grub.cfg.pacsave to /boot/grub/grub.cfg"
install -D -m0644 /boot/grub/grub.cfg.pacsave /boot/grub/grub.cfg
fi

The fixes can resolve that collision and improve usability of "grub" package:

1) In package files: rename "grub.cfg" to "grub.cfg.default"
2) New "grub.install" script (see attachment). It can write to grub.cfg ONLY if it NOT exists, and have 3 candidats to grub.cfg (in priority order): grub.cfg.pacsave, grub.cfg.auto (generated) and grub.cfg.default (from package).
This task depends upon

Closed by  Ronald van Haren (pressh)
Thursday, 06 February 2014, 15:25 GMT
Reason for closing:  Won't fix
Additional comments about closing:  Works as intended.
Comment by Ronald van Haren (pressh) - Thursday, 06 February 2014, 15:24 GMT
The grub.cfg file is installed so that your grub config is backed up when removing grub. Next time you install grub it is copied back. If you remove grub again, it is copied to pacsave again, which is copied back again when reinstalled.

- IMO removing grub but expecting the bootloader to remain functioning is more a theoretical issue. I can't think of any reason why anyone would do that. Besides you get a warning that grub.cfg is saved as a pacsave file. Any sane user doing such a thing would understand that grub doesn't function after that.

-The pacsave file is there from your last use of grub, it is your own configuration. Pacman gives you a warning that it is copied back.

Loading...