Fedora

From Segfault
Jump to navigation Jump to search

Install

Create the boot disk with one of the following:

dd if=image.iso of=/dev/sdX bs=8M status=progress oflag=direct
pv < image.iso > /dev/sdX

Verify checksum with:

SIZE=$(stat -c %s image.iso)
dd if=/dev/sdX count=$((SIZE / 1024)) bs=1024 | sha256sum
pv -Ss ${SIZE} /dev/sdX | sha256sum

Postinstall

Rename Root Device

The encrypted root device is usually named after its UUID, but we'd like to rename[1] it:

dmsetup rename /dev/mapper/luks-36643472-32f9-4553-8841-381eda83be41 luks-root
vi /etc/crypttab
dracut --force

Resize Root Device

The same encrypted root device may have been too small. Let's boot into a live system and enlarge it as necessary:

cfdisk /dev/sdx

Resize the LUKS device:

cryptsetup open /dev/sdx1 luks-root
cryptsetup resize luks-root

Resize the file system (adjust as needed for your file system):[2]

mount -t btrfs /dev/mapper/luks-root /mnt
btrfs filesystem resize max /mnt

Packages & Services

Remove unused packages:

sudo dnf remove PackageKit-command-not-found fprintd

Install missing packages:[3]

sudo dnf install  bash-completion bc btrfs-heatmap btrfs-progs compsize curl e2fsprogs git-core iftop iotop-c less lsof man-pages plocate pv rsync screen strace sharutils vim-enhanced wget xfsprogs

For desktop systems:

firefox gedit gnome-keyring libreoffice-writer mozilla-noscript mozilla-privacy-badger openssh-askpass thunderbird vlc


Enable SSH server if needed:

sudo systemctl enable sshd.service
sudo systemctl start  sshd.service

Enable RPM Fusion:

sudo dnf install 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

GNOME User List

Displaying a user prompt instead of a list of users on the GNOME login screen:[4]

$ mkdir -p /etc/dconf/db/gdm.d
$ cat > /etc/dconf/db/gdm.d/01-hide-users
[org/gnome/login-screen]
# banner-message-enable=true
# banner-message-text='FOO\nBAR'
# disable-restart-buttons=true
disable-user-list=true
^D

Create a new profile:

$ cat > /etc/dconf/profile/gdm
user-db:user
system-db:gdm

$ dconf update
$ chmod -cR a+rX /etc/dconf/

Restart GNOME and the user prompt should be visible on the next login.

/etc/rc.local

The old /etc/rc.local is now called /etc/rc.d/rc.local (emulated by the rc-local.service systemd service). Oh, and Raider is now called Twix :-)

Number of Kernels

The number of retained kernel images can be configured in dnf.conf:[5]

$ cat /etc/dnf/dnf.conf
[...]
installonly_limit=2

Netconsole

We want to enable Netconsole. First, raise the loglevel from "7" to "8":

echo 'kernel.printk = 8 4 1 7' >> /etc/sysctl.d/10-local.conf

Configure & load the netconsole module:

echo 'options netconsole netconsole=@10.0.0.3/eth0,6666@10.0.0.10/00:11:22:33:44:55' >> /etc/modprobe.d/local.conf
echo netconsole >> /etc/modules-load.d/local.conf

Keyboard Backlight

On this MacBook Pro, the keyboard backlight[6] can be switched[7] on/off like this:

echo 255 > /sys/class/leds/smc::kbd_backlight/brightness                                       # On
echo   0 > /sys/class/leds/smc::kbd_backlight/brightness                                       # Off

Or, for an IBM Thinkpad model:

echo 2 > /sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight/brightness             # On
echo 0 > /sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight/brightness             # Off

Initramfs

Adding modules to an /boot/initramfs... image:

sudo dracut --force --add-drivers "lz4 floppy"

Updating the rescue image:

rm /boot/{initramfs,vmlinuz}-0-rescue*
sudo /etc/kernel/postinst.d/51-dracut-rescue-postinst.sh $(uname -r) /boot/vmlinuz-$(uname -r)

Cloud Images

Trying to use Fedora Cloud images:

$ xz -dc /var/tmp/Fedora-Cloud-Base-37-1.7.x86_64.raw.xz | wc -c
5368709120

$ sudo lvresize -L 5368709120B vg0/fedora0.disk0
$ xz -dc /var/tmp/Fedora-Cloud-Base-37-1.7.x86_64.raw.xz | pv | sudo dd of=/dev/test/fedora0.disk0 bs=1M

We can set the root password too:

$ virt-customize -a /dev/test/fedora0.disk0 --root-password password:s3cr3t --hostname foobar
[   0.0] Examining the guest ...
[  22.1] Setting a random seed
[  22.1] Setting passwords
[  24.1] SELinux relabelling
[  33.9] Finishing off

Bluetooth Battery Status

Wireplumber would complain:

BlueZ Battery Provider is not available, won't retry to register it. Make sure you are running BlueZ 5.56+ with experimental features to use Battery Provider.

The solution[8] was to do just that:

$ grep ^Exp /etc/bluetooth/main.conf 
Experimental = true

$ sudo systemctl restart bluetooth.service 

And the warning was gone and bluetooth devices would have a batter status now in Settings.

Zram

Fedora offers zram-generator to configure Zram:

$ cat /etc/systemd/zram-generator.conf 
[zram0]
zram-size = min(ram, 8192)
compression-algorithm = zstd

$ sudo systemctl start systemd-zram-setup@zram0.service
$ zramctl
NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd            8G   4K   64B   20K       4 [SWAP]

Window Switching

Allowing window switching across all work spaces:

gsettings set org.gnome.shell.window-switcher current-workspace-only false

We can also use dconf[9] to check:

$ dconf read /org/gnome/shell/window-switcher/current-workspace-only
false

Per default, Gnome appears to group windows per applications[10], and ALT+TAB cycles through applications, rather than windows:

$ for o in switch-{applications,windows}{,-backward}; do     printf "### ${o}  ";     gsettings get org.gnome.desktop.wm.keybindings ${o};  done
### switch-applications  ['<Super>Tab', '<Alt>Tab']
### switch-applications-backward  ['<Shift><Super>Tab', '<Shift><Alt>Tab']
### switch-windows  @as []
### switch-windows-backward  @as []

Let's disable application grouping and use ALT+TAB to cycle windows instead:[10]

gsettings set org.gnome.desktop.wm.keybindings switch-applications "['<Super>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "['<Shift><Super>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward "['<Shift><Alt>Tab']"

Check with:[11]

$ for o in switch-{applications,windows}{,-backward}; do
   printf "### ${o}  "
   gsettings get org.gnome.desktop.wm.keybindings ${o}
done
 
### switch-applications  ['<Super>Tab']
### switch-applications-backward  ['<Shift><Super>Tab']
### switch-windows  ['<Alt>Tab']
### switch-windows-backward  ['<Shift><Alt>Tab']

The same with dconf:[9]

$ dconf dump /org/gnome/desktop/wm/keybindings/
switch-applications=['<Super>Tab']
switch-applications-backward=['<Shift><Super>Tab']
switch-windows=['<Alt>Tab']
switch-windows-backward=['<Shift><Alt>Tab']

Reset all keybindings to default:

dconf reset -f /org/gnome/desktop/wm/keybindings/

Updating

dnf clean all
dnf upgrade                              # short for dnf update --obsoletes

Upgrading

With Fedora 23, upgrading changed again and now DNF system upgrade is the way to go. In short:

Update the current system:

dnf --refresh upgrade

Install DNF system upgrade and download the packages from the release we want to upgrade to:

dnf install dnf-plugin-system-upgrade
dnf system-upgrade download --refresh --releasever=38

Start the actual upgrade process:

dnf system-upgrade reboot

After the reboot, the system should have been upgraded to the next version.

Links

References