Skip to content

Instantly share code, notes, and snippets.

@fsworld009
Last active September 1, 2024 08:12
Show Gist options
  • Save fsworld009/cb9a402ede96fa6087a2562d987e82be to your computer and use it in GitHub Desktop.
Save fsworld009/cb9a402ede96fa6087a2562d987e82be to your computer and use it in GitHub Desktop.
Arch Linux setup Diary 2023

Arch Linux setup Diary 2023

Goal

Got myself a Miniforum UM790Pro. I would like to install Linux and use it as my daily driver forLD_PRELOAD=/usr/lib/libv4l/v4l1compat.so mpv --demuxer-lavf-o=video_size=1920x1080,framerate=60 av://v4l2:/dev/video0 --profile=low-latency --untimed

  • Internet browsing
  • Gaming
  • Hobby programming

Eventually this would replace my current Windows machine, and then I will move the SSD to a Framework laptop once it's arrived.

The CPUs on these devices are pretty similar (AMD Ryzen™ 9 7940HS on UM790Pro and AMD Ryzen™ 7 7840HS on my Framework 16 preorder)

2023/09/17

Got myself a Lexar NM790 4TB m2 nvme SSD, but pop_os install cannot detect it. Found this is due to https://bugzilla.kernel.org/show_bug.cgi?id=217863

Need a manual kernel patch so I suppose I'm out of luck for now.

I did test UM790Pro a bit with the SSD from my HP Elitebook which has Pop_os installed. Works pretty well.

2023/09/18

Bought a m2 SSD to type C external box. By using the external box the pop_os installer can now recongnize my 4T SSD, so at least I can continue this way for now.

In the meanwhile, I have been doing research on which distros I'd like to use.

Listing down requirements I have gathered so far...

  1. Need to support luks encryption from installer
  2. Need to be close to SteamOS 3 (Arch based)
    1. But SteamOS 3 or distros based on it don't support disk encryption, so can't use them directly
    2. Need to use KDE plastma as DE
  3. [?] burfs filesystem with home as sub container (so it's easier to reinstall system later on if needed?)
  4. [?] Wayland or X11?
  5. [?] which sound system?

Seems like I have to go vanilla arch and do all the requirements myself

2023/09/20

Tried to create a virtual machine under Qemu/KVM, but Arch live CD cannot regconize SSD on external USB even though I set USB redirect

Screenshot from 2023-09-20 23-14-01

Works with host machine, looks like we can continue (tomorrow).

Screenshot 2023-09-20 23-28-48

2023/09/21

Install based on this guide https://wiki.archlinux.org/title/User:ZachHilman/Installation_-_Btrfs_%2B_LUKS2_%2B_Secure_Boot with some changes:

  1. Don't use swap partition, use swapfile https://confluence.jaytaala.com/display/TKB/Use+a+swap+file+and+enable+hibernation+on+Arch+Linux+-+including+on+a+LUKS+root+partition
  2. Made a subvolumn @swapfile for swapfile, filepath /.swapfile/swapfile
  3. for HOOKS, file is /etc/mkinitcpio.coiinf 1/ Remove sd- https://bbs.archlinux.org/viewtopic.php?id=284741
  4. sbctl create-keys was run but probably don't have any actual effect since it's unused 4. sbctl remove-bundle
  5. Need to install missing packages like git, efibookmgr
  6. Don't use secure boot, run efibootmgr manager with arch-linux loader https://wiki.archlinux.org/title/Unified_kernel_image#Directly_from_UEFI
  7. Don't use TPM2

Cannot boot, due to unable to decrypt drive

Bootloader

https://wiki.archlinux.org/title/Unified_kernel_image#Building_the_UKIs

  1. edit /etc/mkinitcpio.d/linux.preset to uncomment efi output
  2. mkdir in /efi/ partition if using default output

Then use https://wiki.archlinux.org/title/Unified_kernel_image#Directly_from_UEFI to generate UEFI entry

2023/09/22

  1. Fix mkinitproc config: use sd-encrypt

Screenshot 2023-09-22 20-20-22

Fix Swapfile: With btrfs, swapfile cannot be in compress mode. Remount subvolume with no compression (change compress=none in fstab)

use https://wiki.archlinux.org/title/Btrfs#Swap_file to recreate swap

manually mount sudo swapon {file} to confirm it works

No network

boot to live cd to install dhcpcd

systemctl enable dhcpcd systemctl enable wpa_supplicant

Need to build kernel with nvme ssd patch

Use wget to download files

https://www.reddit.com/r/archlinux/comments/rn25qo/how_do_you_apply_kernel_patches/

https://archlinux.org/packages/core/x86_64/linux/ -> Go to Source (https://gitlab.archlinux.org/archlinux/packaging/packages/linux) select tag, get zip url

Get patch URL from https://bugzilla.kernel.org/show_bug.cgi?id=217863

Patch PKGBUILD

Edit makepkg config to use multi thread https://wiki.archlinux.org/title/Makepkg#Improving_build_times https://www.reddit.com/r/archlinux/comments/12ds8zd/how_long_to_compile_kernel/

Build: makepkg -s (Maybe makepkg -src so build dependencies and build folders are cleaned up afterwards)

If failed with gpg key:

gpg --recv-keys $PUBLIC_KEY

For this key specificly need to specify key server

gpg --keyserver hkps://keys.openpgp.org --recv-keys 3B94A80E50A477C7

install: sudo pacman -U linux-6.5.4.arch2-1-x86_64.pkg.tar.zst

optional: skip building doc https://wiki.archlinux.org/title/Kernel/Arch_build_system#Avoid_creating_the_doc

2023/09/23

Unresolved problem: if using capture card, it goes to 4k in terminal and can't change to 1080p (fbset not working)

Replace dhcpcd and wpa_supplicant with networkmanager

sudo pacman -Rs dhcpcd wpa_supplicant
sudo pacman -Syu networkmanager
systemctl start NetworkManager.service
systemctl enable NetworkManager.service

replug network cable -> network is up again.

https://archlinux.org/pacman/pacman.8.html

Remove unused dependencies: https://www.reddit.com/r/ManjaroLinux/comments/mixbgk/how_can_i_remove_the_unused_dependencies_but_keep/ pacman -Rns $(pacman -Qdtq)

Learn pacman: https://archlinux.org/pacman/pacman.8.html

Wayland, KDE

https://www.debugpoint.com/wayland-arch-linux/#Set_up_Wayland_in_Arch_Linux

providers

https://bbs.archlinuxcn.org/viewtopic.php?id=13151

  1. jack2 vs pipewire-jack -> pipewirejack
  2. pipewire-media-session vs wireplumber -> wireplumber
  3. phonon-qt5-gstreamer
  4. python-pyqt5
  5. cronie
  6. tesseract-data-eng

https://gitlab.freedesktop.org/pipewire/media-session

Successful login

Screenshot 2023-09-23 11-42-55 Screenshot 2023-09-23 11-44-32

Issues:

  1. video not working
  2. Barrier doesn't support wayland

Barrier alternative

Found input-leap, issue discussion mentioning Wayland support seems to be implemented input-leap/input-leap#109

For now need to build flatpak from branch https://github.com/input-leap/flathub-inputleap/tree/add/input-leap

https://unix.stackexchange.com/questions/695934/how-do-i-build-a-flatpak-package-file-from-a-flatpak-manifest

pacman -Syu flatpak-builder
git clone {flathub-inputleap repo}
git submodule update --init --recursive

mkdir build
flatpak-builder build/ io.github.input_leap.input-leap.yml

# Get error, missing KDE SDK
# Add it with guides in https://github.com/input-leap/input-leap/wiki/Building-the-Flatpak

# Choose sdk version in cli
flatpak --user install flathub org.kde.Sdk

# build again
(current failing)

Gave up on Barrier for now.

Video/audio play issue

  1. https://wiki.archlinux.org/title/GStreamer install gstreamer and all codec
    1. gstreamer should have been integerated with KDE as part of KDE installation
  2. Audio: found both pipewire and pulse audio are running
    1. remove plastma-pa and dependencies sudo pacman -Rs plasma-pa
    2. disable pulseaudio services
      $ systemctl --user stop pulseaudio.{service,socket}
      $ systemctl --user disable pulseaudio.{service,socket}
      
  3. install pirepwire-pulse
  4. systemctl --user start pipewire-pulse. systemctl --user enable pipewire-pulse
  5. sudo pacman -Syu plasma-pa, now it doesn't prompt to install pulseaudio anymore

ref: https://blog.ryey.icu/replace-pulseaudio-with-pipewire.html https://superuser.com/questions/1223030/cant-play-music-or-youtube-videos-on-arch-linux

restart

man: outdated mandoc.db

run makewhatis /usr/share/man

CJK font

sudo pacman noto-fonts-cjk, noto-fonts-emoji

man broken

Probably caused by custom kernel upgrade

  1. man: outdated mandoc.db lacks ** entry, run makewhatis /usr/share/man : run the command with sudo
  2. man: SYSERR: exec: less: No such file or directory: need to install less

IME

fcitx5 is now on flatpak, easy

Browsers

Firefox and Brave are on flatpak

For brave, full history can only be manually synced https://community.brave.com/t/how-to-export-braves-browsing-history-to-another-browser/114687

open sshd so file transfer from Windows pc is possible

systemctl enable --now sshd

Misc

2023/09//24

Hiberate support with swapfile

https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Configure_the_initramfs Add resume hook after sd-encrypt in /etc/mkinitcpio.d

https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file

Find swapfile physical offset

btrfs inspect-internal map-swapfile -r /swap/swapfile

Edit /etc/kernel/cmdline

resume=/dev/mapper/system
resume_offset=(offset)

Rebuild UKI sudo mkinitcpio -p linux

-> Maybe reboot here to take effect on new boot parameters?

https://bbs.archlinux.org/viewtopic.php?id=265175

Edit /etc/systemd/slee.conf

HibernateMode=shutdown

Test with systemctl hibernate

If works fine, then AUR install hibernator-git, sudo hibernator, rebot to get Hibernator menu in KDE Plasma

Failed attempts:

  1. Play video after resume before login (click play on login screen). This seems crashed pipewire
  2. Failed when external disk is connected?

Otherwise the Hipernate setup itself should have been counted as done.

https://www.reddit.com/r/pop_os/comments/v3g2w9/is_there_a_cli_command_to_restart_pipewire/

Try this next time?

#!/bin/sh
systemctl --user restart wireplumber pipewire.socket pipewire pipewire-pulse

Two sound setting

pacman -Rs kmix

Bluetooth keyboard or mouse are not auto reconnected after turning off/on again

Use interactive management shell bluetoothctl

bluetoothctl
devices
trust {MAC of device}

to enable auto reconnect

Or can be simplified in bluetoothctl trust {MAC} if you already know MAC address.

Probably need a script / service to auto trust new connections? (Check how this was done in Steamdeck?)

Steam

Steam & MangoHud & Gamescope: trying all flatpak https://www.reddit.com/r/linux_gaming/comments/16cdkt8/mangohud_flatpak_steam_flatpak_recently_quit/ https://www.reddit.com/r/linux_gaming/comments/15qsshe/gamescope_flatpak_runtime_is_end_of_life_but_the/ Mangohud and gamescope: seems not on discover shop, but can be manually installed

https://github.com/flightlessmango/MangoHud#flatpak enable for steam

Avermedia GC553

LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so mpv --demuxer-lavf-o=video_size=1920x1080,framerate=60  av://v4l2:/dev/video0 --profile=low-latency --untimed

mpv: only works with video

OBS: Works fine with low latency, not sure which ones did the trick

  1. Pass LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
  2. Follow https://wiki.archlinux.org/title/PulseAudio/Troubleshooting#Setting_the_default_fragment_number_and_buffer_size_in_PulseAudio
    1. Update /etc/pulse/default.pa with load-module module-udev-detect tsched=0
    2. Update /etc/pulse/client.conf with
      default-fragments = 3
      default-fragment-size-msec = 5
      
  3. https://unix.stackexchange.com/questions/560545/problem-with-audio-stuttering-choppy-in-every-single-distribution-ive-used
    1. sudo cp /usr/share/pipewire/pipewire.conf /etc/pipewire/
    2. Edit /etc/pipewire/pipewire.conf to enable: (2023/09/27 update: this affects audio quality, reverted)
      default.clock.rate        = 19200
      default.clock.quantum     = 512
      default.clock.min-quantum = 32
      default.clock.max-quantum = 4096
      
  4. Restart audio

btrfs slow write

Observed slow write speed (~10MB/s) when trying to copy Steam games from backup USB external SSD (ext4 nonencrypted).

https://forum.manjaro.org/t/btrfs-slow-read-write-speed-on-nvme/118249/11 https://www.reddit.com/r/btrfs/comments/r04i0l/ideal_mount_options_for_ssd/

  1. sudo systemctl enable fstrim.timer?
  2. Disable CoW for steam common folder seems helped a bit http://www.infotinks.com/btrfs-disabling-cow-file-directory-nodatacow/

https://www.reddit.com/r/btrfs/comments/112ucfg/very_slow_drive_after_adding_millions_of_files/

manually defrag home subvol

sudo btrfs filesystem defragment -vrf /home

https://forum.manjaro.org/t/slow-writes-with-btrfs-luks-nvme-ssd/145868

but doesn't seem like mount is wrong

https://bbs.archlinux.org/viewtopic.php?id=280471

sudo cryptsetup status system
# no discards
sudo cryptsetup refresh --allow-discards /dev/mapper/system

Still no fixed

Maybe related? https://unix.stackexchange.com/questions/341442/luks-discard-trim-conflicting-kernel-command-line-options

https://wiki.archlinux.org/title/Dm-crypt/Specialties#Discard/TRIM_support_for_solid_state_drives_(SSD)

Not sure which one successfully added discrads flag to lukc

  1. sudo cryptsetup --allow-discards --persistent refresh system
  2. Add rd.luks.options=discard to /etc/kernel/cmdline
  3. Set /etc/crypttab.initramfs with system /dev/disk/by-partlabel/cryptsystem none timeout=180,rd.luks.options=discard

2 and 3 require mkinitptio rebuild

still no performance improvement

https://forum.manjaro.org/t/slow-writes-with-btrfs-luks-nvme-ssd/145868

https://www.reddit.com/r/linux/comments/15wyukc/the_real_performance_impact_of_using_luks_disk/ https://wiki.archlinux.org/title/Dm-crypt/Specialties#Disable_workqueue_for_increased_solid_state_drive_(SSD)_performance

sudo fstrim -v /
sudo fstrim -v /home
cryptsetup --perf-no_read_workqueue --perf-no_write_workqueue --allow-discrads --persistent

Still no change in general, will continue to monitor and see if it has any real impact other than copying large game files.

0925 update: tested other drive and looked fine, so it's probably just the external SSD is bad.

2023/09/25

Baloo takes many CPUs https://askubuntu.com/questions/1068788/is-it-safe-to-disable-baloo-file-extractor-in-kde-plasma-5

running Monster hutner rise

  1. Controller not detected: disable steam input
  2. Having a second "OpenGL Rendering" window, cannot be closed and Steam won't consider the game is stopped
    1. ps aux | grep MonsterHunterRise and kill -9 all process manually
    2. Caused by running reframework, probably because I copied some configs from Windows
  3. IME works fine without reframework

2023/09/26

Current /etc/environment config

MOZ_ENABLE_WAYLAND=1
XMODIFIERS=@im=fcitx

To enable Firefox Wayland support and be able to use fticx in Line (and I assume all apps rendering on Xorg!?)

2023/09/27

pacman -S vscode

Installed Code - OSS instead.

Tried to sync settings, but it failed to download certain extensions. This is because OSS cannot use Marketplace from Microsoft. https://stackoverflow.com/questions/74524907/why-cant-i-search-for-vs-code-extensions

Possible workaround https://stackoverflow.com/questions/64463768/cant-find-certain-extensions-in-code-ossopen-source-variant-of-visual-studio-c

Maybe it's time to rebuilt VS code config

2023/09/28

Firefox customize CSS

Basic https://github.com/mbnuqw/sidebery/wiki/Firefox-Styles-Snippets-(via-userChrome.css)

Styles in this page doesn't work for me, though.

For flatkap Firefox, profiles are under /home/user/.var/app/org.mozilla.firefox/.mozilla/firefox (the one showed on UI is wrong) https://www.reddit.com/r/FirefoxCSS/comments/wgwxgk/userchromecss_on_steam_deck_firefox_flatpack/

Also used the script in thread disable native tab (Using Sidebery now)

gamescope

Need to install vulkan drivers https://wiki.archlinux.org/title/Vulkan#Selecting_Vulkan_driver vulkan-icd-loader and vulkan-radeon

gamescope -w 1280 -h 720 -e -- /var/lib/flatpak/exports/bin/com.valvesoftware.Steam -steamos -gamepadui

Can't really run any game, though. And have to rely on system gamescope can do a simple test with glxgears

2023/09/29

https://www.reddit.com/r/linux_gaming/comments/10jthit/can_somebody_explain_gamescope_and_wayland_re/

Based on this article, it's not possible to run "Game mode UI" under Wayland Plasma session and launch games within the same gamescope window

flathub/com.valvesoftware.Steam.Utility.gamescope#7

Flatpak gamescope won't work with official Proton or ProtonGE. Need to use flatpak build.

Tested and it seems flatpak ProtonGE build doesn't work with wmv/wma fixes, probably can't really be used. Seems also not really possible to use system gamescope?

wintricks corefonts failing on Lutris

URL: https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/arial32.exe
Downloaded: ab830b501128ed56cb86fbf200e96201883319d6f92c39932ab75ecf6117a95d
Expected: 85297a4d146e9c87ac6f74822734bdee5f4b2a722d7eaa584b7f2cbf76f478f6

Install would fail

Winetricks/winetricks#2127

Need to manually patch winetricks used in flatpak Lutris with this branch. Use which winetricks in Lutris's Bash terminal (from Wine icon menu) to find out where winetricks is installed, for me it is ~/.var/app/net.lutris.Lutris/data/lutris/runtime/winetricks/winetricks

move to system steam

https://wiki.archlinux.org/title/steam

lib32-vulkan-radeon mesa, lib32-mesa ttf-liberation

mangoapp: symbol lookup error: mangoapp: undefined symbol: glfwGetX11Window uninstall glfw-wayland and install glfw-x11

(mangoapp doesn't work due to glfw-x11 dependency but Steam performance overlay doesn't rely on it, so it's fine)

Move steam files

  1. Set folders under common to read-only
  2. Luanch steam with -noverifyfiles
  3. Do the following each game at one time
    1. Change game comapatibility
    2. When triggering re-install, it should only redownload preshader cache and failed when downloading game content
    3. Change folder permission back to r/w
    4. Download should finish immediately after retry

gamescope with system steam

REf: https://steamcommunity.com/app/1675200/discussions/1/5568165891215726482/?l=tchinese https://www.reddit.com/r/Steam/comments/t8evi4/i_got_the_steam_deck_ui_on_my_pc/

Run with -steamdeck -gamepadui only once, to bypass prompts for steam deck initial setup.

Make a script to launch Steam deck ui in gamescope:

#!/bin/sh
set -v

# This option would break mongohud in Stem and games
#export STEAM_USE_MANGOAPP=1

#export QT_IM_MODULE=steam
#export GTK_IM_MODULE=Steam

gamescope -H 1080 -e -F fsr &
gamescope_pid="$!"

sleep 5

export DISPLAY=:2
export GAMESCOPE_WAYLAND_DISPLAY="gamescope-0"

# Found steam would run mangoapp on its own so this is not needed
#mangoapp &
#mangoapp_pid="$!"
#sleep 5

steam -steamos3 -steampal -steamdeck -gamepadui

kill -9 $gamescope_pid
#wakill -9 $mangoapp_pid

Screenshot_20230929_221738 Screenshot_20230929_221945

Performance toggle and fps limiter work (I suppose mangohud integration is working). Input doesn't work (both onscreen and keyboard), can't type in MHR as of now.

Unmount disk

https://unix.stackexchange.com/a/3111/109803 https://superuser.com/a/1638317/446027

  • fuser -mv /path/to/mountpoint to find who is accessing disks
  • udisksctl power-off -b /dev/sdb power off external disks

2023/09/30

Create a new btrfs subvolume for vm disks storage

sudo mount -t btrfs LABEL=system /mnt/disk
sudo btrfs subvolume create /mnt/disk/@vmdisks
sudo umount /mnt/disk

planning to add nodatacow mount option to deal with

sudo mount -t btrfs -o defaults,x-mount.mkdir,nodatacow,compress=zstd,ssd,noatime,subvol=@vmdisks LABEL=system /vmdisks

https://www.reddit.com/r/btrfs/comments/p1xa0u/terrible_vm_performance_even_with_mitigations/

However the mount option doesn't work, findmnt doesn't reflect this value. It could be because the mount is under @root subvolume which has CoW enabled.

Solution: set chtttr +C /vmdisks/

https://blog.gtwang.org/linux/how-to-make-file-immutable-on-linux-chattr-command/

make a file and verify the new file has C flag (CoW disabled):

$ lsattr /vmdisks/
---------------C------ /vmdisks/test.txt

2024/01/25: Guess I am not supposed to mount it with compressed support as it's not compatible with nocow files https://superuser.com/questions/858219/btrfs-filesystem-compression-and-copy-on-write However nodatacow still doesn't work and still require chattr to set the folder

libvert / KVM / QEMU / virtmanager

Learning: https://blog.51cto.com/changfei/1672147

Basic guide: https://ivonblog.com/posts/archlinux-qemu-virt-manager/

iptables and iptables-nft would conflict, choose the later, as it's the newer package

Create disk manually with dynamic allocating: see my old note: https://gist.github.com/fsworld009/5f0ff0c5541079c4d28bdbc692fc15cf#kvm--virtmanager-to-install-windoes-10-with-oem-key

Screenshot_20230930_221300

Screenshot_20230930_222413

Hibernate support

2024/01/25 What i have tried so far

<suspend-to-disk enabled='yes'/>
powercfg.exe /hibernate on
Enable Hibernate menu in Power options

Hibernate would success and shutdown, but upon reboot the state is not restored.

Attempt 2: Installed virtio driver (which includes QEMU guest agant), then add this new channel

<channel type="unix">
  <source mode="bind" path="/run/libvirt/qemu/channel/19-win10pro/org.qemu.guest_agent.0"/>
  <target type="virtio" name="org.qemu.guest_agent.0" state="connected"/>
  <alias name="channel1"/>
  <address type="virtio-serial" controller="0" bus="0" port="2"/>
</channel>

sudo virsh dompmsuspend win10pro disk would work, but it is just for triggering hibernate from host, it is still cannot be resumed.

2023/10/01

Redo shell env configs. Seems most of the stuffs I want is already done by Starship

Created https://github.com/fsworld009/dotfiles to collect new configs & remove unused configs from previous repo.

Start to build Code OSS from scrach as well.

Screenshot_20231001_172703 Screenshot_20231001_183046

Note for Settings Sync: Ctrl+Shift+P -> Sync: Advanced options -> Sync: Edit Local Settings

Edit:

  • ignoreUploadFiles -> add clipboard.history.json
  • ignoreUploadFolders -> add History, globalStorage

To avoid uploading unnecessary data to gist.

2023/10/07

btrfs snapshots @root subvolume

sudo btrfs subvolume snapshot -r / /.snapshots/2023-10-07

For recovery use rsync or cp like external backups, see https://linuxhint.com/use-btrfs-snapshots/

Setting up emulators

Found RetroFighter bladeGC receiver is connected to Linux as Switch Pro controller mode and cannot change it. When plugged in Steam deck it is in XInput mode, so it should support linux. Not sure if I need to change OS Name manually for the receiver to recongnize it.

All emus can be found on flatpak

Gamescope Steam with mangoapp

Re-installed glfw-x11 and copied mangoapp related settings from https://gist.github.com/DoomedSouls/e4015dffc08963a57c6adf3066f5a486

#!/bin/sh
set -v

## This option would break mongohud in Stem and games
# Enable Mangoapp
export STEAM_USE_MANGOAPP=1
export MANGOHUD_CONFIGFILE=/usr/share/doc/mangohud/MangoHud.conf

#https://gist.github.com/DoomedSouls/e4015dffc08963a57c6adf3066f5a486

# Enable support for xwayland isolation per-game in Steam
export STEAM_MULTIPLE_XWAYLANDS=1
# We have the Mesa integration for the fifo-based dynamic fps-limiter
export STEAM_GAMESCOPE_DYNAMIC_FPSLIMITER=1
# Don't wait for buffers to idle on the client side before sending them to gamescope
export vk_xwayland_wait_ready=false

# Scaling support
export STEAM_GAMESCOPE_FANCY_SCALING_SUPPORT=1

# Support for gamescope tearing with GAMESCOPE_ALLOW_TEARING atom
export STEAM_GAMESCOPE_HAS_TEARING_SUPPORT=1

# Enable tearing controls in steam
export STEAM_GAMESCOPE_TEARING_SUPPORTED=1

# We no longer need to set GAMESCOPE_EXTERNAL_OVERLAY from steam, mangoapp now does it itself
export STEAM_DISABLE_MANGOAPP_ATOM_WORKAROUND=1

# Enable horizontal mangoapp bar
export STEAM_MANGOAPP_HORIZONTAL_SUPPORTED=1

# Set input method modules for Qt/GTK that will show the Steam keyboard
export QT_IM_MODULE=steam
export GTK_IM_MODULE=Steam

# Initially write no_display to our config file
# so we don't get mangoapp showing up before Steam initializes
# on OOBE and stuff.
mkdir -p "$(dirname "$MANGOHUD_CONFIGFILE")"
echo "no_display" > "$MANGOHUD_CONFIGFILE"

gamescope -H 1080 -e -F fsr \
      --xwayland-count 2 \
      -O DP-1,DP-3,*,eDP-1 \
      --default-touch-mode 4 \
      --immediate-flips \
      --adaptive-sync &
gamescope_pid="$!"

sleep 5


export DISPLAY=:2
export GAMESCOPE_WAYLAND_DISPLAY="gamescope-0"

# If we have mangoapp binary start it
if command -v mangoapp > /dev/null; then
    mangoapp > "${HOME}"/.mangoapp-stdout.log 2>&1 &
fi
mangoapp_pid="$!"

steam -steamos3 -steampal -steamdeck -gamepadui

kill -9 $mangoapp_pid

Not sure which option did the effect, but now the scaling slider in Steam UI work (so FSR to a 720p on 1080p gamescope screen is now possible)

Because this runs on user instead of root, we need to sudo chmod o+w /usr/share/doc/mangohud/MangoHud.conf for mangoapp to work (steam will write configs on UI to this file).

Benefit of using mangoapp:

  1. Will work for all games
  2. HUD display resolution is based on gamescope screen instead of in-game resolution.
    1. For example when running a 720p game in a 1080p gamescope screen, the HUD will be smaller / consised.

Screenshot_20231009_175716 Screenshot_20231009_175708

2023/10/08

pacman -Syu results many renames. This is for upcoming KDE Plasma 6 release https://forum.garudalinux.org/t/looks-like-my-packages-respositories-are-changed-is-this-normal/31248/6

upgrades went fine.

2023/10/09

Keyboard

Found global shortcuts like Meta+F8 doesn't work, asked in https://www.reddit.com/r/kde/comments/173ktgm/most_shortcuts_includting_altf4_stopped_working/?sort=new

but turns out it is just keyboard issue. Did learned a bit about kwin, kglobalaccel, and dbus in the process

during the research process I saw this article mentioned a bad shortkey config file may cause global shortcuts stopped working: https://pay.reddit.com/r/kde/comments/16mmacx/some_shortcuts_with_meta_key_dont_works/

I also observed that on my Steamdeck (Runs KDE Plasma on X11 in Desktop mode), it is kglobalaccel that registers org.kde.kglobalaccel on dbus instead of kwin:

(deck@steamdeck ~)$ qdbus  org.freedesktop.DBus /org/freedesktop/DBus       org.freedesktop.DBus.GetConnectionUnixProcessID org.kde.kglobalaccel
3039
(deck@steamdeck ~)$ ps aux | grep 3039
deck        3039  0.0  0.1 229928 26528 ?        Ssl  15:16   0:00 /usr/bin/kglobalaccel5
deck        7142  0.0  0.0   6564  2460 pts/1    S+   16:01   0:00 grep --color=auto 3039

(deck@steamdeck ~)$ systemctl status --user plasma-kglobalaccel.service
● plasma-kglobalaccel.service - KDE Global Shortcuts Server
     Loaded: loaded (/usr/lib/systemd/user/plasma-kglobalaccel.service; static)
     Active: active (running) since Mon 2023-10-09 15:16:29 CST; 46min ago
   Main PID: 3039 (kglobalaccel5)
      Tasks: 3 (limit: 17686)
     Memory: 4.7M
        CPU: 197ms
     CGroup: /user.slice/user-1000.slice/[email protected]/background.slice/plasma-kglobalaccel.service
             └─3039 /usr/bin/kglobalaccel5

Oct 09 15:16:29 steamdeck systemd[1116]: Starting KDE Global Shortcuts Server...
Oct 09 15:16:29 steamdeck systemd[1116]: Started KDE Global Shortcuts Server.

And I actually cannot start kglobalaccell service manually in Arch Linux

❯ systemctl --user status plasma-kglobalaccel.service
○ plasma-kglobalaccel.service - KDE Global Shortcuts Server
     Loaded: loaded (/usr/lib/systemd/user/plasma-kglobalaccel.service; static)
     Active: inactive (dead)

❯ systemctl --user start plasma-kglobalaccel.service
Job for plasma-kglobalaccel.service failed because the control process exited with error code.
See "systemctl --user status plasma-kglobalaccel.service" and "journalctl --user -xeu plasma-kglobalaccel.service" for details.


❯ systemctl status --user plasma-kglobalaccel.service
× plasma-kglobalaccel.service - KDE Global Shortcuts Server
     Loaded: loaded (/usr/lib/systemd/user/plasma-kglobalaccel.service; static)
     Active: failed (Result: exit-code) since Mon 2023-10-09 15:09:13 CST; 52min ago
   Duration: 1.929s
   Main PID: 4772 (code=exited, status=1/FAILURE)
        CPU: 19ms

Oct 09 15:09:11 fsworld009-archlinux systemd[1237]: Starting KDE Global Shortcuts Server...
Oct 09 15:09:11 fsworld009-archlinux systemd[1237]: Started KDE Global Shortcuts Server.
Oct 09 15:09:13 fsworld009-archlinux kglobalaccel5[4772]: kf.dbusaddons: Couldn't register name 'org.kde.kglobalaccel' with DBUS - another process owns it already!
Oct 09 15:09:13 fsworld009-archlinux systemd[1237]: plasma-kglobalaccel.service: Main process exited, code=exited, status=1/FAILURE
Oct 09 15:09:13 fsworld009-archlinux systemd[1237]: plasma-kglobalaccel.service: Failed with result 'exit-code'.

Steamdeck version info at the time of this writing

Operating System: SteamOS 3.4.11
KDE Plasma Version: 5.26.1
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 5.13.0-valve37-1-neptune (64-bit)
Graphics Platform: X11
Processors: 8 × AMD Custom APU 0405
Memory: 14.5 GiB of RAM
Graphics Processor: AMD Custom GPU 0405
Manufacturer: Valve
Product Name: Jupiter
System Version: 1

Steam onscreen keyboard with CHT and JPN support

Turns out steam utalizes ibus IMEs:

(deck@steamdeck ~)$ sudo pacman -Q | grep ibus
ibus 1.5.27-1
ibus-anthy 1.5.14-4
ibus-hangul 1.5.4-3
ibus-pinyin 1.5.0-8
ibus-table 1.16.12-1
ibus-table-cangjie-lite 1.8.8-2
libibus 1.5.27-1
libusb 1.0.26-1
libusbmuxd 2.0.2-1

Install desired IMEs (anthy for JPN and pinyin for CHT), then add these to gamescope launch script:

# Set input method modules for Qt/GTK that will show the Steam keyboard
export QT_IM_MODULE=steam
export GTK_IM_MODULE=Steam

ibus-daemon -d -r --panel=disable --emoji-extension=disable

It's now working in Steam UI and in game too. However, keyboard only works for English. This is probably expected considering IME is now steam instead of fticx.

Screenshot_20231009_183243 Screenshot_20231009_175132

updated script:

#!/bin/sh
set -v

## This option would break mongohud in Stem and games
# Enable Mangoapp
export STEAM_USE_MANGOAPP=1
export MANGOHUD_CONFIGFILE=/usr/share/doc/mangohud/MangoHud.conf

#https://gist.github.com/DoomedSouls/e4015dffc08963a57c6adf3066f5a486

# Enable support for xwayland isolation per-game in Steam
export STEAM_MULTIPLE_XWAYLANDS=1
# We have the Mesa integration for the fifo-based dynamic fps-limiter
export STEAM_GAMESCOPE_DYNAMIC_FPSLIMITER=1
# Don't wait for buffers to idle on the client side before sending them to gamescope
export vk_xwayland_wait_ready=false

# Scaling support
export STEAM_GAMESCOPE_FANCY_SCALING_SUPPORT=1

# Support for gamescope tearing with GAMESCOPE_ALLOW_TEARING atom
export STEAM_GAMESCOPE_HAS_TEARING_SUPPORT=1

# Enable tearing controls in steam
export STEAM_GAMESCOPE_TEARING_SUPPORTED=1

# We no longer need to set GAMESCOPE_EXTERNAL_OVERLAY from steam, mangoapp now does it itself
export STEAM_DISABLE_MANGOAPP_ATOM_WORKAROUND=1

# Enable horizontal mangoapp bar
export STEAM_MANGOAPP_HORIZONTAL_SUPPORTED=1

# Set input method modules for Qt/GTK that will show the Steam keyboard
export QT_IM_MODULE=steam
export GTK_IM_MODULE=Steam

# Initially write no_display to our config file
# so we don't get mangoapp showing up before Steam initializes
# on OOBE and stuff.
mkdir -p "$(dirname "$MANGOHUD_CONFIGFILE")"
echo "no_display" > "$MANGOHUD_CONFIGFILE"

# Input method support if present
if command -v /usr/bin/ibus-daemon > /dev/null; then
    /usr/bin/ibus-daemon -d -r --panel=disable --emoji-extension=disable
fi


gamescope -H 1080 -e \
      --xwayland-count 2 \
      --default-touch-mode 4 \
      --immediate-flips &
gamescope_pid="$!"

sleep 5


export DISPLAY=:2
export GAMESCOPE_WAYLAND_DISPLAY="gamescope-0"

# If we have mangoapp binary start it
if command -v mangoapp > /dev/null; then
    mangoapp > "${HOME}"/.mangoapp-stdout.log 2>&1 &
    mangoapp_pid="$!"
fi

steam -steamos3 -steampal -steamdeck -gamepadui

kill -9 $mangoapp_pid
pkill -9 -f ibus-daemon

RetroFighters BladeGC issue

When the USB dongle is plugged in Arch Linux, it is recongnized as Switch Pro controller instead of XInput device, and Steam cannot recongnize it.

However, when pluging into Steam deck in game mode, or in desktop mode while Steam is open, it will be a Xinput device.

lsusb shows that VID and PID are different so it's not a driver issue

Bus 001 Device 018: ID 057e:2009 Nintendo Co., Ltd Switch Pro Controller
Bus 007 Device 019: ID 045e:028e Microsoft Corp. Xbox360 Controller

Current workaround: get a USB female to two USB male adapter (one for data+power and one for additional power), connect data to SteamDeck and power to somewhere (can be Arch Linux PC), once it is powered on as Xinput device, unplug data from SteamDeck, leaving power cable open (hence it's still powered on while disconnected from devices), then plug it into Arch Linux PC.

Need to figure out what triggers the dongle to enter XInput mode when plugged into the Steamdeck

2023/10/10

Update steam gamescope script: Auto assign DISPLAY and GAME_SCOPE_WAYLAND_DISPLAY, add mouse cursor (although mouse still don't work in steam menu)

#!/bin/sh
set -v

## This option would break mongohud in Stem and games
# Enable Mangoapp
export STEAM_USE_MANGOAPP=1
export MANGOHUD_CONFIGFILE=$(mktemp /tmp/mangohud.XXXXXXXX)

#https://gist.github.com/DoomedSouls/e4015dffc08963a57c6adf3066f5a486

# Enable support for xwayland isolation per-game in Steam
export STEAM_MULTIPLE_XWAYLANDS=1
# We have the Mesa integration for the fifo-based dynamic fps-limiter
export STEAM_GAMESCOPE_DYNAMIC_FPSLIMITER=1
# Don't wait for buffers to idle on the client side before sending them to gamescope
export vk_xwayland_wait_ready=false

# Scaling support
export STEAM_GAMESCOPE_FANCY_SCALING_SUPPORT=1

# Support for gamescope tearing with GAMESCOPE_ALLOW_TEARING atom
export STEAM_GAMESCOPE_HAS_TEARING_SUPPORT=1

# Enable tearing controls in steam
export STEAM_GAMESCOPE_TEARING_SUPPORTED=1

# We no longer need to set GAMESCOPE_EXTERNAL_OVERLAY from steam, mangoapp now does it itself
export STEAM_DISABLE_MANGOAPP_ATOM_WORKAROUND=1

# Enable horizontal mangoapp bar
export STEAM_MANGOAPP_HORIZONTAL_SUPPORTED=1

# Set input method modules for Qt/GTK that will show the Steam keyboard
export QT_IM_MODULE=steam
export GTK_IM_MODULE=Steam


# Create run directory file for startup and stats sockets
#   shellcheck disable=SC2030 # (broken warning)
tmpdir="$([[ -n ${XDG_RUNTIME_DIR+x} ]] && mktemp -p "$XDG_RUNTIME_DIR" -d -t gamescope.XXXXXXX)"
socket="${tmpdir:+$tmpdir/startup.socket}"
stats="${tmpdir:+$tmpdir/stats.pipe}"
# Fail early if we don't have a proper runtime directory setup
#   shellcheck disable=SC2031 # (broken warning)
if [[ -z $tmpdir || -z ${XDG_RUNTIME_DIR+x} ]]; then
	echo >&2 "!! Failed to find run directory in which to create stats session sockets (is \$XDG_RUNTIME_DIR set?)"
	exit 0
fi

export GAMESCOPE_STATS="$stats"
mkfifo -- "$stats"
mkfifo -- "$socket"


# Initially write no_display to our config file
# so we don't get mangoapp showing up before Steam initializes
# on OOBE and stuff.
mkdir -p "$(dirname "$MANGOHUD_CONFIGFILE")"
echo "no_display" > "$MANGOHUD_CONFIGFILE"

# Input method support if present
if command -v ibus-daemon > /dev/null; then
    ibus-daemon -d -r --panel=disable --emoji-extension=disable
fi

gamescope -H 1080 -e \
      --xwayland-count 2 \
      --cursor-hotspot 5,3 \
      --cursor "$HOME/.local/share/Steam/tenfoot/resource/images/cursors/arrow.png" \
      --default-touch-mode 4 \
      -R "$socket" -T "$stats" \
      --immediate-flips > "${HOME}"/.gamescope-stdout.log 2>&1 &
gamescope_pid="$!"

if read -r -t 3 response_x_display response_wl_display <> "$socket"; then
	export DISPLAY="$response_x_display"
	export GAMESCOPE_WAYLAND_DISPLAY="$response_wl_display"
	# We're done!
else
    echo "failed to get DISPLAY and GAMESCOPE_WAYLAND_DISPLAY"
	kill -9 "$gamescope_pid"
	exit 0
fi


# If we have mangoapp binary start it
if command -v mangoapp > /dev/null; then
    mangoapp > "${HOME}"/.mangoapp-stdout.log 2>&1 &
    mangoapp_pid="$!"
fi

steam -steamos3 -steampal -steamdeck -gamepadui > "${HOME}"/.steam-stdout.log 2>&1

kill -9 $mangoapp_pid
pkill -9 -f ibus-daemon

cannot use IMEs in KDE apps

Don't set GTK_IM_MODULE & QT_IM_MODULE & SDL_IM_MODULE in /etc/environment, forgot why I added them.

https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland#KDE_Plasma

2023/10/12

OBS Game and audio capture

  1. Audio capture https://github.com/dimtpap/obs-pipewire-audio-capture
    1. Add application source -> need to manually type game exe name (Can check in pipewire UI)
    2. Maybe try virtual audio source next time https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-devices
  2. Game capture https://github.com/nowrep/obs-vkcapture
    1. Follow instruction for flatpak plugin
    2. For native games install obs-vkcapture from AUR sudo aura -A obs-vkcapture
    3. This installs obs-studio in native, though.
    4. pass OBS_VKCAPTURE=1 when launching gamescope & steam to make all game windows available to be captured.

Get audio capture app or name

If the title displayed on Pipewire UI isn't app name, for example:

  1. Holocure: "Audio stream #1"
  2. Sonic Adventure DX: "sonic"

While audio is playing, use pw-dump > ~/pw-dump.log, then open the text file

Find the string in the log to lookup application name, for example:

        "application.process.binary": "wine64-preloader",
        "application.process.host": "fsworld009-fw16",
        "application.process.id": 235394,
        "application.process.machine-id": "383c37d990f5464696d9d10eb6507ad9",
        "application.process.session-id": 2,
        "application.process.user": "fsworld009",
        "audio.adapt.follower": "",
        "client.api": "pipewire-pulse",
        "client.id": 311,
        "clock.quantum-limit": 8192,
        "factory.id": 6,
        "factory.mode": "split",
        "library.name": "audioconvert/libspa-audioconvert",
        "media.class": "Stream/Output/Audio",
        "adapt.follower.spa-node": "",
        "application.language": "en_US.UTF-8",
        "application.name": " sonic",
        "application.process.binary": "wine-preloader",
        "application.process.host": "fsworld009-fw16",
        "application.process.id": 233868,
        "application.process.machine-id": "383c37d990f5464696d9d10eb6507ad9",
        "application.process.session-id": 2,
        "application.process.user": "fsworld009",

So we could get that binary name is wine-preloader and wine64-preloader respectively.

2023/10/14

PCSX2 crashes when using Vulkan, fallback to OpenGL for now. Possible reason is AMD APU? https://forums.pcsx2.net/Thread-Lots-of-Games-Crashed-on-Vulkan

2023/10/17

OBS: Minimize sound delay on capture cards

/etc/pipewire/pipewire.conf

    default.clock.quantum     = 96     
    default.clock.min-quantum = 96 
    default.clock.max-quantum = 96  

Restart pipewire.

quantum = buffer size. Need to observe if this affects other usages.

10/28 update: 128 seems work well.

2023/10/20

Build OBS

Use https://aur.archlinux.org/obs-studio-git.git

  1. aura -A obs-studio-git (or `yay -S obs-studio-git) once so that all dependencies are installed
  2. Clone the package repo
  3. modify PKGBUILD
source=("$pkgname::git+https://github.com/fsworld009/obs-studio#branch=projector-patches
  1. run makepkg -s to build package
  2. run sudo pacman -U obs-studio-git-30.0.0.rc1-1-x86_64.pkg.tar.zst to install local package
    1. Run install again if it's replaced after package upgrades

Got this error

CMake Error at CMakeLists.txt:46 (project):
VERSION "20230815.projector.patches" format invalid.

So I rebased (no conflict), and retagged from 30.0.0-rc1.

Drag to move in frameless window doesn't work without passing xcb flag obs -platform xcb

Update 2024/02/12

Rebased projector-patches from latest master and tried to rebuild, but got this error:

CMake Error at /usr/share/cmake/Modules/WriteBasicConfigVersionFile.cmake:43 (message):
  No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakePackageConfigHelpers.cmake:239 (write_basic_config_version_file)
  cmake/Modules/ObsHelpers.cmake:269 (write_basic_package_version_file)
  cmake/Modules/ObsHelpers_Linux.cmake:13 (_export_target)
  libobs/cmake/legacy.cmake:502 (export_target)
  cmake/Modules/ObsHelpers.cmake:473 (include)
  libobs/CMakeLists.txt:3 (legacy_check)

Need to push latest tag to my repo

# In my local folder, `upstream` pointss to obs-studio/obs-studio repo and `origin` points to fsworld009/obs-studio
git fetch --tags upstream
git push origin 30.1.0-beta1 

Also, patch pkgver() in PKBBUILD so that 30.1.0 is used as version number (currently the script would only detect 30.0.2 due to 30.1.0 tag has -beta1 in the end):

pkgver() {
  cd "$pkgname"
  _version="30.1.0-beta1"
  _revision=$(git rev-list --count $_version..HEAD)
  _hash=$(git rev-parse --short=7 HEAD)
  printf '%s.r%s.g%s' "30.1.0" "${_revision:?}" "${_hash:?}"
}

Updated 2024/06/02

Changed to Portable mode build

However, it still relies on dependencies from pacman to build & run

Hence, it's necessary to install obs-studio-git first to get all build dependencies before doing portable build.

Plugins for Portable build:

  1. Plugins manually added to ~/.config/obs-studio/ will still work
  2. For obs-vkcapture
    1. Build from source then move to path/to/obs-studio-portable/obs-plugins/64bit/
    2. Manually copied from /usr/lib/obs-plugins/linux-vkcapture.so if you have AUR package installed
    3. However for actual capturing you still need the following packages
      1. https://aur.archlinux.org/packages/obs-vkcapture
      2. https://aur.archlinux.org/packages/lib32-obs-vkcapture for 32-bit games
      3. https://github.com/flathub/org.freedesktop.Platform.VulkanLayer.OBSVkCapture for Flatpak games

Useful env vars: OBS_VKCAPTURE_QUIET=0 VK_LOADER_DEBUG=all

Reinstall obs-studio-git:

Currently need to clone https://aur.archlinux.org/packages/ffnvcodec-headers-12-1 and manually update PKGBUILD

provides=("ffnvcodec-headers=${pkgver}")

Then makepkg -s to build and sudo pacman -U ....tsz to install this, then obs-studio-git install will succeed with this dependency.

2023/10/23

Thinking about using timeshift but it won't work with current btrfs subvolume mapping https://www.reddit.com/r/Fedora/comments/uopp33/timeshift_doesnt_let_me_select_btrfs_snapshot/

2023/10/24

❯ sudo pacman -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 multilib is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing ki18n5 (5.111.0-1) breaks dependency 'ki18n' required by diskmonitor
:: installing kiconthemes5 (5.111.0-1) breaks dependency 'kiconthemes' required by diskmonitor
:: installing knotifications5 (5.111.0-1) breaks dependency 'knotifications' required by diskmonitor
:: installing kxmlgui5 (5.111.0-1) breaks dependency 'kxmlgui' required by diskmonitor
:: installing plasma-framework5 (5.111.0-1) breaks dependency 'plasma-framework' required by diskmonitor

Remove diskmonitor then reupgrade

maybe related topic: https://bbs.archlinux.org/viewtopic.php?id=289694

2023/10/28

Relax the rule to lock out 10 mins after 3 login fails

https://wiki.archlinux.org/title/security#Lock_out_user_after_three_failed_login_attempts deny = 5 unlock_time = 10

Steam now allows install games without chaging capability layer

It could be

  1. client update
  2. Proton is installed after selecting capability one game
  3. I have run client gamepadui mode with steamos flag once

Cannot power off disks after umount

❯ sudo hdparm -Y /dev/sdb

/dev/sdb:
 issuing sleep command
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

❯ udisksctl power-off -b /dev/sdb
Error powering off drive: Error opening /dev/sdb for fsync: Device or resource busy (udisks-error-quark, 0)

Workaround: put computer to sleep so disks are poered off, unplug it while it's in sleep

2023/10/28

System won't boot, reason unknown (didn't do any system upgrade or package install)

Reverted system from previous snapshot and also fixed subvolume name (@root -> @) so I can use timeshift. Snapshots are read-only subvolumes, so the idea of revert is to change to mount root as the backup subvolume on boot.

Prepare Arch linux live USB disk from another computer

# Unlock and mount root volume
cryptsetup open /dev/disk/by-partlabel/cryptsystem system
mount -t btrfs -o x-mount.mkdir LABEL=system /mnt

# Remove rw from snapshot and move to `/@`:
cd /mnt
btrfs property set -ts ./@snapshots/(snapshot-name) ro false
mv ./@snapshots/(snapshot-name) ./@

# List subvol ids and edit /etc/fstab to mount the new subvol and subvolid
btrfs subvolume list /mnt

For this revert specifically, because I changed subvol name I need to rebuild boot image to mount it:

mount -t btrfs -o defaults,x-mount.mkdir,compress=zstd,ssd,noatime,subvol=@root LABEL=system /mnt2
mount LABEL=EFI /mnt2/efi
arch-chroot /mnt2
mkinitcpio -p linux
exit

Ref: https://www.reddit.com/r/archlinux/comments/r17a8i/messed_up_my_build_need_to_restore_from_btrfs/

Although timeshift still didn't work with this partition.

Possible improvements:

  1. Should probably make a copy for revert instead of mv directly
  2. Maybe we should remove subvolid from fstab
  3. Fix virtual console on boot so it's possible to check boot log

Fix virtual console setup failure attempts

According to https://wiki.archlinux.org/title/mkinitcpio#HOOKS I should have added sd-vconsole to hooks, but that didn't fix it.

systemctl status systemd-vconsole-setup.service


 systemd-vconsole-setup.service - Virtual Console Setup
     Loaded: loaded (/usr/lib/systemd/system/systemd-vconsole-setup.service; static)
     Active: active (exited) since Sat 2023-10-28 22:20:53 CST; 35s ago
       Docs: man:systemd-vconsole-setup.service(8)
             man:vconsole.conf(5)
    Process: 1040 ExecStart=/usr/lib/systemd/systemd-vconsole-setup (code=exited, status=0/SUCCESS)
   Main PID: 1040 (code=exited, status=0/SUCCESS)
        CPU: 21ms

Oct 28 22:20:53 fsworld009-archlinux systemd[1]: Starting Virtual Console Setup...
Oct 28 22:20:53 fsworld009-archlinux systemd-vconsole-setup[1040]: KD_FONT_OP_GET failed while trying to get the font metadata: Invalid argument
Oct 28 22:20:53 fsworld009-archlinux systemd-vconsole-setup[1040]: Fonts will not be copied to remaining consoles
Oct 28 22:20:53 fsworld009-archlinux systemd[1]: Finished Virtual Console Setup.

Boot log: journalctl -xb observed same output as the systend log

Related article about this bug: https://bbs.archlinuxcn.org/viewtopic.php?id=13563 https://forum.endeavouros.com/t/systemd-vconsole-setup-service-fails-on-boot/34134/5?page=2

None of the solution works at the time of writing.

2023/11/01

security delete a fiile

https://www.geeksforgeeks.org/ways-to-permanently-and-securely-delete-files-and-directories-in-linux/

recurrsiively delete all files in a folder

https://unix.stackexchange.com/a/27029

find /path/to/folder -type f -exec shred -zvu -n 5 {} \;

2023/11/06

After system upgrades today, the Virtual Console setup failure error is gone, not sure what fixed it.

Here's the current /etc/mkinitcpio.conf

MODULES=(i915)
HOOKS=(base systemd plymouth modconf keyboard sd-vconsole block filesystems btrfs sd-encrypt resume fsck)

current `/etc/vconsole.conf

# This is the fallback vconsole configuration provided by systemd.

KEYMAP=us
#FONT=lat9w-16

2023/11/08

Downgrade flatpak packages https://itsfoss.com/downgrade-flatpak-packages/

Spotify: fix blank rendering

flatpak --user update --commit=bb7db9a54eabf67432c600af7d942997f569570cc10ebe7e9caf50060749e234 com.spotify.Client

Note: not sure how user or system installation was determined, on my GPD Win4 it was installed via system so need sudo without --user flag.

Brave: Fix offset minimize/maximize/close button

sudo flatpak update --commit=21e5a1e980bfb25e329f69f39ce91e6c76ff5756e3969a35f3d90b8c65665cdf com.brave.Browser

2023/11/26

fcitx5 breaks on most apps again, reason unknown. Switched to system fcitx5.

  1. Unselect fcitx5 in Settings -> Inp[ut Devices Virtual Keyboard
  2. Exit and uninstall flatpak fcitx5 and all IMEs
  3. sudo pacman -S fcitx5-im fcitx5-mozc
    sudo aura -A fcitx5-mcbopomofo-git
    fcitx5
    
  4. Select fcitx5 again in Settings -> Virtual Keyboard
  5. Run fcitx5-configtool or go to settings -> Regional Settings -> Input Method to configure fcitx5

Ref: https://ivonblog.com/posts/install-archlinux/ https://wiki.archlinux.org/title/Fcitx5#Configuration

Note: still don't set GTK_IM_MODULE or QT_IM_MODULE env var

GTK apps font look weird

https://www.reddit.com/r/kde/comments/ubk9ag/fonts_in_gtk_apps_are_very_blocky/

Install xdg-desktop-portal-gtk and restart.

Note: this is not installed in my EndeavourOS setup but the font works well there

Screenshot_20231126_215403 Screenshot_20231126_215156

2023/11/27

Moved to Framework 13 (AMD 7840U)

Need to re-add UEFI entry, use Arch live env disk

efibootmgr --create --disk /dev/nvme0n1 --part 1 --label "Arch Linux" --loader '\EFI\Linux\arch-linux.efi' --unicode

https://wiki.archlinux.org/title/Unified_kernel_image#Directly_from_UEFI

A better solution?

This is because by default UEFI looks for specific path in partition

EFI\boot\bootX64.efi

https://www.dell.com/support/kbdoc/zh-tw/000138085/%E5%8F%AF%E9%96%8B%E6%A9%9F-%E8%A3%9D%E7%BD%AE-%E5%A6%82%E4%BD%95-%E5%9C%A8-uefi-%E9%96%8B%E6%A9%9F-%E6%A8%A1%E5%BC%8F-%E4%B8%8B-%E9%81%8B%E4%BD%9C

Seems like I could edit /etc/mkinitcpio.d/linux.preset to change efi output location

default_uki="/efi/EFI/Linux/arch-linux.efi"

https://bbs.archlinux.org/viewtopic.php?id=290277

But upon on checking the UEFI Boot entry in my GPR WIN 4 setup

Boot0000* Linux Boot Manager    HD(4,GPT,****)/File(\EFI\systemd\systemd-bootx64.efi)

I suppose it's a common practice to add boot entries to UEFI for Linux installations

2023/12/01

Nuphy Air75 Fn key not working, soluition: https://www.reddit.com/r/MechanicalKeyboards/comments/tgjvp2/nuphy_air75_on_linux_issues_with_fn/

This only happens in Win mode, bluetooth connection for me.

2023/12/03

Better pipewire configuration to reduce GC553 latency

default.clock.quantum     = 512 
default.clock.max-quantum = 512 

Seems geting rid of random audio cracks compared to previous changes.

2023/12/20

Flatpak Spotify not rendering anything

Based on other people's solution in store review page

rm -rf ~/.var/app/com.spotify.Client/cache/

aura

https://fosskers.github.io/aura/aur.html

==> ERROR: A package has already been built. (use -f to overwrite) add --force

plymouth-git

+ exec meson setup --prefix /usr --libexecdir lib --sbindir bin --buildtype plain --auto-features enabled --wrap-mode nodownload -D b_lto=true -D b_pie=true -D python.bytecompile=1 plymouth build -D logo=/usr/share/pixmaps/archlinux-logo.png -D background-color=0x000000 -D background-start-color-stop=0x000000 -D background-end-color-stop=0x4D4D4D
Directory already configured.

Just run your build command (e.g. ninja) and Meson will regenerate as necessary.
Run "meson setup --reconfigure to force Meson to regenerate.

If build failures persist, run "meson setup --wipe" to rebuild from scratch
using the same options as passed when configuring the build.

ERROR: Build data file '/var/cache/aura/vcs/plymouth-git/plymouth-git/src/build/meson-private/build.dat' references functions or classes that don't exist. This probably means that it was generated with an old version of meson. Consider reconfiguring the directory with "meson setup --reconfigure".
==> ERROR: A failure occurred in build().
    Aborting...
aura >>= There was a makepkg failure.
aura >>= Would you like to continue anyway? [Y/n] 
aura >>= Every package failed to build.

No solution yet

2024/01/12

Format a luks+btrfs disk

Use KDE Partition manager to create luks+btrfs

When first mounted in Dolphin, need to fix chown:

sudo chown fsworld009:fsworld009 /run/media/fsworld009/me/

Ref: https://forum.manjaro.org/t/unable-to-write-to-a-1tb-luks-encrypted-hdd-drive/113390

Backup btrfs home subvolume before formatting the disk

https://forum.manjaro.org/t/how-to-clone-btrfs/134143/9

I/O speed is kinda slow, even with a USB type C SSD.

sudo btrfs subvolume snapshot -r /home/ /.snapshots/home-bk
❯ sudo sudo btrfs send /.snapshots/home-bk | sudo btrfs receive /run/media/fsworld009/me/
At subvol /.snapshots/home-bk
At subvol home-bk

media/fsworld009/me took 1h27m18s 

subvolume size was ~630GB.

End of this diary

I've decided to reinstall the system with EndeavourOS, so will not update this note anymore.

Future update to EndeavourOS or general Arch linux usage goes to https://gist.github.com/fsworld009/0a7240c4eab9254aca3f7a334acc1aa9

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