Hi Tao,
On Wed, 10 Aug 2022 10:01:18 +0800
Tao Liu <ltao(a)redhat.com> wrote:
Hi Philipp,
On Tue, Aug 9, 2022 at 11:59 PM Philipp Rudo <prudo(a)redhat.com> wrote:
>
> Hi Tao,
>
> On Tue, 9 Aug 2022 15:00:39 +0800
> Tao Liu <ltao(a)redhat.com> wrote:
>
> > Previously kexec-tools will pass "--compress zstd" to dracut. It
> > will make dracut to decide whether: a) call mksquashfs to make a
> > zstd format squash-root.img, b) call cmd zstd to make a initramfs.
> >
> > Currently dracut has decoupled the compressor for dracut and
> > dracut-squash, So in this patch, we will pass the compressor seperately.
>
> Which dracut version do you mean with "currently"? Is it <= 050, the
> minimal dracut version required by the spec file?
The minimal required version is dracut >= 057, because the decouple patch was
merged in version 057:
[liutgnu@localhost up-dracut]$ git log --oneline
....
e2aee2d4 feat(squash): add shell completion for --squash-compressor option
3693bfef feat(squash): update the manual page for --squash-compressor
90d9ae8c feat(squash): decouple the compressor for dracut and dracut-squash
631d5f72 (tag: 056) docs: update NEWS.md and AUTHORS
I don't know if we should enlarge the required dracut version in
kexec-tools.spec
without side effects?
The thing is that mkdumprd will fail with
"getopt: unrecognized option '--squash-compressor'"
when run on a system with dracut <= 057. I tried it on my f36 vm with
drachut 056. So we either need to increase the minimal dracut version
or implement a mechanism that checks if dracut supports a certain
option so that we can fall back to a safe one if it doesn't. But
mkdumprd mustn't crash when run with a supported dracut version.
Btw, other than this one, the following patches I posted upstream
also requires
057 dracut:
virtiofs support for kexec-tools
Interestingly this one worked for me. At least the dump to virtiofs
part...
Add lvm2 thin provision support for kdump
Anyway, with three features all relying on dracut 057 I think it makes
sense to increase the minimal dracut version to 057. Even when it is
rather fresh and there isn't even a stable Fedora release containing it.
> Other than that the patch looks good to me.
>
> Site note: Does it make sense to extend is_squash_available to also
> check if the mksquashfs command is availabel? The way I see it you can
> have a kernel that is able to read the squashfs without having the
> squashfs-tools installed required to create it.
>
Hmm... I don't think it is necessary to check mksquashfs. The kexec-tools rpm
requires dracut-squash rpm, and dracut-squash requires squashfs-tools. So the
successful installation of kexec-tools can ensure squashfs-tools is installed.
You are right. This is already handled by the squashfs-tools.
Thanks
Philipp
Thanks,
Tao Liu
> Thanks
> Philipp
>
> >
> > Signed-off-by: Tao Liu <ltao(a)redhat.com>
> > ---
> > kdump-lib.sh | 2 +-
> > mkdumprd | 7 +++----
> > mkfadumprd | 4 +++-
> > 3 files changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/kdump-lib.sh b/kdump-lib.sh
> > index f32b802..c59a25f 100755
> > --- a/kdump-lib.sh
> > +++ b/kdump-lib.sh
> > @@ -462,7 +462,7 @@ is_wdt_active()
> > have_compression_in_dracut_args()
> > {
> > [[ "$(kdump_get_conf_val dracut_args)" =~ \
> > -
(^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$) ]]
> > +
(^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress|squash-compressor)([[:space:]]|$)
]]
> > }
> >
> > # If "dracut_args" contains "--mount" information, use it
> > diff --git a/mkdumprd b/mkdumprd
> > index 3e250e0..01eabcb 100644
> > --- a/mkdumprd
> > +++ b/mkdumprd
> > @@ -432,10 +432,9 @@ done <<< "$(kdump_read_conf)"
> > handle_default_dump_target
> >
> > if ! have_compression_in_dracut_args; then
> > - # Here zstd is set as the default compression method. If squash module
> > - # is available for dracut, libzstd will be used by mksquashfs. If
> > - # squash module is unavailable, command zstd will be used instead.
> > - if is_squash_available || is_zstd_command_available; then
> > + if is_squash_available; then
> > + add_dracut_arg "--squash-compressor" "zstd"
> > + elif is_zstd_command_available; then
> > add_dracut_arg "--compress" "zstd"
> > fi
> > fi
> > diff --git a/mkfadumprd b/mkfadumprd
> > index 86dfcee..cd76fc8 100644
> > --- a/mkfadumprd
> > +++ b/mkfadumprd
> > @@ -64,7 +64,9 @@ fi
> >
> > # Same as setting zstd in mkdumprd
> > if ! have_compression_in_dracut_args; then
> > - if is_squash_available || is_zstd_command_available; then
> > + if is_squash_available; then
> > + _dracut_isolate_args+=(--squash-compressor zstd)
> > + elif is_zstd_command_available; then
> > _dracut_isolate_args+=(--compress zstd)
> > fi
> > fi
>