Aster At NighT

I deserve a detoured journey to anywhere

0%

SteamOS is HARD to tame

Just bought a steamdeck for pure curiosity. The device surprises my in every aspect. It’s not as heavy as expected, pretty durable with tweakable TDP, with a seemingly versatile arch linux base system. However, the system is READONLY, to a degree. From as far as I’ve suffered, the /usr path is readonly, which really forbids almost all pacman packages from being installed. Which is also why I’m writing in English. I cannot install fcitx, thus no IME!!!

There indeed, is a dirty way to solve this. Which is:

1
sudo steamos-readonly disable

The command make steamos a fully writable, normal arch linux distribution. The only bad thing is, after next steamos update, everything you wrote would be reset. I would like some elegant solution to this.

The first thing that comes to me is to check what the heck is readonly at all. Let’s see what mount says.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
> mount
/dev/nvme0n1p4 on / type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=5,subvol=/)
/dev/nvme0n1p6 on /var type ext4 (rw,relatime)
overlay on /etc type overlay (rw,relatime,lowerdir=/sysroot/etc,upperdir=/sysroot/var/lib/overlays/etc/upper,workdir=/sysroot/var/lib/overlays/etc/work)
/dev/nvme0n1p8 on /home type ext4 (rw,relatime,x-systemd.growfs)
/dev/nvme0n1p8 on /opt type ext4 (rw,relatime)
/dev/nvme0n1p8 on /root type ext4 (rw,relatime)
/dev/nvme0n1p8 on /srv type ext4 (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,nr_inodes=1048576,inode64)
/dev/nvme0n1p8 on /var/cache/pacman type ext4 (rw,relatime)
/dev/nvme0n1p8 on /var/lib/docker type ext4 (rw,relatime)
/dev/nvme0n1p8 on /var/lib/flatpak type ext4 (rw,relatime)
/dev/nvme0n1p8 on /var/lib/systemd/coredump type ext4 (rw,relatime)
/dev/nvme0n1p8 on /var/log type ext4 (rw,relatime)
/dev/nvme0n1p8 on /var/tmp type ext4 (rw,relatime)
/dev/mmcblk0p1 on /run/media/mmcblk0p1 type ext4 (rw,noatime)

Ok, the /etc is overlayed so it is writable, make sense. But why / is rw?

Now according to this https://www.svenknebel.de/posts/2022/5/2/, /usr/bin/steamos-readonly is a shell script (That’s astonishing). And the readonly is a btrfs tweak, rather than a mount one.

That does not help. I suppose there leaves us to choose among a few other ways.

  1. Turn to homebrew. I saw this online and I’m not so sure why homebrew does not write to /usr. But hey homebrew is nothing related to elegant.
  2. Install everything in container. But how am I supposed to install a container runtime without writing to /usr?
  3. Use a script to automate the installations, ugly.

I’ve tested designating pacman to install packages in a separate root dir, which proves very awkward. The applications are not very friendly and without a chroot they refuse to work properly. And when they do write to writable paths (/etc for configs and services), it does not work as expected.

I guess I’ll try

  1. Use a overlay fs to mimic a writable root.

And here comes https://github.com/ValShaped/rwfus. Which seems to work. Let’s see now if I can use Rime.

God damn it no! When I last installed Rime /usr was readonly, and pacman supposed the installation is successful! fcitx-diagnose gives lots of unfounded dependencies, now I have to reinstall them all, one by one.

And after everything done fcitx5 still does not seem to work properly. The pinyin IME just does not work with no prompts and Rime said an error occured and I should check /tmp/rime.fcitx.ERROR, while there is no such file! There is one post discussing such problem https://forum.suse.org.cn/t/topic/14534, but it seems to be a packing bug rather than a program one. At this point I have no idea how to fix that.

好吧,尝试了一下discover里面的fcitx和rime,完全能用!居然最后靠谱的是应用商店。将 /home/deck/.local/share/fcitx5/rime/build/luna_pinyin.schema.yaml 中的设置改为默认简体后就没有什么问题了。

插曲:在编译yay时,不知是否是之前安装gcc /usr 的写入权限有问题,c标准头文件全都没了。重新安装gcc也不解决问题。我从之前那个chroot版pacman里面拷了一份出来,意外地用起来毫无问题。

总结一下,拿到 steamos 首先先解决只读文件系统的问题,不要直接用 pacman 装东西,不然就会因为 /etc 能写而装进去了,但因为 /usr 不能写而没完全装进去。