Less output for kernel-install-for-dracut

One thing that I like about pacman is that it doesn’t output a ton of text (unlike apt, for example). But whenever a kernel is updated, kernel-install-for-dracut spills out a lot of text. mkinitcpio didn’t output this much info.

Is there any way to reduce this output and make it less verbose?

Note: There’s a better way of doing this described here, that was introduced later. So, use that rather than the accepted answer.

Closing your eyes does wonders :laughing:

6 Likes

you can add omit_dracutmodules+=" EXAMPLE " in a conf file in /etc/dracut.conf.d/ to leave out modules that you don’t need.
Personally, I added all modules that were reported as missing to get rid of all the “not found” messages.

But: This requires you to remember that you actively removed modules in case you change something on your system that would require the module to be included.

I have not found any other way to get dracut less verbose, although on CentOS and Fedora it is very quiet …

I guess that’s fair.

1 Like

You can edit /etc/kernel/install.d/50-dracut.install and pass the -q option to dracut.

Then copy /usr/lib/kernel/install.d/50-dracut-fallback.install to /etc/kernel/install.d/. and make the same change.

4 Likes

Setting the quiet flag is probably a much cleaner way to do this that doesn’t require modifying module inclusion list.

@BS86 I don’t want to actually omit modules. I just wanted it to be less verbose.

You can edit /etc/kernel/install.d/50-dracut.install and pass the -q option to dracut.

Then copy /usr/lib/kernel/install.d/50-dracut-fallback.install to /etc/kernel/install.d/. and make the same change.

@dalto I’ll try that. Thanks.

1 Like

It seems to work. However, I’m getting these grep: warning: stray \ before / warnings. Any idea what’s wrong there? I guess it was there before as well, just hidden in the deluge of information.

I am not getting that here. Can I see the full output from pacman?

I was just testing it using reinstall-kernels. The output is as follows:

Installing kernel 6.1.6-arch1-1
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
dracut: dracut module 'cifs' depends on 'network', which can't be installed
dracut: dracut module 'nbd' depends on 'network', which can't be installed
dracut: dracut module 'nfs' depends on 'network', which can't be installed
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
Installing kernel 5.15.88-1-lts
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
dracut: dracut module 'cifs' depends on 'network', which can't be installed
dracut: dracut module 'nbd' depends on 'network', which can't be installed
dracut: dracut module 'nfs' depends on 'network', which can't be installed
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /

Here is what I get:

Installing kernel 5.15.86-1-lts
dracut: dracut module 'cifs' depends on 'network', which can't be installed
dracut: dracut module 'nfs' depends on 'network', which can't be installed
Installing kernel 6.1.3-arch1-1
dracut: dracut module 'cifs' depends on 'network', which can't be installed
dracut: dracut module 'nfs' depends on 'network', which can't be installed

where does one configure that when using grub with dracut?
Everything I find when googling quiet dracut led me to results on problems with quiet boot flag being ignored, not quiet initramfs generation …

In the script dracut-install in /usr/share/libalpm/scripts. You will need to override the hook by copying it /etc and copy the script anywhere you want and point the hook copy to it.

1 Like

Do you, by chance, have GNU grep <3.8 or some other distribution of grep? I found some mailing list discussions about this.

The thing is, I tried to find any instances of grep in reinstall-kernels, kernel-install, dracut etc. and the only notable instance was in /usr/bin/dracut:

grep -H -e '^[^#]*[+]=\("[^ ]\|.*[^ ]"\)' "$@";

but it doesn’t look like there’s any error there. There are a few more occurences but they don’t have any \.

I am just using normal grep from the repos.

This is the only relevant instance of grep I can find:

90-loaderentry-fallback.install:    BOOT_OPTIONS="$(tr -s "$IFS" '\n' </proc/cmdline | grep -ve '^BOOT_IMAGE=' -e '^initrd=' | tr '\n' ' ')"
90-loaderentry-fallback.install:    if ! echo "$TRIES" | grep -q '^[0-9][0-9]*$'; then
90-loaderentry.install:    BOOT_OPTIONS="$(tr -s "$IFS" '\n' </proc/cmdline | grep -ve '^BOOT_IMAGE=' -e '^initrd=' | tr '\n' ' ')"
90-loaderentry.install:    if ! echo "$TRIES" | grep -q '^[0-9][0-9]*$'; then

None of those seem to have any stray backslashes.

Could be a difference with the used shell?
bash, zsh, or something else?

My default shell is bash. So I don’t think that should be an issue.

I don’t think so. The scripts should all be using bash no matter what the users shell is.

Omitting the -q option for now, I notice that the warning occurs (probably) while installing the module kernel-modules-extra.

...
dracut: *** Including module: systemd ***
dracut: *** Including module: systemd-initrd ***
dracut: *** Including module: i18n ***
dracut: *** Including module: btrfs ***
dracut: *** Including module: kernel-modules ***
dracut: *** Including module: kernel-modules-extra ***
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
dracut: *** Including module: resume ***
dracut: *** Including module: rootfs-block ***
dracut: *** Including module: terminfo ***
dracut: *** Including module: udev-rules ***
dracut: Skipping udev rule: 40-redhat.rules
...

but this is another dead end.
Edit: It actually appears once again at the extreme end.

...
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Creating image file '/efi/dd3288db44ed4f3c8eed9562f23181e1/5.15.88-1-lts/initrd' ***
dracut: *** Creating initramfs image file '/efi/dd3288db44ed4f3c8eed9562f23181e1/5.15.88-1-lts/initrd' done ***
dracut: dracut module 'cifs' depends on 'network', which can't be installed
dracut: dracut module 'nbd' depends on 'network', which can't be installed
dracut: dracut module 'nfs' depends on 'network', which can't be installed
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /

Someone more familiar with these scripts might be able to figure something out from this information.

Interesting, that module is being added for me and I don’t get those errors. Additionally, I added the module after the errors resume and it still doesn’t happen.

:thinking: