适用于原生面板方向为竖屏、实际以横屏使用的 GPD Pocket 4。本文解决以下阶段方向不一致的问题:
- Plasma Login Manager 登录界面;
- 登录后的 Plasma Wayland 桌面与触摸;
已验证环境
本方案于 2026-08-01 在以下组合上完成实机验证:
- GPD Pocket 4,硬件型号
G1628-04-L; - Plasma Login Manager
6.7.3-1;
不同安装方式的文件路径可能不同。执行修改前,应先确认自己的启动结构,不要照抄磁盘 UUID、分区路径或其他机器的完整 kernel command line。
核心结论:这些画面由不同组件控制
| 显示阶段 | 控制者 | 本机解决方法 |
|---|---|---|
| GPD BIOS Logo | UEFI 固件 | 操作系统无法控制 |
| Limine 菜单 | Limine | `interface_rotation: 90` |
| UKI Arch Linux Logo | systemd-stub / UKI splash | 取消 `--splash` |
| 启动文字与 LUKS 提示 | Linux framebuffer console | `fbcon=rotate:1` |
| Plasma 登录界面 | `plasma-login-manager` 的独立 KWin 会话 | 同步正确的 `kwinoutputconfig.json` |
| 登录后的桌面 | 当前用户的 KWin 输出配置 | 在 Plasma 显示设置中调整 |
| 桌面自动旋转 | `mxc4005` + `iio-sensor-proxy` + KWin | 启用 KWin `autoRotatePolicy` |
Linux 内核文档明确指出,`fbcon=rotate` **只旋转 framebuffer console**,不会旋转其他直接使用 framebuffer 的程序。因此,不可能用一个参数同时修复 Limine、UKI splash、登录管理器和桌面。
0. 修改前检查
先确认实际环境:
```bash
cat /etc/os-release
uname -r
pacman -Q limine plasma-login-manager plasma-workspace kwin
readlink -f /etc/systemd/system/display-manager.service
findmnt /boot
sudo find /boot -maxdepth 4 -type f -name limine.conf -print
```
本文实机使用的 Limine 配置路径是:
```text
/boot/EFI/BOOT/limine.conf
```
Limine 在 UEFI 下会优先读取 EFI 程序旁边的 `limine.conf`。如果机器上有多个同名配置,必须先确认实际生效的是哪一个。
如果启用了 Secure Boot 或 UKI 签名,不要直接照搬重建步骤;必须先确认现有的自动签名流程会在 `mkinitcpio` 后重新签名 UKI。
1. 先把登录后的 Plasma 桌面调成正确横屏
进入:
```text
System Settings → Display & Monitor → Display Configuration
```
把内屏调到肉眼正确的横屏方向,应用并保存。建议先断开外接显示器,避免把临时的多屏布局同步到登录界面。
检查当前输出:
```bash
kscreen-doctor -o
sed -n '1,260p' ~/.config/kwinoutputconfig.json
```
本次实机的关键字段为:
```json
"connectorName": "eDP-1",
"scale": 2.3,
"transform": "Rotated270"
```
不要机械照抄 `Rotated270` 或缩放倍率;应使用自己在 Plasma 中已经验证正确的配置。
2. 旋转 Limine 菜单
先备份实际生效的配置:
```bash
sudo cp -a /boot/EFI/BOOT/limine.conf /boot/EFI/BOOT/limine.conf.bak-before-rotation
sudoedit /boot/EFI/BOOT/limine.conf
```
在全局配置区域加入:
```text
interface_rotation: 90
```
示例:
```text
interface_rotation: 90
timeout: 5
```
如果重启后方向相反,将 `90` 改为 `270`。该设置只影响 Limine 自己的菜单和终端,不影响 Linux 或 Plasma。
修改 `limine.conf` 后不需要运行 `mkinitcpio`。
3. 旋转启动文字与 LUKS 解锁界面
Linux 的旋转值含义为:
可以先在当前内核临时测试:
```bash
echo 1 | sudo tee /sys/class/graphics/fbcon/rotate_all
```
该命令只影响当前启动,不会永久写入配置。若 `1` 的方向正确,再做持久化。
3.1 修改 UKI 的 kernel command line 来源
先备份:
```bash
sudo cp -a /etc/kernel/cmdline /etc/kernel/cmdline.bak-before-rotation
sudoedit /etc/kernel/cmdline
```
在原有参数的**同一行末尾**追加:
```text
fbcon=rotate:1
```
不要删除或改写原来的 LUKS、root、Btrfs 等参数。
3.2 检查 Limine 是否重复提供了cmdline:
```bash
sudo grep -n 'cmdline:' /boot/EFI/BOOT/limine.conf
```
如果每个 UKI 启动项都含有 `cmdline:`,在每一条现有参数末尾也追加:
```text
fbcon=rotate:1
```
本次 Archinstall 生成的 Limine 配置同时使用了 UKI 内嵌 command line 和 Limine `cmdline:`,所以两处都进行了检查。
暂时不要重启;完成下一节后统一重建 UKI。
4. 取消竖屏 UKI Arch Linux Logo
本次环境没有安装 Plymouth。竖屏 Arch Logo 来自 mkinitcpio preset 中传给 UKI 的:
```text
--splash /usr/share/systemd/bootctl/splash-arch.bmp
```
先检查:
```bash
grep -HnE 'splash|uki' /etc/mkinitcpio.d/*.preset
```
对实际存在的 preset 逐一备份,例如:
```bash
sudo cp -a /etc/mkinitcpio.d/linux.preset /etc/mkinitcpio.d/linux.preset.bak-before-rotation
sudo cp -a /etc/mkinitcpio.d/linux-lts.preset /etc/mkinitcpio.d/linux-lts.preset.bak-before-rotation
```
编辑:
```bash
sudoedit /etc/mkinitcpio.d/linux.preset
sudoedit /etc/mkinitcpio.d/linux-lts.preset
```
将:
```text
default_options="--splash /usr/share/systemd/bootctl/splash-arch.bmp"
```
改成:
```text
default_options=""
```
如果只安装了一个 kernel,就只修改对应的 preset。不要删除系统自带的 BMP 文件;取消引用即可,方便以后恢复。
现在重建全部已安装 kernel 的 initramfs / UKI:
```bash
sudo mkinitcpio -P
```
必须看到每个实际使用的 UKI 都出现类似结果:
```text
Unified kernel image generation successful
```
若重建报错,不要重启,先恢复备份或解决错误。本次 AMD 机器出现的单独一条 `Possibly missing firmware for module: qat_6xxx` 警告与 Intel QAT 设备有关;在其余生成步骤均成功的前提下,不影响本机启动。不要把其他 firmware 或生成错误一概忽略。
5. 让 Plasma Login Manager 使用正确横屏配置
Plasma Login Manager 使用独立的 `plasmalogin` 账户和独立 KWin 会话,不会自动继承普通用户的显示设置。
推荐方式:使用官方图形界面同步
打开:
```text
System Settings → Colors & Themes → Login Screen
```
点击:
```text
Apply Plasma Settings… → Apply
```
输入本机管理员密码。Plasma Login Manager 6.7.3 的官方实现会同步屏幕配置、输入配置、字体、主题和键盘布局等项目。
精确方式:只同步屏幕配置
如果只想改变登录页的屏幕方向,不同步主题等设置:
```bash
sudo install -d -m 0755 -o plasmalogin -g plasmalogin /var/lib/plasmalogin/.config
sudo install -m 0644 -o plasmalogin -g plasmalogin \
"$HOME/.config/kwinoutputconfig.json" \
/var/lib/plasmalogin/.config/kwinoutputconfig.json
```
验证:
```bash
sudo stat -c '%a %U:%G %n' /var/lib/plasmalogin/.config/kwinoutputconfig.json
sudo grep -E '"connectorName"|"scale"|"transform"' \
/var/lib/plasmalogin/.config/kwinoutputconfig.json
```
目标权限应为:
```text
644 plasmalogin:plasmalogin
```
本次实机只同步 `kwinoutputconfig.json` 后,登录页和触摸均正常。如果登录页画面正确但输入设置仍不符合预期,优先改用上面的官方 “Apply Plasma Settings…”;它还会同步 `kcminputrc`。
如果系统使用的是 SDDM 而不是 Plasma Login Manager,本节路径和账户名不适用。先用以下命令确认:
```bash
readlink -f /etc/systemd/system/display-manager.service
```
本次实机输出为:
```text
/usr/lib/systemd/system/plasmalogin.service
```
6. 启用登录后桌面的重力感应自动旋转
本节只控制**登录后的 Plasma Wayland 桌面**。建议先按第 1 节把固定横屏和触摸调正确,再启用自动旋转。
本次 Pocket 4 的传感器链为:
```text
MXC6655 ACPI device → mxc4005 IIO driver → iio-sensor-proxy → KWin
```
6.1 安装并确认传感器服务
```bash
sudo pacman -S iio-sensor-proxy
sudo systemctl enable --now iio-sensor-proxy.service
systemctl is-active iio-sensor-proxy.service
busctl --system get-property \
net.hadess.SensorProxy \
/net/hadess/SensorProxy \
net.hadess.SensorProxy HasAccelerometer
```
正常结果应包含:
```text
active
b true
```
在**本机图形会话的终端**中测试方向事件:
```bash
monitor-sensor --accel
```
缓慢转动机器,应看到类似:
```text
Accelerometer orientation changed: normal
Accelerometer orientation changed: right-up
Accelerometer orientation changed: bottom-up
Accelerometer orientation changed: left-up
```
按 `Ctrl+C` 结束测试。直接从 SSH 运行 `monitor-sensor` 可能被 PolicyKit 拒绝,因为远程会话不是当前活动的本地图形会话。这不等于传感器故障。如果必须通过 SSH 诊断,并且该用户的 Plasma 会话已经登录,可以尝试:
```bash
XDG_RUNTIME_DIR=/run/user/$(id -u) \
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus \
systemd-run --user --collect --wait --pipe \
/usr/bin/monitor-sensor --accel
```
6.2 正确认识 IIO buffer 警告
本机 `journalctl -u iio-sensor-proxy` 中出现过:
```text
Could not find trigger name associated ...
Unable to enable ring buffer ...
```
`iio-sensor-proxy 3.9` 会先尝试 IIO buffer backend;不可用时还能选择 polling backend,周期性读取 `in_accel_*_raw`。因此,**只有在 `monitor-sensor` 已能持续输出方向事件时**,这些 buffer 信息才可以视为回退探测噪声,而不是权限或驱动故障。不要脱离实际方向测试一概忽略错误。
若没有任何方向事件,再检查:
```bash
find /sys/bus/iio/devices -maxdepth 2 -type f \
\( -name name -o -name 'in_accel_*_raw' -o -name in_accel_mount_matrix \) \
-print
lsmod | grep -E 'mxc4005|industrialio'
journalctl -b -u iio-sensor-proxy.service --no-pager
```
6.3 选择 KWin 自动旋转策略
KWin 支持三种策略:
- inTabletMode:只在内核上报平板模式时自动旋转;
Pocket 4 本次实测只有 `Lid Switch`,没有 `SW_TABLET_MODE`。因此 `inTabletMode` 不会触发,最终使用 `always`。
先确认内屏输出名并备份配置:
```bash
kscreen-doctor -o
cp -a ~/.config/kwinoutputconfig.json \
~/.config/kwinoutputconfig.json.bak-before-auto-rotate
```
本机内屏为 `eDP-1`,启用命令是:
```bash
kscreen-doctor output.eDP-1.autoRotatePolicy.always
```
如果其他机器确实能上报可靠的 tablet-mode switch,可以改用:
```bash
kscreen-doctor output.eDP-1.autoRotatePolicy.inTabletMode
```
验证:
```bash
kscreen-doctor -o
grep -nE 'autoRotation|connectorName|transform' \
~/.config/kwinoutputconfig.json
```
本次实机最终关键状态为:
```text
Auto Rotate Policy: always
"autoRotation": "Always"
"connectorName": "eDP-1"
"transform": "Rotated270"
```
6.4 自动旋转验收
依次把机器停留在四个方向,每次等待约 2 至 3 秒,并确认:
- 回到常用横屏后,KWin 恢复原来的
Rotated270。
本次实机捕获到 `normal → right-up → bottom-up → left-up → right-up`,画面四方向跟随正常,回到横屏后触摸映射也正确。
6.5 登录页固定横屏与桌面自动旋转的关系
Plasma Login Manager 使用 `/var/lib/plasmalogin` 下的独立配置;普通用户启用 `always` 不会自动改写登录页副本。因此可以保持:
如果在启用 `always` 后再次执行 “Apply Plasma Settings…”,或者手动把当前用户配置复制给 `plasmalogin`,可能会把自动旋转策略一并同步到登录页。是否这样做应按实际需求决定。
7. 重启验收
保存所有工作后正常重启:
```bash
systemctl reboot
```
逐阶段观察:
- UKI Arch Linux Logo:不再出现;
登录后再检查:
```bash
cat /proc/cmdline
cat /sys/class/graphics/fbcon/rotate
systemctl is-system-running
systemctl --failed --no-pager
kscreen-doctor -o
```
本次实机最终结果:上述各阶段全部通过,自动旋转与触摸映射通过四方向实测,systemd 状态为 `running`,失败单元为 0。
回滚
Limine
```bash
sudo cp -a /boot/EFI/BOOT/limine.conf.bak-before-rotation /boot/EFI/BOOT/limine.conf
```
kernel command line 与 UKI preset
```bash
sudo cp -a /etc/kernel/cmdline.bak-before-rotation /etc/kernel/cmdline
sudo cp -a /etc/mkinitcpio.d/linux.preset.bak-before-rotation /etc/mkinitcpio.d/linux.preset
sudo cp -a /etc/mkinitcpio.d/linux-lts.preset.bak-before-rotation /etc/mkinitcpio.d/linux-lts.preset
sudo mkinitcpio -P
```
只恢复实际存在、且确实由自己创建的备份文件。若没有安装 `linux-lts`,不要执行对应命令。
Plasma Login Manager
推荐在 Login Screen KCM 中选择 “Reset to Default Settings”。也可以只删除手动同步的输出配置:
```bash
sudo rm -f /var/lib/plasmalogin/.config/kwinoutputconfig.json
```
重启后生效。
Plasma 桌面自动旋转
恢复为永不自动旋转:
```bash
kscreen-doctor output.eDP-1.autoRotatePolicy.never
```
也可以恢复启用前的完整用户输出配置:
```bash
cp -a ~/.config/kwinoutputconfig.json.bak-before-auto-rotate \
~/.config/kwinoutputconfig.json
```
注销并重新登录后生效。恢复完整文件时要注意,它也会恢复当时的缩放、输出排列和其他显示设置。
常见误区
fbcon=rotate:1 只负责 console,不会旋转 Limine、UKI splash、Plasma 登录页或桌面。interface_rotation 只负责 Limine。- 登录后的 Plasma 配置不会自动改变 Plasma Login Manager。
iio-sensor-proxy 日志里出现 IIO buffer 警告,不代表 polling backend 也失败;以实际方向事件为准。- SSH 中的
monitor-sensor 被 PolicyKit 拒绝,不代表本地图形会话无法使用传感器。 - 没有
SW_TABLET_MODE 的机器不要选择inTabletMode;Pocket 4 本次实测应使用always。 - 不要把旧版 SDDM 的路径直接用于
plasma-login-manager。 video=eDP-1:panel_orientation=... 不是所有启动阶段的通用修复方案。- 修改 UKI preset 或
/etc/kernel/cmdline 后必须重新运行mkinitcpio -P。 mkinitcpio -P 未完整成功时不要重启。- 外接显示器会进入
kwinoutputconfig.json;同步登录页配置前最好断开外接屏。 - 系统升级后如果出现
.pacnew,或重新生成了 Limine 配置,应再次检查interface_rotation、fbcon=rotate 和 preset 的default_options。
参考资料
- Linux Kernel:Framebuffer Console
- ArchWiki:Plasma Login Manager
- KDE Plasma Login Manager 6.7.3:KCM 同步实现
- KDE Plasma Login Manager 6.7.3:授权 helper 写入路径
- iio-sensor-proxy 3.9:backend 选择实现
- iio-sensor-proxy 3.9:polling accelerometer backend
- KDE libkscreen 6.7.3:
kscreen-doctor 自动旋转策略