Skip to content

Instantly share code, notes, and snippets.

@queeup
Last active November 5, 2024 17:34
Show Gist options
  • Save queeup/13c97bb059ca533ddca0ee12511c728f to your computer and use it in GitHub Desktop.
Save queeup/13c97bb059ca533ddca0ee12511c728f to your computer and use it in GitHub Desktop.
Fedora Silverblue Setup

My Fedora Silverblue 40 Setup

selinux, zstd, flatpak, layered, thinkfan, thinkpad t430, thinkpad t480, tailscale, vscode, nix, rpm-fusion, disable network connectivity check, battery charge threshold, firefox, gnome, nautilus, gnome-terminal, boxes, celluloid, declarative system changes

Change zstd compression version 1 to 3

With kickstarter while install

https://github.com/queeup/silverblue-kickstarter

After install

sed -i 's/compress=zstd:1/noatime,compress-force=zstd:3/' /etc/fstab

Set selinux to permissive mode

Remove

Flatpak

flatpak uninstall --all --delete-data --assumeyes  # prefered flathub remote
flatpak remote-modify --disable fedora
flatpak remote-delete --system flathub  # remove filtered flathub remote

Override layered packages

rpm-ostree override remove \
    gnome-tour \
    firefox  `# prefered flatpak version instead of this` \
    firefox-langpacks \
    fedora-workstation-repositories  `# nvidia, crome, steam, pycharm`                       

Install

Flatpak packages

flatpak remote-add --system --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-modify --enable flathub
flatpak install flathub \
    org.gnome.baobab \
    org.gnome.Boxes \
    org.gnome.Calculator \
    org.gnome.Calendar \
    org.gnome.clocks \
    org.gnome.Decibels \
    org.gnome.Evince \
    org.gnome.FileRoller \
    org.gnome.Geary \
    org.gnome.Logs \
    org.gnome.Loupe \
    org.gnome.NautilusPreviewer  `# previewer for nautilus: activate with <space>` \
    org.gnome.NetworkDisplays \
    org.gnome.Shotwell \
    org.gnome.TextEditor \
    org.gnome.Weather \
    org.bleachbit.BleachBit \
    org.freedesktop.Platform.ffmpeg-full  `# for firefox hardware decoding` \
    org.mozilla.firefox \
    org.telegram.desktop \
    com.bitwarden.desktop \
    com.discordapp.Discord \
    com.github.tchx84.Flatseal \
    com.github.jeromerobert.pdfarranger \
    com.github.qarmin.czkawka \
    com.github.qarmin.szyszka \
    com.logseq.Logseq \
    io.github.celluloid_player.Celluloid  `# celluloid player contains all codecs.` \
    io.gitlab.elescoute.password \
    io.github.shiftey.Desktop \
    im.riot.Riot \
    de.haeckerfelix.Fragments \
    app.fotema.Fotema

Layer new packages

rpm-ostree install printer-driver-brlaser  `# for brother printers`

rmpfusion

rpm-ostree install --apply-live \
    https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
    https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm \
    && rpm-ostree update \
        --uninstall rpmfusion-free-release-$(rpm -E %fedora)-1.noarch \
        --uninstall rpmfusion-nonfree-release-$(rpm -E %fedora)-1.noarch \
        --install rpmfusion-free-release \
        --install rpmfusion-nonfree-release

Intel Media Driver for VAAPI

rpm-ostree override remove mesa-va-drivers \
    --install intel-media-driver

rpm-ostree kargs --append=i915.enable_guc=2

Tailscale

  • Layered (preferred)

    https://github.com/castrojo/ublue/blob/main/bits/tailscale

    sudo curl -s https://pkgs.tailscale.com/stable/fedora/tailscale.repo -o /etc/yum.repos.d/tailscale.repo > /dev/null
    sudo sed -i 's/repo_gpgcheck=1/repo_gpgcheck=0/' /etc/yum.repos.d/tailscale.repo
    rpm-ostree install --apply-live tailscale
    sudo systemctl enable --now tailscaled
    sudo tailscale up
  • Container (ssh not working on container environment)

    https://hub.docker.com/r/tailscale/tailscale

    podman run --restart=always \
               --detach \
               --name=tailscaled \
               -v /var/lib:/var/lib \
               -v /dev/net/tun:/dev/net/tun \
               --network=host \
               --privileged \
               tailscale/tailscale tailscaled
    podman exec tailscaled tailscale up

Vscode

https://github.com/castrojo/ublue/blob/main/bits/vscode

cat <<EOF | sudo tee /etc/yum.repos.d/vscode.repo
[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
EOF
rpm-ostree install code
  • User settings

    {
    "window.titleBarStyle": "custom",
    "python.experiments.enabled": false,
    "python.formatting.provider": "black",
    "editor.formatOnSave": true,
    "telemetry.telemetryLevel": "off",
    "update.mode": "none",
    "terminal.integrated.shellIntegration.enabled": true,
    "terminal.integrated.shellIntegration.history": 100000,
    "editor.fontSize": 15,
    "window.zoomLevel": 0.25,
    "editor.renderWhitespace": "trailing"
    }

Nix packages

  • Install nix

    How to install nix package manager to silverblue

    curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
        sh -s -- install ostree --no-confirm --persistence=/var/lib/nix
  • Fix sudo

    echo "Defaults  secure_path = /nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:$(sudo printenv PATH)" | sudo tee /etc/sudoers.d/nix-sudo-env
  • Installed packages

    $ nix-env --query --installed --json | jq  '[.[]] | sort | [.[].pname] | join(" ")' --raw-output
    bat bottom broot du-dust dua duf eza fd grex jq nix procs restic ripgrep rmlint screen starship sysz tldr xh

Thinkfan

Please read the config manpage thinkfan.conf(5) before playing around with this.

This is NOT a working config file that can just be copied. It is only meant to give a rough idea what can be done. In particular, don't copy & paste the fan speed config! Think about what you're doing.

If you don't know what temperatures are right for your system, you should not be using thinkfan!

rpm-ostree install --apply-live thinkfan
rpm-ostree kargs --append=thinkpad_acpi.fan_control=1
systemctl enable thinkfan
  • vmatare/thinkfan#45 (comment)

    /etc/systemd/system/thinkfan.service.d/override.conf

    # https://github.com/vmatare/thinkfan/issues/36#issuecomment-567630136
    [Service]
    Restart=on-failure
    RestartSec=5s

Thinkpad T430

/etc/thinkfan.conf

# Help: /usr/share/doc/thinkfan/thinkfan.yaml
#       https://github.com/vmatare/thinkfan/issues/146#issuecomment-892987429
sensors:
- hwmon: /sys/class/hwmon
    name: thinkpad
    indices: [1]

#- tpacpi: /proc/acpi/ibm/thermal
    # Bug: https://github.com/vmatare/thinkfan/issues/139#issuecomment-874160793
    #indices: [1]

fans:
- tpacpi: /proc/acpi/ibm/fan

levels:
# Thinkpad T430
- [0, 0, 55]
- [1, 52, 60]
- [2, 58, 70]
- [3, 67, 75]
- [4, 73, 85]
- [5, 82, 90]
- ["level disengaged", 87, 255]

Thinkpad T480

/etc/hinkfan.conf

# Help: /usr/share/doc/thinkfan/thinkfan.yaml
#       https://github.com/vmatare/thinkfan/issues/146#issuecomment-892987429
sensors:
#- hwmon: /sys/class/hwmon
#  name: thinkpad
#  indices: [1]

- tpacpi: /proc/acpi/ibm/thermal
# Bug: https://github.com/vmatare/thinkfan/issues/139#issuecomment-874160793
#  indices: [1]

#https://github.com/vmatare/thinkfan/blob/c6e48a95b339cfef22439f9ce32c13bb324502b2/examples/thinkfan.yaml#L65
#https://github.com/vmatare/thinkfan/discussions/208#discussioncomment-4189705
#- hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon9
#  indices: [1]

fans:
- tpacpi: /proc/acpi/ibm/fan

levels:
# Thinkpad T480
- [0, 0, 58]
- [1, 56, 64]
- [2, 62, 74]
- [3, 72, 80]
- [4, 78, 86]
- [5, 84, 90]
- ["level disengaged", 87, 255]

rpm-ostree stage update

echo "AutomaticUpdatePolicy=stage" | sudo tee --append /etc/rpm-ostreed.conf

Disable network connectivity check

sudo tee /etc/NetworkManager/conf.d/20-connectivity-fedora.conf <<EOF
## Bug https://discussion.fedoraproject.org/t/hotspot-popup-window/82237
[connectivity]
enabled=false
EOF

Set battery charge threshold

Default values are

  • charge_control_start_threshold=0

  • charge_control_stop_threshold=100

Use one of method belove:

manual

echo 40 | sudo tee /sys/class/power_supply/BAT*/charge_control_start_threshold
echo 60 | sudo tee /sys/class/power_supply/BAT*/charge_control_end_threshold

# OR

sudo sh -c "echo 40 | tee /sys/class/power_supply/BAT*/charge_control_start_threshold"
sudo sh -c "echo 60 | tee /sys/class/power_supply/BAT*/charge_control_end_threshold"

udev

sudo tee /etc/udev/rules.d/99-queeup_battery-charge-threshold.rules <<EOF
# https://askubuntu.com/a/1211506
# https://wiki.archlinux.org/title/Laptop/ASUS#Battery_charge_threshold
# https://support.system76.com/articles/laptop-battery-thresholds/

KERNEL=="BAT*", SUBSYSTEM=="power_supply", ATTR{charge_control_start_threshold}="40"
KERNEL=="BAT*", SUBSYSTEM=="power_supply", ATTR{charge_control_end_threshold}="60"
EOF

sudo systemctl reload-or-restart systemd-udevd

systemd

https://wiki.archlinux.org/title/Laptop/ASUS#systemd_service

sudo tee /etc/systemd/system/battery-charge-threshold.service <<EOF
# https://wiki.archlinux.org/title/Laptop/ASUS#systemd_service
# https://support.system76.com/articles/laptop-battery-thresholds/
# Lenovo Thinkpad T480 have 2 battery. BAT0 & BAT1.
# So I use BAT* for Execstart command

[Unit]
Description=Set the battery charge threshold
After=multi-user.target
StartLimitBurst=0

[Service]
Type=oneshot
Restart=on-failure
ExecStart=/bin/sh -c 'echo 60 > /sys/class/power_supply/BAT*/charge_control_end_threshold'
ExecStart=/bin/sh -c 'echo 40 > /sys/class/power_supply/BAT*/charge_control_start_threshold'

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now battery-charge-threshold

Firefox

Gnome

Extensions

  • Disable

    gnome-extensions disable [email protected]
  • Install

    • with busctl:

      busctl --user call org.gnome.Shell \
                         /org/gnome/Shell \
                         org.gnome.Shell.Extensions \
                         InstallRemoteExtension s \
                         "[email protected]"
    • with gdbus:

      gdbus call --session \
                 --dest org.gnome.Shell.Extensions \
                 --object-path /org/gnome/Shell/Extensions \
                 --method org.gnome.Shell.Extensions.InstallRemoteExtension \
                 "[email protected]"
  • Update

    • with busctl:

      busctl --user call org.gnome.Shell \
                         /org/gnome/Shell \
                         org.gnome.Shell.Extensions \
                         CheckForUpdates
    • with gdbus:

      gdbus call --session \
                 --dest org.gnome.Shell.Extensions \
                 --object-path /org/gnome/Shell/Extensions \
                 --method org.gnome.Shell.Extensions.CheckForUpdates

Nautilus

Disable open folder on hover

gsettings set org.gnome.nautilus.preferences open-folder-on-dnd-hover false

https://www.omgubuntu.co.uk/2023/02/ubuntu-open-folder-on-drag-drop-hover

ffmpegthumnailer (layer rpm-fusion first)

rpm-ostree override remove \
    ffmpeg-free \
    libavcodec-free \
    libavdevice-free \
    libavfilter-free \
    libavformat-free \
    libavutil-free \
    libpostproc-free \
    libswresample-free \
    libswscale-free \
    --install \
        ffmpegthumbnailer `# this is for nautilus video thumbnails / need rpm-fusion repo`

Text thumbnailer

mkdir -p ~/.local/share/thumbnailers

tee ~/.local/share/thumbnailers/text.thumbnailer <<EOF
[Thumbnailer Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=Text Thumbnailer
MimeType=text/plain;text/html;text/css;
# %u is the URI of the file being thumbnailed;
# %i is its path;
# %o is the path of the image file to be written to;
# %s is the maximum desired size of the thumbnail
#    image (the maximum width or height, in pixels);
# %% is a literal percent character.
Exec=sh -c 'magick text:"%i" -thumbnail "%s" -background white -pointsize 5 -border 5 -bordercolor "#CCC" "%o"'
EOF

Gnome terminal

  • elementary profile:

    create profile and set as default.

  • Change settings with dconf

    UUID_NEW=$(uuidgen); \
      UUID_LIST=$(gsettings get org.gnome.Terminal.ProfilesList list); \
      dconf load / <<EOF
    [org/gnome/terminal/legacy/profiles:]
    default='$UUID_NEW'
    list=${UUID_LIST%%]}, '$UUID_NEW']
    
    [org/gnome/terminal/legacy/profiles:/:$UUID_NEW]
    background-color='#2E2E2E'
    cursor-foreground-color='#839496'
    default-size-columns=120
    default-size-rows=30
    font='Monospace 11'
    foreground-color='#a5a5a5'
    palette=['#073642', '#dc322f', '#859900', '#b58900', '#268bd2', '#d33682', '#2aa198', '#eee8d5', '#5e5c64', '#dc322f', '#586e75', '#657b83', '#839496', '#6c71c4', '#93a1a1', '#fdf6e3']
    scrollback-unlimited=true
    use-system-font=false
    use-theme-colors=false
    visible-name='elementary'
    EOF
  • Change settings programaticly:

    new_profile_uuid=$(uuidgen)
    new_profile_list=$(gsettings get org.gnome.Terminal.ProfilesList list | tr -d ']') && new_profile_list+=", '${new_profile_uuid}']"
    gsettings set org.gnome.Terminal.ProfilesList list "${new_profile_list}"
    gsettings set org.gnome.Terminal.ProfilesList default "${new_profile_uuid}"
    SETTINGS=( "visible-name 'elementary'"
               "default-size-columns '120'"
               "default-size-rows '30'"
               "use-system-font 'false'"
               "font 'Monospace 11'"
               "use-theme-colors 'false'"
               "scrollback-unlimited 'true'"
               "cursor-foreground-color '#839496'"
               "background-color '#2E2E2E'"
               "foreground-color '#a5a5a5'"
               "palette \"['#073642', '#dc322f', '#859900', '#b58900', '#268bd2', '#d33682', '#2aa198', '#eee8d5', '#5e5c64', '#dc322f', '#586e75', '#657b83', '#839496', '#6c71c4', '#93a1a1', '#fdf6e3']\"" )
    for i in "${SETTINGS[@]}"
    do
        eval "gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ ${i}"
    done
  • Change settings manually with command:

    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ visible-name 'elementary'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ default-size-columns '120'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ default-size-rows '30'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ use-system-font 'false'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ font 'Monospace 11'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ use-theme-colors 'false'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ scrollback-unlimited 'true'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ cursor-foreground-color '#839496'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ background-color '#2E2E2E'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ foreground-color '#a5a5a5'
    gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ palette "['#073642', '#dc322f', '#859900', '#b58900', '#268bd2', '#d33682', '#2aa198', '#eee8d5', '#5e5c64', '#dc322f', '#586e75', '#657b83', '#839496', '#6c71c4', '#93a1a1', '#fdf6e3']"
  • Add padding to the terminal

    cat <<EOF > ~/.config/gtk-3.0/gtk.css
    vte-terminal,
    terminal-window {
        padding: 5px 3px 10px 10px;
        -vte-terminal-inner-border: 5px 3px 10px 10px;
    }
    EOF

Boxes

Celluloid playback options

Preferences > Miscellaneous > Extra mpv options

# not suggested by manual: --vo=gpu --hwdec=vaapi --gpu-context=wayland
# suggested way is:
--hwdec=auto-safe --gpu-context=wayland

Git config

https://stackoverflow.com/a/70345376/11391913

https://git-scm.com/docs/git-config#Documentation/git-config.txt-GITCONFIGGLOBAL

touch $HOME/.config/gitconfig $HOME/.config/gitignore 
export GIT_CONFIG_GLOBAL=$HOME/.config/gitconfig
git config --global core.excludesFile '~/.config/gitignore'
git config --global user.name "username"
git config --global user.email [email protected]

Declarative system changes for ostree native container

https://coreos.github.io/rpm-ostree/ex-rebuild/#declarative-system-changes

Layers and overrides

mkdir -p /etc/rpm-ostree/origin.d

tee /etc/rpm-ostree/origin.d/layers_n_overrides.yaml <<EOF
packages:
  - printer-driver-brlaser
  - thinkfan
override-remove:
  - gnome-tour
  - toolbox
  - firefox
  - firefox-langpacks
  - fedora-workstation-repositories
EOF

rpm-ostree ex rebuild

ffmpegthumbnailer

mkdir -p /etc/rpm-ostree/origin.d

tee /etc/rpm-ostree/origin.d/ffmpegthumbnailer.yaml <<EOF
# remove ffmpeg-free packages in the base image for ffmpegthumbnailer
packages:
  - ffmpegthumbnailer  
override-remove:                      
  - ffmpeg-free
  - libavcodec-free
  - libavdevice-free
  - libavfilter-free
  - libavformat-free
  - libavutil-free
  - libpostproc-free
  - libswresample-free
  - libswscale-free
EOF

rpm-ostree ex rebuild

Intel media driver

mkdir -p /etc/rpm-ostree/origin.d

tee /etc/rpm-ostree/origin.d/intel-media-driver.yaml <<EOF
packages:
  - intel-media-driver
override-remove:
  - mesa-va-drivers
EOF

rpm-ostree ex rebuild

Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment