Commit Graph

10 Commits

Author SHA1 Message Date
462eef9828 initramfs: Refactor alpm hooks to prevent harmless errors on kernel installation
Based on the way kdumpst alpm hooks were coded, we have currently one hook
per initrd system supported (mkinitcpio, mkinitcpio-git, dracut). When a
kernel package is installed/upgraded/removed, all of them are triggered;
but usually users only have one initrd system (enough headaches with just
one, imagine having more heh).

The net effect of this, due to the "verbiage" of alpm, is that harmless
error messages were shown, like the following one:

"error: unable to run hook 99-kdump-dracut.hook: could not satisfy
dependencies"

This one was quite common since the vast majority of Arch users rely
on mkinitcpio. And this message would show at *every* kernel package
operation, leading users to wonder what's wrong (may they pay attention
to error messages, of course).

In order to fix that, we hereby follow a great and simple suggestion from
Antiz at #archlinux-projects/Libera (thanks!): let's use a shell call to
encompass the tests for different initrd systems. With that, was easy also
to remove the redundant mkinitcpio-git hook. No functional change should
be expected from this change.

Closes: #14 ("Minimal initramfs pacman hooks should not present error messages on different init systems")
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2024-01-05 17:08:16 -03:00
4b5746a60e all: Rename the tool to kdumpst
Big but self-explanatory commit: rename the tool. The name choice was
kdumpst, since it's a tool to enable both kdump and pstore setting, also
it's a silly wordplay with the superlative of kdump, as in "kdumpest".

It's an invasive change (touches most of the files), but should
offer no functional change other than logging messages showing
kdumpst now, instead of kdump, and some filenames.

Notice it doesn't touch documentation, which will be done in
a subsequent commit.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
b834754cf9 initramfs: Switch to the alpm-hooks approach, supporting both initcpio/dracut
This is one of the major changes/refactors so far, touches a lot of
files, and more important, it completely changes some premises.
With this patch, we now support fully both dracut-based and initcpio
initramfs systems.

For that to happen, we needed to decouple the initramfs creation from
scripts, by using alpm-hooks. These hooks allow scripts to be run on
events like kernel package installation or in the installation of the very
package responsible to create the initramfs image. We still have the
"kdump-load create-initrd" command though.

One of the biggest modifications here was in the Makefile, that now
composes multiple files by changing keywords (like INITRD) to the
respective initramfs system (dracut or mkinitcpio). Notice that this
brought some extra complexity to the package.

The logic used for supporting both initramfs systems was basically
de-duplicate all possible code (having dup code in common files),
using Makefile tricks to merge such files and have the unique
bits in dracut/initcpio specific files. We currently support dracut
and both mkinitcpio and mkinitcpio-git packages.

Caveats: currently the initramfs specific package removal is not handled
here. So, if the user has dracut and installs kdump, we install the
dracut hooks. In case this user decides to remove dracut and installs
mkinitcpio, we install the mkinitcpio hooks and all should work, but
the previous dracut hooks installed are not unistalled by us; likely
the dracut package removal would drop the files itself.

This was a deliberate move to avoid even more alpm-hooks, should be
a rare case and as said, the package removal should clear the files
itself, without requiring our interaction. Also, by using the
alpm-hooks, we see "errors" (warnings really) about the other
initramfs package not being present - not sure if it's possible to
disable this behavior.

Finally, while at it:

* Added a new approach to dracut initramfs creation to pick the most
common block drivers - since it's hostonly, it doesn't add the ones
that aren't loaded, hence image is not bloated by that.

* Chenged the "command -v makedumpfile" validation to something
more elegant - thanks for the suggestion Clayton (@craftyguy).

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
a6e1fdf249 all: Move the multi-configuration file reading routine to a common helper
Based on Emil's (xexaxo) feedback, we now have a common.sh file
that contains the implementation of the routine to read all config
files for kdump/pstore, and we use Makefile to join the files,
having the same implemention in all users.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
184217373b all: Allow multiple config files
This is somewhat an intrusive change, but necessary if we want
to upstream the kdump tooling while allowing great extent of
customizations on SteamOS.

With this change, we have now a kdump.d folder on /usr/share,
that holds configuration files in the same way sysctl.d does.
In other words, we can easily override default settings by
just having more configuration files, which are sourced
following natural name sorting, i.e., we have now the concept
of config file precedence in kdump.

Our default config file is called 00-default, so we eventually
might have a 01-steamos e.g., with Deck's custom settings.
This is planned to other package though.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
aa4709583e all: Rename various files
Drop "steamos" references as well as "submit/submitter" wording
given that we are decoupling the submission mechanism of the
logs' collection.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
11e799c1bb kdump/systemd: Drop the systemd loader appoach
Currently we have a loader script, that just calls the dump saving
script and exits successfully. This was meant to prevent potential
boot stalls due to systemd delays, but it proved to be just
unnecessary...so, let's drop it here.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
5c1cc98502 kdump-steamos: Move configuration file out of /etc
This patch main goal is to "un-Debianize" the configuration file
for kdump-steamos - thanks Emil (@xexaxo) for the discussions; it
is with a bit of a heavy heart I do that, but let's comply with the
modern distros ;-)

We hereby put the config file in a more standard path: /usr/share.
Usually users could override that with /etc/ file, but not in this
case, or at least, not for now. Kdump/pstore is expected to work
quietly, with no users' interference. Advanced users might want to
play with the configs though; and those can just go ahead and edit
the /usr/share/kdump/kdump.conf - it's all documented in the README.

In the future we can improve that by having the override mechanism
with the /etc file, let's see if we have a demand for that.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
4d3a810bab kdump-steamos: swap underscore for hyphen in filenames
Currently half of the files are hyphenated, while the rest use
underscore. Just move everything to hyphens.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2023-03-31 15:34:42 -03:00
f2df3c6365 kdump-steamos: add makefile with install target
People should not need to know the nitty gritty details - make install
should just work (tm).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2023-03-31 15:34:42 -03:00