User_comands.bash and changing default options

Hello, I’m trying to setup my user_commands.bash to make changes to the installation defaults. So far I’ve at least managed to get most things I wanted working, except for a specific few other things that are not.

Working is: Default btrfs Subvolume setup, installation of chaotic-aur and personal in-house aurto repositories.

Not working: Changing default filesystem to btrfs from ext4. Changing default boot loader from systemd-boot to grub, as a default, if possible.

I’m using my user_commands.bash script here, currently in my testing. It modified partition.conf, changing defaults, but they are not reflected in the installation, default filesystem for Erase disk is still ext4.

#!/bin/bash

if [[ "$1" == "--iso-config" ]]; then
    installMode="$2"
    sed -i \
    	-e 's/defaultFileSystemType:.*/defaultFileSystemType: "btrfs"/g' \
    	-e 's/filesystem: "unknown"/filesystem: "btrfs"/g' \
    	/etc/calamares/modules/partition.conf
   	#sed -i -e 's/filesystem: "unknown"/filesystem: "btrfs"/g'
    sed -i -e '/^btrfsSubvolumes:$/,/^$/ { r /dev/stdin' -e';d};' /etc/calamares/modules/mount.conf <<EOF
btrfsSubvolumes:
    - mountPoint: /
      subvolume: /@
    - mountPoint: /home
      subvolume: /@home
    - mountPoint: /var/cache
      subvolume: /@cache
    - mountPoint: /var/log
      subvolume: /@log
    - mountPoint: /srv
      subvolume: /@srv
    - mountPoint: /opt
      subvolume: /@opt
    - mountPoint: /usr/local
      subvolume: /@usrlocal
    - mountPoint: /var/lib/crash
      subvolume: /@crash
    - mountPoint: /var/lib/containers
      subvolume: /@containers
    - mountPoint: /var/lib/libvirt/images
      subvolume: /@libvirt
    - mountPoint: /var/lib/machines
      subvolume: /@machines
    - mountPoint: /var/lib/portables
      subvolume: /@portables
    - mountPoint: /var/spool
      subvolume: /@spool
    - mountPoint: /var/tmp
      subvolume: /@tmp
    - mountPoint: /var/www
      subvolume: /@www
    - mountPoint: /root
      subvolume: /@root
    - mountPoint: /.snapshots
      subvolume: /@snapshots

EOF
    sed -i -e '/^.*- filesystem: btrfs$/,/\]$/ { r /dev/stdin' -e';d};' /etc/calamares/modules/mount.conf <<EOF
    - filesystem: btrfs
      options: [ noatime, space_cache=v2, compress=zstd:1, ssd, discard=async ]
EOF
else
    username="$1"

    pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
    pacman-key --lsign-key 3056513887B78AEB
    pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
    echo -e "\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf
    echo -e "\n[aurto]\nSigLevel = Never\nServer = http://abs.home.ld/" >> /etc/pacman.conf
    pacman -Sy

    pacman -S --noconfirm --needed libreoffice-fresh
fi

You don’t need this change. You can leave it unknown for your use case.

You need to edit the QML file in packagechooserq module. That is where that is set.

1 Like

Here’s the code I’ve used for changing default from ext4 to btrfs:

if [ "$1" == "--iso-config" ]; then
  sed -i /etc/calamares/modules/partition.conf -E \
    -e 's|^defaultFileSystemType:.*|defaultFileSystemType: "btrfs"|' \
    -e 's|^(availableFileSystemTypes:.*)"ext4","btrfs"|\1"btrfs","ext4"|'

Hope it helps.

1 Like

Ahhhh… So you’re changing not just the default, which by itself that change does nothing, when availableFilesystemTypes, you’re changing order, specifically.
I’ll try this.

1 Like

Hmm, that shows systemd-boot with the one option. I don’t see self-documenting stuff in there to help pinpoint what I should do. Can this be simply changed to grub2, or something?

I’d guess (but havent tried it) that it could be set to grub.

Look at lines 68 and 127. Basically, change what is “checked” by default.

Seems no, on that one. :slight_smile:

Of what file? packagechooserq.conf doesn’t even have 127 lines. :rofl:

It isn’t the conf file you need to change, it is the qml file.

For a uefi system, it is UEFI.qml

Okay, I’m not seeing anything in /etc/calamares/ except these for qml files:
./branding/endeavouros/show.qml
./qml/calamares/slideshow/BackButton.qml
./qml/calamares/slideshow/ForwardButton.qml
./qml/calamares/slideshow/NavButton.qml
./qml/calamares/slideshow/Presentation.qml
./qml/calamares/slideshow/Slide.qml
./qml/calamares/slideshow/SlideCounter.qml

It isn’t configuration. It is in /usr/lib/calamares/modules/packagechooserq/UEFI.qml

Hmm… Still… Not seeing it though…

ls -l /usr/lib/calamares/modules/packagechooserq/
total 2133
-rwxr-xr-x 1 root root 2183144 Aug 3 16:49 libcalamares_viewmodule_packagechooserq.so
-rw-r–r-- 1 root root 172 Aug 3 16:49 module.desc

And no qml files in /usr/lib/calamares/ either.

I don’t have access to the ISO right now but you could search the whole thing with find. Look for UEFI.qml

I tried that too, but…

$ sudo find / -name 'UEFI.qml'
find: ‘/run/user/1000/gvfs’: Permission denied

That’s all I found. :slight_smile:

Oh, the qml gets built into the binary. I guess you can’t change that without rebuilding calamares.

Okay. If that’s the case, that’s fine. I managed to test the btrfs default issue, and that now works out. I wonder if I could also pre-select installation options like Xfce, and printer support, zen kernel, etc. That’s literally the last detail that would be nice, though I could live without if it’s not possible.
Already, the main thing is, I got my subvolumes the way I wanted, at level 5 volumes.

These are groups in netinstall.yaml and you can change selected to true for those groups. For individual packages, there is less flexibility.

Add this to packagechooser.conf:

default: XFCE4-Desktop

Hmmm… netinstall.yaml seems a little more difficult to massage correctly, especially to specifically change selected: false to true, under name: Printing-Support. Without a yaml tool directly anyway. And one is not available in the installer.

If it’s simply adding a line at the end of packagechooser.conf, that’s easy enough, and I will try it now!

Thank you very much for your time on this, dalto! I think we’re golden and got a lot of useful things to look into.

1 Like

hmm when i tried in VM i was setting available filesystems to only have BTRFS and default also to BTRFS it was simply not showing any options on install process and uses BTRFS automatically… without editing qml code… i can retest… later now baking some peanut cookies…