This will set up a cage kiosk in a Vagrant VM. It should work on a real Debian 12 machine aswell.
Vagrantfile for the VM:
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
# Customize the amount of memory on the VM:
libvirt.memory = "2048"
end
end
Bring the vm up with vagrant up and login with vagrant ssh. Then execute the following from the shell.
Add user:
sudo adduser *user*
Add user to groups video, audio, sudo:
sudo gpasswd -a *user* video
sudo gpassws -a *user* audio
sudo gpassws -a *user* sudo
Install some stuff that is needed or nice to have.
sudo apt install mc htop cage chromium xwayland seatd sway
/etc/systemd/system/[email protected]:
# This is a system unit for launching Cage with auto-login as the
# user configured here. For this to work, wlroots must be built
# with systemd logind support.
[Unit]
Description=Cage Wayland compositor on %I
# Make sure we are started after logins are permitted. If Plymouth is
# used, we want to start when it is on its way out.
After=systemd-user-sessions.service plymouth-quit-wait.service
# Since we are part of the graphical session, make sure we are started
# before it is complete.
Before=graphical.target
# On systems without virtual consoles, do not start.
ConditionPathExists=/dev/tty0
# D-Bus is necessary for contacting logind, which is required.
Wants=dbus.socket systemd-logind.service
After=dbus.socket systemd-logind.service
# Replace any (a)getty that may have spawned, since we log in
# automatically.
Conflicts=getty@%i.service
After=getty@%i.service
[Service]
Type=simple
ExecStart=/usr/bin/cage -- /usr/bin/chromium --noerrdialogs --disable-infobars --no-first-run --start-maximized --kiosk "https://192.168.0.7:8123"
#ExecStartPost=+sh -c "tty_name='%i'; exec chvt $${tty_name#tty}"
Restart=always
User=
# Log this user with utmp, letting it show up with commands 'w' and
# 'who'. This is needed since we replace (a)getty.
UtmpIdentifier=%I
UtmpMode=user
# A virtual terminal is needed.
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
# Fail to start if not controlling the virtual terminal.
StandardInput=tty-fail
# Set up a full (custom) user session for the user, required by Cage.
PAMName=cage
[Install]
WantedBy=graphical.target
#Alias=display-manager.service
DefaultInstance=tty7
/etc/pam.d/cage:
auth required pam_unix.so nullok
account required pam_unix.so
session required pam_unix.so
session required pam_systemd.so
systemctl enable [email protected]
systemctl set-default graphical.target