Clarify package description
Resolves: rhbz#1913299
Update man page to not mention the GRUB config in the ESP anymore
Resolves: rhbz#1958458
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
After https://fedoraproject.org/wiki/Changes/UnifyGrubConfig the config in
ESP is only used as a stub to load the actual GRUB config the in /boot dir.
Don't mention this file in the grubby man page, since users shouldn't even
be aware of that config file.
Resolves: rhbz#1958458
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The grubby script was meant to be a temporary solution to provide backward
compatibility with existing grubby users. But it turned out that grubby is
the recommended approach to modify the boot loader entries.
Let's make clear in the package description that this is not only meant to
be used for legacy compatibility purposes, which may discourage its usage.
Resolves: rhbz#1913299
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The BLS snippets have the options field set to a kernelopts variable by
default, which is set in GRUB's environemnt block to the kernel cmdline.
When the kernel command line parameters are modified for all the entries,
the value of this kernelopts variable is modified. But if the cmdline is
modified for a single entry, then the kernelopts variable is expanded and
the resulted modified value stored in the BLS snippet.
The grubby tool expanded all the variables in the options field, but it's
possible that some of these variables are managed by another tool. For
example the tuned program adds a tuned variable that shouldn't be changed
by the grubby tool. Otherwise it will mangle the tuned configuration set.
To prevent this, let's make grubby to only expand the kernelopts variable.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Currently the grubby script re-generates a GRUB config file that contains
menuentry commands for every /boot/loader/entries/*.conf file snippet.
But this is only needed for ppc64le machines that have a Petitboot version
that doesn't support parsing BLS snippets. Instead of generating a config
on any ppc64le machine, restrict this for the case where is really needed.
The /etc/grub.d/10_linux script already takes this into account and does
not add menuentry commands unless is needed. But the grubby script didn't
check this, causing changing kernel cmdline params to not work on ppc64le.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
zipl appears to be the only thing grubby needs, and that is provided by s390utils-core. Change the Requires to that, which allows for a more minimal installation.
zipl appears to be the only thing grubby needs, and that is provided by s390utils-core. Change the Requires to that, which allows for a more minimal installation.
If the options field in a BLS file has the same value than the kernelopts
variable in grubenv, the options is replaced with the kernelopts variable.
This was done to keep the options in the BLS files in sync when possible,
but having the kernel cmdline as a variable in the grubenv file was proven
to be fragile. Instead, the kernel cmdline will be stored in the BLS files
to make the configuration more robust. This will work even if the grubenv
gets corrupted or is deleted.
Since we want to get rid of the kernelopts variable, don't attempt to use
that in the BLS snippets anymore.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The option makes grubby to not update the GRUB_CMDLINE_LINUX variable in
the /etc/default/grub file when the --update-kernel=ALL option is used.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The forward slash character is used as the delimiter for sed substitutions
so this is escaped before calling sed.
But this was only done before removing parameters from the kernel command
and not when adding it. Use it for all the cases when the parameters are
replaced in the update_args() function.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The man page of the old grubby tool is still shipped in the grubby package
but instead there should be a man page that only documents the options for
the wrapper grubby script that is used to manage the BLS config snippets.
Current man page is confusing for users so let's add one that contains the
options that are supported by the wrapper script but no unsupported ones.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
If a kernel command line parameter has a '=' character, grubby fails
to update the options field in the BLS snippet, for example:
$ grubby --update-kernel=foo --args="bar=https://test?token="
sed: -e expression #1, char 30: unknown option to `s'
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The grubby --update-kernel=ALL option is used to update the kernel command
line parameters for all the boot entries. But the updated cmdline is lost
if the grub2-mkconfig command is executed, since in that case the cmdline
is changed with the value set by GRUB_CMDLINE_LINUX in /etc/default/grub.
To prevent the cmdline set by users to be overridden by mistake, keep the
value of GRUB_CMDLINE_LINUX in sync with the current cmdline.
Related: rhbz#1287854
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Fix FTBFS
Resolves: rhbz#1799496
Fix wrong S-o-B tag in patch
Fix warning about using unversioned Obsoletes
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Since PowerNV machines can have a Petitboot versions that still don't have
BLS support, grubby re-generates the grub.cfg file on all ppc64le machines.
But this has the side effect that the grubenv file is updated, which will
overwrite any value that was set by grubby itself. To prevent that run the
grub2-mkconfig with the --no-grubenv-update option.
Related: rhbz#1726514
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
grubby-bls: don't print rpm-sort error messages
Resolves: rhbz#1731924
grubby-bls: remove -o option and support -c for ppc64le grub config
Resolves: rhbz#1758598
grubby-bls: fix logic to check if the kernelopts var is defined in a BLS
Resolves: rhbz#1726514
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The logic to check if a kernelopts variable is defined in a BLS entry was
wrong and caused grubby to expand the variables even when it was defined.
Resolves: rhbz#1726514
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
If there are no BLS snippets, an empty array of strings is passed to the
rpm-sort tool and it will print an error that just confuses grubby users.
Resolves: rhbz#1731924
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
If the /boot directory is a mount point, then the paths of the kernel and
initramfs images paths in the BLS snippet have to be relative to the root
of the boot partition. So the /boot prefix has to be stripped from paths
in this case.
But the function was wrongly stripping the entire path instead of only the
/boot prefix, which prevented having kernels and initrds in subdirectories.
Signed-off-by: Yuval Turgeman <yturgema@redhat.com>
The kernel hook scripts in /etc/kernel/postinst.d and /etc/kernel/prerm.d
were executed by the new-kernel-pkg --rpmposttrans and --remove options.
But with a BLS configuration the new-kernel-pkg script isn't executed and
instead the kernel-install plugins are used. Add a kernel-install plugin
that executes the hooks since packages like dkms and akmod make use of it.
Resolves: rhbz#1696202
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Using grep is wrong and fragile, so let's use the mountpoint command
instead to make it more robust.
Resolves: rhbz#1706091
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The script prints an error if --args option is used without --update-kernel
but it's also valid to use it with the --add-kernel option.
Resolves: rhbz#1691004
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
For platforms using GRUB, the switch to BLS should be done in the %post
scriptlet for the grub2-tools package. So only switch to BLS for s390x.
Related: rhbz#1652806
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Currently there's no way to update the kernelopts variable defined in the
grubenv by using the grubby wrapper. Updating it with grub2-editenv - set
is tedious and error prone so let's use --update-kernel=ALL option for it.
This command currently iterates over all the BLS entries and update them
individually, but makes more sense to update the kernelopts grubenv var
and only update the BLS entries that don't have the $kernelopts var in
their options field.
If after an update one of these BLS entries have exactly the same params
in their options field than the ones set in $kernelopts, set the options
field to $kernelopts again since the parameters have converged again.
That way the modified BLS entries will only have a custom options field
while its value diverged from the $kernelopts defined in grubenv.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The --args and --remove-args options can only be used when the kernel to
update is specified using the --update-kernel option. Print an error if
the latter option is not provided.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
- Fix GCC warnings about possible string truncations and buffer overflows
- grubby-bls: unset default entry if is the one being removed
- grubby-bls: show absolute path when printing error about incorrect param
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
If the default entry is removed, this can't be set as the default anymore
for zipl. Otherwise the zipl tool will fail since it won't exist an IPL
section for the one set as the default.
For grub2, if the saved_entry doesn't exist it will fallback to the first
entry. But still the correct thing to do is to unset the default there.
Resolves: rhbz#1668329
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
- Correctly set LDFLAGS to include hardened flags (pjones)
Related: rhbz#1654936
- grubby-bls: expand all variables in options field when updating it
Resolves: rhbz#1660700
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
There is a grub2-set-default script that can be used to set the default
entry. It can take an entry id, title or index as a parameter so grubby
should be able to also lookup a default entry using the title on grub2.
Related: rhbz#1654936
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
- grubby-bls: also print the absolute path in the --default-kernel option
Resolves: rhbz#1649778
- grubby-bls: allow to specify the same kernel param multiple times
Resolves: rhbz#1652486
- grubby-bls: expand kernel options if these are environment variables
Resolves: rhbz#1649785
- grubby-bls: always generate the BLS snippets when adding new entries
Resolves: rhbz#1653365
- Improve man page for --info option (jstodola)
Resolves: rhbz#1651672
- Make the old grubby take precedence over grubby-bls if is installed
Related: rhbz#165484
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Not all bootloaders used in Fedora have BLS support, for example extlinux
doesn't. So when using extlinux the old grubby tool has to be installed.
Currently the grubby-bls wrapper has precedence over the old grubby tool,
which means that even if grubby-deprecated is installed, the wrapper will
executed when calling grubby. Make the old grubby take precedence instead.
Related: rhbz#1654841
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>