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 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>
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>
addappend is similar to append, but does not overwrite exsiting boot
arguments (defined per board).
This is needed to support a single disk image for SiFive Unleashed and
QEMU virt machine.
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.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>
Currently it's the only way we can boot on RISC-V with U-Boot and
allow people to update kernels without manually replacing firmware.
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.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>
- 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>
- installkernel-bls: remove unnecessary check for GRUB_ENABLE_BLSCFG=true
Resolves: rhbz#1647721
- grubby-bls: use title field instead of version for zipl default entry
Related: rhbz#1645200
- grubby-bls: print the absolute kernel and initramfs images paths
Resolves: rhbz#1649778
- grubby-bls: make info print the root parameter if is present in cmdline
Resolves: rhbz#1649791
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
By default the old grubby tool isn't installed anymore and it's part of
the grubby-deprecated package. Instead the grubby wrapper that modifies
BLS config files is installed for backward compatiblity with old grubby.
So on postinstall the bootloader configuration has to be changed to BLS
since non-BLS bootloader configuration won't be updated anymore without
the old grubby tool and the new-kernel-pkg script.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Now that Anaconda defaults to a BootLoaderSpec setup on installation, the
the grubby package should also install the grubby BLS wrapper by default.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
The grub2 bootloader expects the BLS linux and initrd fields values to be
set to a relative path to the root of the boot partition and the zipl tool
expects these to be an absolute path to the kernel and initramfs images.
So the grubby wrapper was removing the prefixes from the kernel and initrd
paths before doing any comparision with the BLS fields. But this shouldn't
be done if the /boot directory isn't a mount point.
Resolves: rhbz#1642078
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
- Make the temporary config wrapper be what "grubby" contains, and put
traditional grubby in grubby-deprecated (pjones)
- Re-enable debuginfo generation (pjones)
Related: rhbz#1619344
- Install installkernel-bls here as well, not just in the grub2 package,
since s390x doesn't have grubby packages (pjones)
Related: rhbz#1619344
- Make grubby-bls execute grub2-mkconfig on ppc64
Resolves: rhbz#1636039
- grubby-bls should only check if kernel exists and not if was installed
Resolves: rhbz#1634740
- Use ! instead of , as sed delimiter in grubby-bls script
Resolves: rhbz#1634744
- Print information about the entry set as default
Resolves: rhbz#1636180
- grubby-bls: make "id" be the filename, and include it in --info=ALL (pjones)
Related: rhbz#1638103
- grubby-bls: Make grubby-bls sort everything the same way grub2 does (pjones)
Resolves: rhbz#1638103
- grubby-bls: Consistently use the filename as the bls id
Related: rhbz#1638103
- grubby-bls: check if entry exists before attempting to print its info
Resolves: rhbz#1634712
- grubby-bls: make a copy of the cmdline if is modified for an entry
Resolves: rhbz#1629054
- grubby-bls: escape delimiter character before replacing the options field
Resolves: rhbz#1640017
- grubby-bls: grubby-bls: use id instead of title to get the default entry
Resolves: rhbz#1638103
- grubby-bls: use ~debug instead of -debug as suffix to sort correctly
Related: rhbz#1638103
- grubby-bls: allow to add many BLS entries for the same kernel image
Resolves: rhbz#1634752
- grubby-bls: fix --default-* options for s390x
Resolves: rhbz#1644608
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
So what's happened here is this:
- we planned on not having the grubby binary in this package at all
anymore
- when we did test builds like that, find-debuginfo.sh broke
- since it was completely inconsequential, we disabled building
debuginfo
- then we re-thought the package layout, and decided to build that
binary anyway, but forgot to turn debuginfo back on
- also we build the binary as -fPIE, which file(1) says is a "shared
object"
- brp-strip does not act on shared objects, so it didn't strip
As a result, rpmdiff noticed our binary was not stripped.
This patch re-enables debuginfo, which will cause our binary to get
stripped, as well as to have the correct debuginfo packages in the
output.
Related: rhbz#1619344
Signed-off-by: Peter Jones <pjones@redhat.com>
We need to cary this in f29 until we have the anaconda patches in and
get grubby out of the default install, so we'll have BLS configs and not
need grubby to update them.
Signed-off-by: Peter Jones <pjones@redhat.com>