T2SDE - hpaluch/hpaluch.github.io GitHub Wiki

T2 SDE Linux

By chance - finding YT video about Wayland issues with VirGL TESTED: Qemu VirGL - what could possibly go wrong? OpenSource Mesa 3D I found T2 Linux.

Personally I see it as something between Arch (binary packages) and Gentoo (build from source) and Buildroot (custom build system based on Bash). There are some unique features (cross-building on other system etc...)

Homepage: https://t2sde.org/ - please read T2 description there.

Download:

  • go to: https://dl.t2sde.org/binary/2025/

  • in my case I downloaded:

    curl -fLO https://dl.t2sde.org/binary/2025/t2-25.1-x86-64-base-wayland-glibc-gcc-nocona.sha256
    curl -fLO https://dl.t2sde.org/binary/2025/t2-25.1-x86-64-base-wayland-glibc-gcc-nocona.iso
    sha256sum -c t2-25.1-x86-64-base-wayland-glibc-gcc-nocona.sha256
    

Installation:

[!WARNING]

I encountered error when installing GRUB - it looks for weird target i386-ieee1275 while correct is i386-pc. To fix it I did:

NOTE: It will reboot using kexec (Kernel Exec) mechanism to installed system, however kexec was never designed for that (kexec purpose is to on main kernel crash just boot another "safe" kernel to dump crashed kernel and halt). So I recommend to do full reboot later.

Example creating user user:

useradd -m -G wheel,kvm,video,audio -s /bin/bash user
passwd user

Building and installing additional packages

# I start as non-privileged user 'user'
mkdir -p ~/projects
cd ~/projects
svn co https://svn.exactcode.de/t2/trunk t2-trunk
cd t2-trunk/
su # enter root's password

# now run these commands as root:
./t2 config  # you can keep defaults and exit
./t2 find btop
./t2 install btop

# finally try to run 'btop' command...

If you selected 'Full installyou can also run sway (your user must be in groupvideoto proceed). Just typesway`. Most important commands:

  • Win+ENTER - runs terminal
  • Win+NUMBER - switch (or create and switch) to workspace NUMBER
  • Win+Arrows - focus to other Window in arrow direction
  • Win+S Win+W Win+E - will switch differnet Windows layouts
  • Win+Shift+E - Exit (must confirm Yellow mesage at the top to exit)

Notes

Non-privileged user does not see processes of other users - so you have to run top or btop as root to see all processes.

Editing run-levels: example for acpid service:

# run as root:
stone runlevel edit_srv acpid

Installing on BTRFS sub-volume

Defult installer handles propelry only BTRFS root target, but not subvolume (I use one big BTRFS partition where each OS is installed into subvolume - in my example T2 Linux is installed into T2-ROOT subvolume).

First you need to properly create and remount BTRFS before install (use shell on other terminal of installation CD):

mkfs.btrfs /dev/vdaX
mount /dev/vdaX /mnt
cd /mnt
btrfs su cr T2-ROOT
cd /
umount /mnt
mount -o subvol=T2-ROOT /dev/vdaX /mnt

Now run install and simply skip fdisk part (it will detect that /mnt is mounted and will proceed with installation).

At grub stage you have to use above workaround to install it:

chroot /mnt /usr/sbin/grub2-install --target i386-pc /dev/vda

After reboot, initrd will drop into shell, because it will mount Top of BTRFS (not subvolume). To continue boot you need to this in initrd shell:

umount /mnt
mount -o subvol=T2-ROOT -t btrfs /dev/vdaX /mnt
mount -t none -o move {,/mnt}/dev
mount -t none -o move {,/mnt}/sys
mount -t none -o move {,/mnt}/proc
exec switch_root /mnt /sbin/init

System should continue boot - but we need to fix ramdisk and grub config: To fix ramdisk do this:

Installing on BTRFS sub-volume: fix variant A

We can now (since 2024-02-26) use latest SVN repository with enhancement - support for rootflags= parameter:

cd /root
svn co https://svn.exactcode.de/t2/trunk t2-trunk
cd t2-trunk/
svn diff -c r74424 # show fix
./t2 install -force mkinitrd
./t2 install ipconfig # Oops! missing required dependency
/sbin/mkinitrd

Example /boot/grub/grub.cfg entry:

# ... grub header omitted ...
menuentry "T2/Linux" {
	linux /T2-ROOT/boot/vmlinuz root=/dev/disk/by-uuid/KEEP_YOUR_ORIGINAL_DISK_UUID ro rootflags=subvol=T2-ROOT
	initrd /T2-ROOT/boot/initrd
}

Installing on BTRFS sub-volume: fix variant B

Deprecated - without checkout of SVN repo:

  • unpack ramdisk:
    cd /root
    mkdir u
    cd u
    zstdcat /boot/initrd | cpio -ivm
    
  • now apply this patch to /root/u/init:
--- init.orig	2025-02-26 16:38:07.259999994 +0100
+++ init	2025-02-26 17:32:55.000459997 +0100
@@ -48,6 +48,7 @@
 
 # get the root device, init, early swap
 [ -e /proc/cmdline ] && cmdline="$(< /proc/cmdline)"
+rootflags="rootflags= $cmdline" rootflags=${rootflags##*rootflags=} rootflags=${rootflags%% *}
 root="root= $cmdline" root=${root##*root=} root=${root%% *}
 init="init= $cmdline" init=${init##*init=} init=${init%% *}
 swap="swap= $cmdline" swap=${swap##*swap=} swap=${swap%% *}
@@ -62,6 +63,8 @@
     esac
 done
 
+[ -n "$rootflags" ] && mountopt="$rootflags"
+
 # diskless network root?
 addr="${root%:*}"
 if [ "$addr" != "$root" -o "${addr%%,*}" = "/dev/nfs" ]; then

Basically we will allow passing rootflags as mount options.

Now create new ramdisk:

cd /root/u
find . | cpio -ov -H crc > ../initrd2
cd ..
zstdmt initrd2
cp initrd2.zst /boot

Finally you have to edit your /boot/grub/grub.cfg and in menuentry add subvolume name (in my case T2-ROOT) in 3 places:

# ... grub header omitted ...
menuentry "T2/Linux" {
	linux /T2-ROOT/boot/vmlinuz root=/dev/disk/by-uuid/KEEP_YOUR_ORIGINAL_DISK_UUID ro rootflags=subvol=T2-ROOT
	initrd /T2-ROOT/boot/initrd2.zst
}

Notice that I used temporarily different path to initrd (ending with initrd2.zst).

Finally reboot - it should work.