Want to try and help test dracut? Now is the time!

I think it'd be much better to have a config file or something that sticks around between upgrades.

2 Likes

Just to add on to what @TNE is pointing out, the scripts are provided by the distro so they can be modified directly. Why not change the scripts so they look at a config value and decide to skip or not skip fallback creation. Then you won't have to worry about all that other stuff.

1 Like

Right, so if those scripts are updated for whatever reason, the users would benefit from the updated scripts AND still have that config variable to look for... best of both worlds.

Hum, what Whoogle search criteria should I be using to see an example and learn on how that kind of stuff can be done?

main-update · master · Garuda Linux / Packages / Stable PKGBUILDs / Garuda Update · GitLab this could be interesting to you
Although just be aware that any code can be put into those config files, it's not exactly secure, but since you need root to write to that file, it's fine.

1 Like

You made me use my brain a bit here, man :slight_smile: , but it seems to run fine. The code, not my brain. I mean my brain runs fine too! I guess... lolll

Ok so I only tested the INSTALL so far, not the REMOVE yet.

Not sure I have the best practices here, see what I've done now:

Created folder /etc/garuda/dracut
Stored 2 executable files, install-no-fallback and remove-no-fallback

Contents of

install-no-fallback

#!/bin/bash -e

echo ":: ==> User has opt out of building a fallback initramfs for ${pkgbase} (${kver})"
if [ -f /boot/initramfs-${pkgbase}-fallback.img ]; then
rm -f "/boot/initramfs-${pkgbase}-fallback.img"
fi

remove-no-fallback

#!/bin/bash -e

rm -f "/boot/vmlinuz-${pkgbase}" "/boot/initramfs-${pkgbase}.img"

Modified the following in /usr/share/libalpm/scripts/dracut-install

*[NOT PASTING WHAT IS BEFORE THIS POINT]*
for line in "${lines[@]}"; do
	if ! pacman -Qqo "${line}/pkgbase" &> /dev/null; then
		# if pkgbase does not belong to any package then skip this kernel
		continue
	fi

	pkgbase="$(<"${line}/pkgbase")"
	kver="${line##*/}"

	echo ":: Building initramfs for ${pkgbase} (${kver})"
	dracut --force "/boot/initramfs-${pkgbase}.img" "${kver}"

# Start of insert by FGD
if [ -f /etc/garuda/dracut/install-no-fallback ]; then
    source /etc/garuda/dracut/install-no-fallback; else
	echo ":: Building fallback initramfs for ${pkgbase} (${kver})"
	dracut --force --no-hostonly -o "network" "/boot/initramfs-${pkgbase}-fallback.img" "${kver}"
fi
# End of insert by FGD

done

Modified the following in /usr/share/libalpm/scripts/dracut-remove (this is the whole file):

#!/bin/bash -e

while read -r line; do
	if [[ "${line}" == */pkgbase ]]; then
		read -r pkgbase < "/${line}"
# Start of insert by FGD
		if [ -f /etc/garuda/dracut/remove-no-fallback ]; then
    	source /etc/garuda/dracut/remove-no-fallback; else
    	rm -f "/boot/vmlinuz-${pkgbase}" "/boot/initramfs-${pkgbase}.img" "/boot/initramfs-${pkgbase}-fallback.img"
		fi
# End of insert by FGD
	fi
done

Looking at this I understand why you say it's safer and cleaner. I would add to that: less overall code and less files!

Is that the kind of stuff you guys were talking about?

EDIT: I have perfected the code by including the removal of the fallback image, if found, on every image generation. This ensures no fallback image remains on the system.

Tested with and without config files, generates the fallback when expected, does not generate it (and deletes it) when expected.

What is this package garuda-bootctl-dracut? :face_with_monocle:

Is there systemd-boot support in the works?! :star_struck: Last time I investigated removing Grub, it didn't look pretty--it is set as a dependency for a ton of packages.

sudo pacman -Rnsc grub
checking dependencies...
:: btrfs-assistant optionally requires snapper
:: btrfs-assistant optionally requires btrfsmaintenance
:: firedragon optionally requires profile-sync-daemon: Load the browser profile into RAM
:: garuda-welcome optionally requires garuda-boot-options
:: reflector optionally requires rsync: rate rsync mirrors

Packages (22) btrfsmaintenance-0.5-2  garuda-bash-config-1.0.3-1  garuda-boot-options-1.0.3-1
              garuda-common-settings-2.6.12-1  garuda-hooks-2.9.4-1  garuda-migrations-2.1.2-1
              garuda-wallpapers-r75.f168bbe-1  grub-btrfs-4.12-2  grub-garuda-2.06-1  grub-theme-garuda-r18.75c8339-1
              kernel-modules-hook-0.1.7-2  noto-color-emoji-fontconfig-1.0.0-1  profile-sync-daemon-1:6.48-1
              rsync-3.2.7-3  snap-pac-3.0.1-2  snapper-0.10.4-1  snapper-support-1.1.2-2  systemd-oomd-defaults-251.5-1.1
              update-grub-0.0.1-7.1  xxhash-0.8.1-3  zram-generator-1.1.2-1  grub-2:2.06.r403.g7259d55ff-1

Total Removed Size:  91.24 MiB

Yikes! :flushed:

I see there are also a couple dracut-hook packages in the Chaotic repo, but they aren't pulled in when switching to Dracut with garuda-dracut-support. Does garuda-dracut-support include its own version of this package?

1 Like

No. The bootctl package is made by librewish and should be considered defunct.

3 Likes

Ok so after some thinking following Post #65, I will leave this aside for the moment, cuz I think there’s already many changes and rewritten stuff in the upcoming ISO, I don’t see the need to add this option in the next release.

I will keep the following in mind for future discussions (and possibly code learning for me):

  • The above opt out suggestion could be implemented through a checkbox in tab Kernels of Setup Assistant post-installation (upon 1st boot and whenever Setup Assistant is launched). This should take care of users installing a fresh system from the ISO.

An ugly, quick and unfinished example:

  • The same option could probably be present in tab Settings of Garuda Assistant. This should take care of already installed systems, although the users would not know the option is there until they see it (or read the Release Notes :slight_smile: ). I think that’s fair enough.

I’m keeping this on the back burner. In the meantime I continue testing dracut and of course it still works perfect! :smiley:

I would recommend adding a script to make it easy to rebuild the initrds in garuda-dracut-support. Basically, add an alternative to mkinitcpio -P. There is a very simple one in the eos-dracut package if you want to use it.

This script seems.. needlessly overcomplicated and duplicates code :sweat_smile:

It looks kind of like the script in /usr/share/libalpm/scripts/dracut-install.

I think this is a good idea, in case folks add or remove a non-DKMS package that affects the image dracut will produce. Maybe just a simple alias that re-runs the script in /usr/share/libalpm/scripts/dracut-install to build a new image would be enough?

1 Like

I’m not sure if you guys saw this or not, but on EOS @dalto set up a config file with options to disable fallback image generation, and also to enable a “quiet” mode where the verbosity of dracut image generation is dialed way back. :eyes:

@FGD I know you were interested in both of these features; when I saw this I thought of you! :slightly_smiling_face:

File: /etc/eos-dracut.conf
# This config file controls the automation provided by eos-dracut

# When DRACUT_QUIET is set to true, dracut will operate with quiet flag set suppressing most output
DRACUT_QUIET="true"

# When NO_FALLBACK is set to true, no fallback initrd will be generated
#NO_DRACUT_FALLBACK="false"
2 Likes

That’s so nice my friend! :smiley: Yes I will look at this.
Tnx!

If we haven't rolled out dracut yet, it honestly might be better simply to have dracut be quiet by default. I am not sure there is much value in all those messages. It just confuses people who think they are errors.

4 Likes

Yes, I agree--the output is a bit much, and for someone seeing it for the first time it is not obvious that everything is okay. It's a lot of warnings!

Really, seeing all of the dracut output only seems like it would be useful if you were trying to debug a specific issue, or make sure something unusual you were trying to set up is working.

2 Likes

I added a KISS rebuild script and set the loglevel to 3 in version 1.0.0. I think that version number is fair at this point :stuck_out_tongue:

6 Likes

so after using it for 3 months now I can report zero problems with it whatsoever.

4 Likes

Same here! Isn't this awesome or what? :smiley:

3 Likes

A post was split to a new topic: Cannot boot ISOs using Super Grub 2