SPS · log · files · refs · tags · releases · people · languages · GitHub · commit
ccc6184
mkiso: start Plasma against DRM instead of a missing Wayland display
Parents
Stat
bin/mkiso | 26 ++++++++++++++++++++++++-- lib/mkiso/live-plasma | 31 ++++++++++++++++++++++++++++++- lib/mkiso/live-rc | 5 ++++- lib/mkiso/plasma-bins | 3 +++ lib/mkiso/plasma-trees | 7 +++++++ lib/setup/sets/power.set | 2 ++ tests/test_mkiso.sh | 24 ++++++++++++++++++++++++ tests/test_setup.sh | 10 ++++++++++ 8 files changed, 104 insertions(+), 4 deletions(-)
Diff
diff --git a/bin/mkiso b/bin/mkiso
index ac02cc2..f344ea4 100755
--- a/bin/mkiso
+++ b/bin/mkiso
@@ -503,13 +503,27 @@ mkiso_copy_plasma()
for mkiso_pat in /usr/lib64/libQt6*.so* /usr/lib64/libKF6*.so* \
/usr/lib64/libplasma*.so* /usr/lib64/libkwin*.so* \
/usr/lib64/libwayland*.so* /usr/lib64/libGLESv2.so* \
- /usr/lib64/libEGL.so* /usr/lib64/libGL.so*
+ /usr/lib64/libEGL.so* /usr/lib64/libGL.so* \
+ /usr/lib64/libEGL_mesa.so* /usr/lib64/libGLX_mesa.so* \
+ /usr/lib64/libgallium*.so* /usr/lib64/dri/libdril_dri.so \
+ /usr/lib64/libLLVM.so /usr/lib64/libLLVM.so.[0-9]*
do
for mkiso_so in $mkiso_pat; do
[ -e "$mkiso_so" ] || continue
+ # Skip the rust-wrapped LLVM; the Mesa DRI stack uses libLLVM.so.*
+ case $mkiso_so in
+ *-rust*) continue ;;
+ esac
mkiso_copy_path "$mkiso_so"
done
done
+ # Full /usr/share/fonts/TTF is hundreds of megabytes. DejaVu is enough
+ # for fontconfig's default aliases on the live session.
+ for mkiso_font in /usr/share/fonts/TTF/DejaVu*.ttf
+ do
+ [ -e "$mkiso_font" ] || continue
+ mkiso_copy_path "$mkiso_font"
+ done
# Host /etc/dbus-1 may already contain system-local.conf. live-plasma
# used to skip the root-user override when that file existed, which
# left dbus-daemon --system looking for a messagebus account the live
@@ -686,7 +700,15 @@ printf '%s\n' live >"$mkiso_live/etc/sps/live"
printf '%s\n' splux-live >"$mkiso_live/etc/hostname"
mkiso_stamp_os_release
printf '%s\n' 'root:x:0:0:root:/root:/bin/sh' >"$mkiso_live/etc/passwd"
-printf '%s\n' 'root:x:0:' >"$mkiso_live/etc/group"
+printf '%s\n' \
+ 'root:x:0:' \
+ 'tty:x:5:' \
+ 'disk:x:6:' \
+ 'audio:x:17:' \
+ 'video:x:18:root' \
+ 'input:x:71:root' \
+ 'render:x:107:root' \
+ >"$mkiso_live/etc/group"
# Empty password on the live console only.
printf '%s\n' 'root::0:0:99999:7:::' >"$mkiso_live/etc/shadow"
chmod 600 "$mkiso_live/etc/shadow"
diff --git a/lib/mkiso/live-plasma b/lib/mkiso/live-plasma
index 4ebb2f8..50531b1 100644
--- a/lib/mkiso/live-plasma
+++ b/lib/mkiso/live-plasma
@@ -8,10 +8,20 @@ export PATH
export HOME=/root
export XDG_RUNTIME_DIR=/run/user/0
export XDG_SESSION_TYPE=wayland
-export QT_QPA_PLATFORM=wayland
+export XDG_SESSION_CLASS=user
+export XDG_SESSION_DESKTOP=KDE
+export DESKTOP_SESSION=plasma
export TERM=${TERM:-linux}
export LANG=${LANG:-C.UTF-8}
export LC_ALL=${LC_ALL:-C.UTF-8}
+export FONTCONFIG_PATH=/etc/fonts
+export QT_PLUGIN_PATH=/usr/lib64/qt6/plugins
+export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib64/qt6/plugins/platforms
+export QML2_IMPORT_PATH=/usr/lib64/qt6/qml
+# KWin is the compositor. QT_QPA_PLATFORM=wayland makes Qt try to
+# connect to a display that does not exist yet, so kwin_wayland dies
+# with "Failed to create wl_display" and plasmashell follows.
+unset QT_QPA_PLATFORM
mkdir -p "$XDG_RUNTIME_DIR" /run/dbus /var/lib/dbus /etc/dbus-1 \
/root/.config/kdedefaults
@@ -28,6 +38,9 @@ fi
# Live NVIDIA is nouveau. Keep the proprietary stack unloaded.
modprobe nouveau 2>/dev/null || :
+for mod in virtio_gpu virtio_dma_buf bochs cirrus_qemu qxl vmwgfx; do
+ modprobe "$mod" 2>/dev/null || :
+done
if [ ! -e /var/run ]; then
mkdir -p /var
@@ -86,6 +99,22 @@ if command -v seatd >/dev/null 2>&1; then
sleep 1
fi
+# kwin_wayland needs a KMS node. live-rc loads virtio_gpu/bochs/qxl;
+# wait here so Plasma does not race the first DRM probe.
+n=0
+while [ "$n" -lt 10 ]; do
+ if [ -e /dev/dri/card0 ] || [ -e /dev/dri/card1 ]; then
+ break
+ fi
+ n=$((n + 1))
+ sleep 1
+done
+if [ ! -e /dev/dri/card0 ] && [ ! -e /dev/dri/card1 ]; then
+ printf '%s\n' "SPS: no /dev/dri/card0; KWin cannot start a compositor."
+ printf '%s\n' "SPS: use tty2 (Ctrl-Alt-F2) for a shell."
+ ls /dev/dri 2>/dev/null || :
+fi
+
if command -v startplasma-wayland >/dev/null 2>&1; then
# Give the user a console they can see if Wayland dies.
chvt 1 2>/dev/null || :
diff --git a/lib/mkiso/live-rc b/lib/mkiso/live-rc
index aebfeea..d33e1c5 100644
--- a/lib/mkiso/live-rc
+++ b/lib/mkiso/live-rc
@@ -61,9 +61,12 @@ fi
if [ -d /lib/modules ] && command -v depmod >/dev/null 2>&1; then
depmod -a 2>/dev/null || :
fi
+# QEMU/virt-manager usually presents virtio-gpu, stdvga (bochs), qxl,
+# or cirrus. KWin needs a DRM node; nouveau/bochs alone is not enough.
for mod in e1000 e1000e r8169 virtio_net virtio_blk virtio_pci virtio_scsi \
usbnet hid-generic usbhid atkbd \
- nouveau bochs drm_kms_helper
+ drm drm_kms_helper drm_ttm_helper ttm virtio_dma_buf virtio_gpu \
+ nouveau bochs cirrus_qemu qxl vmwgfx i915 amdgpu
do
modprobe "$mod" 2>/dev/null || :
done
diff --git a/lib/mkiso/plasma-bins b/lib/mkiso/plasma-bins
index 8586b56..35d9c98 100644
--- a/lib/mkiso/plasma-bins
+++ b/lib/mkiso/plasma-bins
@@ -18,6 +18,7 @@
/usr/bin/kded6
/usr/bin/kdeinit6
/usr/bin/kglobalacceld
+/usr/libexec/kglobalacceld
/usr/bin/kcminit
/usr/bin/kcminit_startup
/usr/bin/ksmserver
@@ -48,4 +49,6 @@
/usr/libexec/plasma-dbus-run-session-if-needed
/usr/libexec/plasma-sourceenv.sh
/usr/libexec/plasma-startup-sound
+/usr/libexec/xdg-desktop-portal
+/usr/libexec/xdg-desktop-portal-kde
diff --git a/lib/mkiso/plasma-trees b/lib/mkiso/plasma-trees
index bd40364..e29d82b 100644
--- a/lib/mkiso/plasma-trees
+++ b/lib/mkiso/plasma-trees
@@ -33,6 +33,13 @@
/usr/lib64/dri
/usr/lib/dri
/usr/lib64/gbm
+/usr/share/kwin
+/usr/share/kwin-wayland
+/etc/fonts
+/usr/share/fontconfig
+/usr/share/glvnd
+/lib/udev/rules.d
+/usr/lib/udev/rules.d
/usr/lib64/libkwin.so
/usr/libexec/kf6
/usr/libexec/kde
diff --git a/lib/setup/sets/power.set b/lib/setup/sets/power.set
index 9795350..87f2da8 100644
--- a/lib/setup/sets/power.set
+++ b/lib/setup/sets/power.set
@@ -2,6 +2,8 @@ name power
title Power management
description UPower, power-profiles-daemon, and related session helpers.
default 1
+# polkit talks to logind. The extra recipe must optional systemd/elogind;
+# a hard depend elogind makes sget refuse Plasma + systemd.
package upower
package power-profiles-daemon
package polkit
diff --git a/tests/test_mkiso.sh b/tests/test_mkiso.sh
index fc31f53..53d7b6a 100755
--- a/tests/test_mkiso.sh
+++ b/tests/test_mkiso.sh
@@ -94,6 +94,30 @@ grep -q C.UTF-8 "$layout/etc/sps/live-plasma" ||
fail 'live-plasma must set a UTF-8 locale'
grep -q kdedefaults "$layout/etc/sps/live-plasma" ||
fail 'live-plasma must seed kdedefaults for KSplash'
+if grep -q 'export QT_QPA_PLATFORM=wayland' "$layout/etc/sps/live-plasma"
+then
+ fail 'live-plasma must not force QT_QPA_PLATFORM=wayland on KWin'
+fi
+grep -q FONTCONFIG_PATH "$layout/etc/sps/live-plasma" ||
+ fail 'live-plasma must set FONTCONFIG_PATH'
+grep -q virtio_gpu "$layout/etc/sps/live-rc" ||
+ fail 'live-rc must load virtio_gpu for QEMU/virt-manager'
+grep -q cirrus_qemu "$layout/etc/sps/live-rc" ||
+ fail 'live-rc must load cirrus_qemu for QEMU stdvga fallbacks'
+grep -q /dev/dri/card0 "$layout/etc/sps/live-plasma" ||
+ fail 'live-plasma must wait for a DRM node'
+grep -q /usr/share/kwin "$project_dir/lib/mkiso/plasma-trees" ||
+ fail 'plasma-trees must include /usr/share/kwin'
+grep -q /etc/fonts "$project_dir/lib/mkiso/plasma-trees" ||
+ fail 'plasma-trees must include fontconfig'
+grep -q kglobalacceld "$project_dir/lib/mkiso/plasma-bins" ||
+ fail 'plasma-bins must include kglobalacceld'
+grep -q xdg-desktop-portal-kde "$project_dir/lib/mkiso/plasma-bins" ||
+ fail 'plasma-bins must include xdg-desktop-portal-kde'
+grep -q libgallium "$mkiso" ||
+ fail 'plasma ISO must copy Mesa libgallium'
+grep -q 'video:x:18:root' "$layout/etc/group" ||
+ fail 'live group must include video for seatd/DRM'
grep -q ksplashqml "$project_dir/lib/mkiso/plasma-bins" ||
fail 'plasma-bins must include ksplashqml'
grep -q plasma_waitforname "$project_dir/lib/mkiso/plasma-bins" ||
diff --git a/tests/test_setup.sh b/tests/test_setup.sh
index 2c75424..9348e03 100755
--- a/tests/test_setup.sh
+++ b/tests/test_setup.sh
@@ -271,6 +271,16 @@ case $plan in
*elogind*) fail 'plasma + systemd must not pull elogind' ;;
esac
+# Power is on by default for Plasma. polkit must come from that set
+# without naming elogind; sget resolves polkit's optional logind later.
+plan=$("$setup" --plan --target /mnt --profile plasma-desktop --init systemd \
+ --disable qol-cli --disable firmware)
+contains "$plan" 'polkit'
+contains "$plan" 'init-systemd'
+case $plan in
+ *elogind*) fail 'plasma + systemd + power must not list elogind' ;;
+esac
+
plan=$("$setup" --plan --target /mnt --profile plasma-desktop --init openrc \
--disable qol-cli)
contains "$plan" 'init-openrc'