X 服务器更新 1.18.4 之后 `su -- pi -c "startx" &` 不再工作

X 服务器更新 1.18.4 之后 `su -- pi -c "startx" &` 不再工作

我的树莓派(Jessie)将xserver-xorg-core从1.17.2更新到1.18.4

现在su -- pi -c "startx" &已经/etc/rc.local不能用了。

Cannot open virtual console 2

更新:

Start-Date: 2016-12-09  20:17:57
Commandline: apt full-upgrade -y
Install: libpam-systemd:armhf (215-17+deb8u5, automatic), libllvm3.9:armhf (3.9-4, automatic)
Upgrade: xserver-xorg-input-synaptics:armhf (1.8.2-1~bpo8+1, 1.8.3-2)
raspberrypi-sys-mods:armhf (20161205, 20161208+1)
libdrm-freedreno1:armhf (2.4.65-3~bpo8+1, 2.4.71-1+rpi1)
libglapi-mesa:armhf (11.1.0-1+rpi1, 13.0.0-1+rpi1)
libwayland-client0:armhf (1.6.0-2, 1.11.0-2)
xserver-xorg-core:armhf (1.17.2-1+rpi1, 1.18.4-2+rpi1)
libegl1-mesa:armhf (11.1.0-1+rpi1, 13.0.0-1+rpi1)
libgbm1:armhf (11.1.0-1+rpi1, 13.0.0-1+rpi1)
libdrm-radeon1:armhf (2.4.65-3~bpo8+1, 2.4.71-1+rpi1)
libxfont1:armhf (1.5.1-1, 1.5.2-1)
xserver-common:armhf (1.17.2-1+rpi1, 1.18.4-2+rpi1)
libdrm2:armhf (2.4.65-3~bpo8+1, 2.4.71-1+rpi1)
libdrm-nouveau2:armhf (2.4.65-3~bpo8+1, 2.4.71-1+rpi1)
raspi-config:armhf (20161114, 20161207)
libgl1-mesa-dri:armhf (11.1.0-1+rpi1, 13.0.0-1+rpi1)
xserver-xorg-video-fbdev:armhf (0.4.4-1+rpi1, 0.4.4-1+rpi2)
libdrm-amdgpu1:armhf (2.4.65-3~bpo8+1, 2.4.71-1+rpi1)
xserver-xorg-input-evdev:armhf (2.9.2-1~bpo8+1, 2.10.3-1)
xserver-xorg:armhf (7.7+7+b1, 7.7+16)
libgl1-mesa-glx:armhf (11.1.0-1+rpi1, 13.0.0-1+rpi1)
Remove: xserver-xorg-input-wacom:armhf (0.26.0+20140918-1)
End-Date: 2016-12-09  20:18:29

满的/etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

# Wait for the TV-screen to be turned on...
while ! $( tvservice --dumpedid /tmp/edid | fgrep -qv 'Nothing written!' ); do
        bHadToWaitForScreen=true;
        printf "===> Screen is not connected, off or in an unknown mode, waiting for it to become available...\n"
        sleep 10;
done;

printf "===> Screen is on, extracting preferred mode...\n"
_DEPTH=32;
eval $( edidparser /tmp/edid | fgrep 'preferred mode' | tail -1 | sed -Ene 's/^.+(DMT|CEA) \(([0-9]+)\) ([0-9]+)x([0-9]+)[pi]? @.+/_GROUP=\1;_MODE=\2;_XRES=\3;_YRES=\4;/p' );

printf "===> Resetting screen to preferred mode: %s-%d (%dx%dx%d)...\n" $_GROUP $_MODE $_XRES $_YRES $_DEPTH
tvservice --explicit="$_GROUP $_MODE"
sleep 1;

printf "===> Resetting frame-buffer to %dx%dx%d...\n" $_XRES $_YRES $_DEPTH
fbset --all --geometry $_XRES $_YRES $_XRES $_YRES $_DEPTH -left 0 -right 0 -upper 0 -lower 0;
sleep 1;

if [ -f /boot/xinitrc ]; then
        ln -fs /boot/xinitrc /home/pi/.xinitrc;
        su -- pi -c "startx" &
        bash /home/pi/.xinitrc;
fi

exit 0

满的/boot/xinitrc

#!/bin/sh
while true; do

        # Clean up previously running apps, gracefully at first then harshly
        killall -TERM chromium 2>/dev/null;
        killall -TERM matchbox-window-manager 2>/dev/null;
        sleep 2;
        killall -9 chromium 2>/dev/null;
        killall -9 matchbox-window-manager 2>/dev/null;

        # Clean out existing profile information
        rm -rf /home/pi/.cache;
        rm -rf /home/pi/.config;
        rm -rf /home/pi/.pki;

        # Generate the bare minimum to keep Chromium happy!
        mkdir -p /home/pi/.config/chromium/Default
        sqlite3 /home/pi/.config/chromium/Default/Web\ Data "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); INSERT INTO meta VALUES('version','46'); CREATE TABLE keywords (foo INTEGER);";

        # Disable DPMS / Screen blanking
        xset -dpms
        xset s off

        # Reset the framebuffer's colour-depth
        fbset -depth $( cat /sys/module/*fb*/parameters/fbdepth );

        # Hide the cursor (move it to the bottom-right, comment out if you want mouse interaction)
        xwit -root -warp $( cat /sys/module/*fb*/parameters/fbwidth ) $( cat /sys/module/*fb*/parameters/fbheight )

        # Start the window manager (remove "-use_cursor no" if you actually want mouse interaction)
        matchbox-window-manager -use_titlebar no -use_cursor no &

        # Start the browser (See http://peter.sh/experiments/chromium-command-line-switches/)
        chromium-browser --app=http://127.0.0.1/status

done;

我该怎么做才能让这项工作再次发挥作用?

感谢您的帮助!

答案1

您现在(自版本 2:1.17.2-2 起)需要让 X 服务器在与您打开的会话相同的 VT 上运行。 X 服务器尝试在没有 root 权限的情况下启动(它用于logind实现此目的),但相反,它无法在任意 VT 上启动。

一个快速修复可能是安装该xserver-xorg-legacy软件包,这将允许 X 服务器像以前一样以 root 身份启动。

顺便说一句,你为什么使用su --而不是su -,你不尝试启动登录外壳吗?

相关内容