我有一个装有 kodi 的 Linux 机器和以下 systemd 脚本,用于在启动时启动 kodi:
[Unit]
Description = kodi-standalone using xinit
After = systemd-user-sessions.service network.target sound.target network-online.target
[Service]
User = kodi
Group = kodi
Type = simple
PAMName=login
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/openbox-session -- :0 -nolisten tcp vt7
Restart = on-abort
[Install]
WantedBy = multi-user.target
在 Ubuntu 15.10 下,这个功能运行正常,但升级后就不行了。服务无法启动
Apr 24 17:30:19 rasnas sudo[3644]: kodi : TTY=pts/0 ; PWD=/home/kodi ; USER=root ; COMMAND=/usr/sbin/service kodi start Apr 24 17:30:19 rasnas sudo[3644]: pam_unix(sudo:session): session opened for user root by kodi(uid=0) Apr 24 17:30:19 rasnas systemd[1]: Starting Detect the available GPUs and deal with any system changes... Apr 24 17:30:19 rasnas gpu-manager[3671]: /etc/modprobe.d is not a file Apr 24 17:30:19 rasnas gpu-manager[3671]: /etc/modprobe.d is not a file Apr 24 17:30:19 rasnas gpu-manager[3671]: /etc/modprobe.d is not a file Apr 24 17:30:19 rasnas gpu-manager[3671]: /etc/modprobe.d is not a file Apr 24 17:30:19 rasnas gpu-manager[3671]: /etc/modprobe.d is not a file Apr 24 17:30:19 rasnas gpu-manager[3671]: update-alternatives: error: no alternatives for x86_64-linux-gnu_gfxcore_conf Apr 24 17:30:19 rasnas systemd[1]: Started Detect the available GPUs and deal with any system changes. Apr 24 17:30:19 rasnas systemd[1]: Started kodi-standalone using xinit. Apr 24 17:30:19 rasnas sudo[3644]: pam_unix(sudo:session): session closed for user root Apr 24 17:30:19 rasnas systemd[3692]: pam_unix(login:session): session opened for user kodi by (uid=0) Apr 24 17:30:19 rasnas systemd[1]: Started Session 11 of user kodi. Apr 24 17:30:19 rasnas systemd[3692]: pam_ck_connector(login:session): cannot determine display-device Apr 24 17:30:19 rasnas xinit[3692]: X.Org X Server 1.18.3 Apr 24 17:30:19 rasnas xinit[3692]: Release Date: 2016-04-04 Apr 24 17:30:19 rasnas xinit[3692]: X Protocol Version 11, Revision 0 Apr 24 17:30:19 rasnas xinit[3692]: Build Operating System: Linux 3.13.0-85-generic x86_64 Ubuntu Apr 24 17:30:19 rasnas xinit[3692]: Current Operating System: Linux rasnas 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 Apr 24 17:30:19 rasnas xinit[3692]: Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.4.0-21-generic root=UUID=1bca803d-6ad4-4e76-bc0d-10d37e041d51 ro quiet splash vt.handoff=7 Apr 24 17:30:19 rasnas xinit[3692]: Build Date: 07 April 2016 09:18:50AM Apr 24 17:30:19 rasnas xinit[3692]: xorg-server 2:1.18.3-1ubuntu2 (For technical support please see http://www.ubuntu.com/support) Apr 24 17:30:19 rasnas xinit[3692]: Current version of pixman: 0.33.6 Apr 24 17:30:19 rasnas xinit[3692]: Before reporting problems, check http://wiki.x.org
Apr 24 17:30:19 rasnas xinit[3692]: to make sure that you have the latest version. Apr 24 17:30:19 rasnas xinit[3692]: Markers: (--) probed, (**) from config file, (==) default setting, Apr 24 17:30:19 rasnas xinit[3692]: (++) from command line, (!!) notice, (II) informational, Apr 24 17:30:19 rasnas xinit[3692]: (WW) warning, (EE) error, (NI) not implemented, (??) unknown. Apr 24 17:30:19 rasnas xinit[3692]: (==) Log file: "/home/kodi/.local/share/xorg/Xorg.0.log", Time: Sun Apr 24 17:30:19 2016 Apr 24 17:30:19 rasnas xinit[3692]: (==) Using system config directory "/usr/share/X11/xorg.conf.d" Apr 24 17:30:19 rasnas xinit[3692]: (EE) Apr 24 17:30:19 rasnas xinit[3692]: Fatal server error: Apr 24 17:30:19 rasnas xinit[3692]: (EE) xf86OpenConsole: Cannot open virtual console 7 (Permission denied) Apr 24 17:30:19 rasnas xinit[3692]: (EE) Apr 24 17:30:19 rasnas xinit[3692]: (EE) Apr 24 17:30:19 rasnas xinit[3692]: Please consult the The X.Org Foundation support Apr 24 17:30:19 rasnas xinit[3692]: at http://wiki.x.org
Apr 24 17:30:19 rasnas xinit[3692]: for help. Apr 24 17:30:19 rasnas xinit[3692]: (EE) Please also check the log file at "/home/kodi/.local/share/xorg/Xorg.0.log" for additional information. Apr 24 17:30:19 rasnas xinit[3692]: (EE) Apr 24 17:30:19 rasnas xinit[3692]: (EE) Server terminated with error (1). Closing log file. Apr 24 17:30:23 rasnas hyperiond[853]: V4L2 Grabber: Signal lost Apr 24 17:30:34 rasnas xinit[3692]: /usr/bin/xinit: giving up Apr 24 17:30:34 rasnas xinit[3692]: /usr/bin/xinit: unable to connect to X server: Connection refused Apr 24 17:30:34 rasnas xinit[3692]: /usr/bin/xinit: server error Apr 24 17:30:34 rasnas systemd[3697]: pam_unix(login:session): session closed for user kodi
那么我该如何解决这个问题?请注意,使用 15.10 一切正常!
谢谢!
答案1
我今天遇到了这个错误。经过一番调查,解决方案如下通过 Kodi 操作指南.第5章说:
从 Ubuntu 16.04(Xenial Xerus)开始,您需要安装并重新配置该软件包
xserver-xorg-legacy
。
它在我的设备上运行良好。
答案2
好吧,这不是最好的解决方案,但在启动 kodi 之前将 systemd 启动作业更改为 chmod/dev/tty7
似乎可以“修复”它。如果有人有更好、更适合 ubuntu 的方法,请告诉我 :D
[单元] 描述 = kodi-standalone 使用 xinit 之后 = systemd-user-sessions.service network.target sound.target network-online.target [服务] 用户 = kodi 群组 = kodi 类型 = 简单 PAMName=登录 ExecStartPre=/bin/chmod 777 /dev/tty7 权限启动仅=true ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/openbox-session --:0 -nolisten tcp vt7 重新启动 = 中止 [安装] WantedBy = 多用户.目标
答案3
如果您正在使用 systemd,那么可能使其发挥作用的另一个想法是让 systemd 充当 X 和 root 权限之间的代理。
这需要安装libpam-systemd
以便systemd-logind
开始在控制台上正常工作(参见Debian 9 发布说明:Xorg 服务器不再需要 root 权限),并从使用普通的切换xinit
到使用startx
包装器(参见Debian 错误 #801401)。
我不知道这个 Kodi 用例的具体情况,但在研究一般问题时偶然发现了这个问题,所以我认为我最好写下来以帮助其他人将这些点联系起来。