FS#41391 - [xbmc] Since the new xorg update, xbmc.service does not start

Attached to Project: Community Packages
Opened by John (graysky) - Tuesday, 29 July 2014, 21:18 GMT
Last edited by Ike Devolder (BlackEagle) - Friday, 08 August 2014, 15:43 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Ike Devolder (BlackEagle)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 15
Private No

Details

Description: With the recent Xorg update, xbmc.service no longer starts; the system just sits a the "Arch Linux 3.15.7-1-ARCH (tty1) login:" screen.

Additional info:
* package version(s) 13.1-4

Journalctl after manually starting the service:
Jul 29 17:16:05 atomic systemd-logind[222]: New session c3 of user xbmc.
Jul 29 17:16:05 atomic systemd[837]: pam_unix(systemd-user:session): session opened for user xbmc by (uid=0)
Jul 29 17:16:05 atomic systemd[837]: Starting Paths.
Jul 29 17:16:05 atomic systemd[837]: Reached target Paths.
Jul 29 17:16:05 atomic systemd[837]: Starting Timers.
Jul 29 17:16:05 atomic systemd[837]: Reached target Timers.
Jul 29 17:16:05 atomic systemd[837]: Starting Sockets.
Jul 29 17:16:05 atomic systemd[837]: Reached target Sockets.
Jul 29 17:16:05 atomic systemd[837]: Starting Basic System.
Jul 29 17:16:05 atomic systemd[837]: Reached target Basic System.
Jul 29 17:16:05 atomic systemd[837]: Starting Default.
Jul 29 17:16:05 atomic systemd[837]: Reached target Default.
Jul 29 17:16:05 atomic systemd[837]: Startup finished in 23ms.
Jul 29 17:16:05 atomic sudo[836]: pam_unix(sudo:session): session closed for user root
Jul 29 17:16:05 atomic gnome-keyring-daemon[844]: couldn't connect to dbus session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Jul 29 17:16:05 atomic xinit[835]: /usr/bin/Xorg.wrap: Only console users are allowed to run the X server
Jul 29 17:16:05 atomic gnome-keyring-daemon[844]: couldn't connect to dbus session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Jul 29 17:16:20 atomic xinit[835]: /usr/bin/xinit: giving up
Jul 29 17:16:20 atomic xinit[835]: /usr/bin/xinit: unable to connect to X server: Connection refused
Jul 29 17:16:20 atomic xinit[835]: /usr/bin/xinit: server error
Jul 29 17:16:20 atomic systemd[847]: pam_unix(login:session): session closed for user xbmc
Jul 29 17:16:20 atomic dbus[223]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.6" (uid=420 pid=847 comm="(sd-pam ") interface="org.freedesktop.login1.Manager" member="ReleaseSession" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=222 comm="/usr/lib/systemd/systemd-logind ")
Jul 29 17:16:20 atomic systemd[847]: pam_systemd(login:session): Failed to release session: Access denied
Jul 29 17:16:20 atomic systemd[1]: xbmc.service: main process exited, code=exited, status=1/FAILURE
Jul 29 17:16:20 atomic systemd[1]: Unit xbmc.service entered failed state.
This task depends upon

Closed by  Ike Devolder (BlackEagle)
Friday, 08 August 2014, 15:43 GMT
Reason for closing:  Fixed
Additional comments about closing:  xbmc.service will be removed

added link to wiki https://wiki.archlinux.org/index.php/Xbm c#Autostart_at_boot
Comment by Jackson Alley (jalley) - Wednesday, 30 July 2014, 00:26 GMT
One way to fix it:
$cat /etc/X11/Xwrapper.config
allowed_users = anybody
needs_root_rights = no
Comment by John (graysky) - Wednesday, 30 July 2014, 00:57 GMT
Thanks. Will try that. The package needs to provide a general solution though.
Comment by Daniel Micay (thestinger) - Wednesday, 30 July 2014, 00:59 GMT
The package shouldn't be starting X outside of a session.
Comment by Gereon Schomber (IncredibleLaser) - Wednesday, 30 July 2014, 06:21 GMT
The Xwrapper.config solution doesn't work for me. Tried it already when xorg-server 1.16 hit testing.
Comment by Jackson Alley (jalley) - Wednesday, 30 July 2014, 11:51 GMT
Oops, hit refresh and resubmitted my first comment. Apparently no delete option?
Comment by Ike Devolder (BlackEagle) - Wednesday, 30 July 2014, 17:50 GMT
as a current workaround you can use:

create /etc/systemd/system/getty@tty7.service.d/autologin.conf (with folders)

autologin.conf:
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin xbmc --noclear %I 38400 linux

edit /var/lib/xbmc/.bashrc
#
# ~/.bashrc
#
/usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/xbmc-standalone -- :0 -nolisten tcp

$ systemctl disable xbmc
$ systemctl enable getty@tty7
$ reboot (i did not test any other way, only control on my standalone system is IR remote and ssh )

xbmc is working again, note i'll try to find an other option which is simpler, but this works for now
Comment by Gereon Schomber (IncredibleLaser) - Wednesday, 30 July 2014, 18:25 GMT
Another thing I had to fix: xorg didn't autoload the nvidia driver automatically anymore, had to make an xorg.conf.d as the wiki says, this wasn't needed with xorg 1.15.
Comment by Balló György (City-busz) - Wednesday, 30 July 2014, 19:03 GMT
I think we should drop the broken 'xbmc.service' file, remove the 'xbmc' user, and let the users to configure their systems as they want. All details of the possible solutions for autostarting XBMC on boot could be added to the wiki.
Comment by John (graysky) - Wednesday, 30 July 2014, 19:20 GMT
@City-busz - Gotta disagree 100 % with you on that suggestion. The user/service is very nice and should be made to work under the new xorg.
Comment by John (graysky) - Wednesday, 30 July 2014, 19:36 GMT
@Gereon - Care to post your xorg.conf.d to get the module/driver working?
Comment by Gereon Schomber (IncredibleLaser) - Wednesday, 30 July 2014, 19:38 GMT
I just copied it from the Arch wiki page, so:

/etc/X11/xorg.conf.d/15-nvidia.conf:
Section "Device"
Identifier "Nvidia Card"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "NoLogo" "true"
#Option "UseEDID" "false"
#Option "ConnectedMonitor" "DFP"
EndSection
Comment by John (graysky) - Wednesday, 30 July 2014, 19:44 GMT
Thanks!
Comment by Wasser (Wasser) - Wednesday, 30 July 2014, 19:54 GMT
@BlackEagle,

I did the workaround you suggested. It autologins in tty7 to xbmc, however I get the same error failure as if it was started by the systemd service file.
XORG prints an error on screen similar to the what it puts in the log if I start it with the service where it mentions that it can't open tty0 and then says connection refused, throwing me back to the console as user xbmc.

Any suggestions on what I may be doing wrong? Thanks
Comment by Gereon Schomber (IncredibleLaser) - Thursday, 31 July 2014, 04:04 GMT
Had my notebook already off yesterday, but my input devices no longer work now.

EDIT: Reverted to xorg-server 1.15 and this works both with the old and the new method.
Comment by Jo Pigliani (altcarbon) - Friday, 01 August 2014, 17:33 GMT
I confirm just adding a file /etc/X11/Xwrapper.config with one line "allowed_users = anybody" fixes the problem. See man Xorg.wrap:

""
The Xorg X server may need root rights to function properly. To start the Xorg X server with these rights your system is
using a suid root wrapper installed as /usr/bin/Xorg.wrap which will execute the real X server which is installed as
/usr/bin/Xorg.bin .

By default Xorg.wrap will autodetect if root rights are necessary, and if not it will drop its elevated rights before
starting the real X server. By default Xorg.wrap will only allow executing the real X server from login sessions on a
physical console.
""
Comment by John (graysky) - Friday, 01 August 2014, 18:32 GMT
Confirmed here too.

1) Single line 'allowed_users = anybody' in /etc/X11/Xwrapper.config per Jo's comment.
2) /etc/X11/xorg.conf.d/20-nvidia.conf containing the text in Geron's post restored functionality for me.

Perhaps both can be mentioned in a post install scriptlet.
Comment by Daniel Micay (thestinger) - Friday, 01 August 2014, 20:36 GMT
The correct solution is to have the service create a proper session or to stop shipping a broken service. Not having a session will break rootless X, but it's not the only thing it will break.
Comment by Balló György (City-busz) - Friday, 01 August 2014, 21:18 GMT
I agree with thestinger. Technically, XBMC is much more like a desktop application rather than a system service, so it needs a properly opened session with an X server. I think the best way is using a display manager with its autologin feature.

The systemd service file should be dropped if we can't find a clean way to do this without editing files in /etc.
Comment by John (graysky) - Friday, 01 August 2014, 22:46 GMT
EDIT: removed previous comment.
Comment by Curtis Lee Bolin (curtisleebolin) - Saturday, 02 August 2014, 07:12 GMT
After reading https://www.archlinux.org/news/xorg-server-116-is-now-available/ and man xorg.wrap, it seemed just adding "allowed_users = anybody" wouldn't completely solve it because of
"this also means that it must be launched from the same virtual terminal as was used to log in" - ,
but I tried it. It didn't work.

needs_root_rights = yes|no|auto
Configure if the wrapper should drop its elevated (root) rights
before starting the X server. Use yes to force execution as root,
no to force execution with all suid rights dropped, and auto to
letter the wrapper auto-detect. The default is auto.

It seemed to me to restore previous behavior, "needs_root_rights" need to be set to "yes" not "no" as Jackson Alley (jalley) stated in the first post. (I did try "no", and it didn't work. I was given a permission error)

After doing that it works fine, but I obviously don't feel good disabling new more secure xorg-server features.
Btw, I don't see how it would be possible to run startx from an ssh session without this work around.

$ cat /etc/X11/Xwrapper.config
allowed_users = anybody
needs_root_rights = yes
Comment by John (graysky) - Saturday, 02 August 2014, 12:13 GMT
@Curtis - For me, systemd running the service at boot works with the single line.
Comment by Curtis Lee Bolin (curtisleebolin) - Saturday, 02 August 2014, 16:21 GMT
John (graysky),

With "allowed_users = anybody" and (without setting needs_root_rights or with "needs_root_rights = no") I get this error:
(EE) Fatal server error:
(EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)

Which is the behavior I would expect.

I am assuming you are using the proprietary nvidia driver from an earlier comment. Maybe that has something to do with it.
Comment by Curtis Lee Bolin (curtisleebolin) - Sunday, 03 August 2014, 04:29 GMT
[Edit] removed resubmitted
Comment by Heinz Mueler (x_0_r) - Sunday, 03 August 2014, 07:21 GMT
BlackEagles suggestion worked fine for me.

However, I had to append vt$XDG_VTNR to the line in .bashrc resulting in:
/usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/xbmc-standalone -- :0 -nolisten tcp vt$XDG_VTNR

That got rid of the tty0 error Wasser described
Comment by Ruben Van Boxem (rubenvb) - Wednesday, 06 August 2014, 09:21 GMT
As the current startup method seems to be frowned upon (at best), and is broken for people who want a "secure" X server, I would opt for a simple setup with e.g. lightdm and its autologin into the XBMC X session. Unfortunately, I have not been able to get it working, or I would have already added it to the XBMC wiki page.

Blatant forum post self-promotion:
https://bbs.archlinux.org/viewtopic.php?id=185216

This would be IMHO the cleanest solution, with the least amount of dependencies (if one uses the lightdm gtk2 greeter).

Of course, when systemd and X get along better, as explained here:
https://wiki.archlinux.org/index.php/Systemd/User#Xorg_as_a_systemd_user_service

all this will probably be superceded anyway. I think work in this direction is partly being investigated here (this particular solution relying on the PAM runuser configuration files):
https://bugs.archlinux.org/task/37644
Comment by Curtis Lee Bolin (curtisleebolin) - Wednesday, 06 August 2014, 14:48 GMT
Ruben Van Boxem (rubenvb),
"Please note that launching X through a login-manager (gdm, kdm, ...) doesn't yet provide rootless access." - https://www.archlinux.org/news/xorg-server-116-is-now-available/

A display manager with auto login is defeating rootless access anyway, which is no better than a few changes in /etc/X11/Xwrapper.config.

The intended purpose of this bug report is fix the xbmc package. Having the xbmc package depend on a display manager and apply auto login setting is a bit ridiculous.

https://bugs.archlinux.org/task/41391#comment125851 is a working solution, but I bet the maintainers are looking for a better solution.
The current work around is to edit /etc/X11/Xwrapper.config which lets the xbmc service in the package work fine.

Since you are wanting a display manager with auto login, having a look at this might help you https://bbs.archlinux.org/viewtopic.php?id=185216 . (nevermind, you have seen this link)

Loading...