Solved [Solved] Xorg-7.7 startx fails as non-root

ksym

Member

Thanks: 3
Messages: 29

#1
If I try to start X.org server with the startx command as a non-root user, the Xorg server crashes gracefully with the following error messages:

Code:
...
[  8194.960] (WW) intel(0): drmDropMaster failed: Unknown error: -22
[  8194.977] Server terminated successfully (0). Closing log file.
...
Then, if I start X.org with the startx command as root, everything works as expected. X.org also works fine, if started with the X -command as non-root. In this way the desktop is unusable, because .xinitrc was not executed etc. Please do note that I might have not noticed some important details from the /var/log/Xorg.0.log because I am quite illiterate both in English and in anything related to Xorg. I haven't got a simple clue how the apparatus works internally.

Here are the logs:
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/Xorg.0.log.root <-- startx as root
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/Xorg.0.log.adm <-- startx as non-root (adm)
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/Xorg.0.log.diff <-- diff of the above logs for convenience
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/dev_dir_list.txt <-- ls -al /dev
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/dmesg.txt <-- dmesg
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/loader.conf <-- cat /boot/loader.conf
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/pciconf_-lbcev.txt <-- pciconf -lbcev
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/pkg_info.txt <-- pkg info
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/rc.conf <-- /etc/rc.conf
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/sysctl.conf <-- /etc/sysctl.conf
http://koti.kapsi.fi/~isoa/files/Xorg-7.7-problem/xorg.conf <--/usr/local/etc/X11/xorg.conf

All of the packages in my system have been built with poudriere.

My make.conf is:
Code:
CC=clang
CXX=clang++
CPP=clang-cpp

WITH_PKGNG="YES"
WITH_NEW_XORG="YES"
WITH_KMS="YES"
QT4_OPTIONS=    CUPS NAS QGTKSTYLE

.if ${.CURDIR:M*/lang/gcc*}
CC=gcc
CXX=g++
CPP=cpp
.endif
My computer is an Acer laptop with Optimus. Regardless, X.org seems to be able to work the display with the intel driver.

Have I done something wrong to prevent startx from invoking the X server correctly? Am I the only person with this problem?
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 3,615
Messages: 13,850

#2
Re: Xorg-7.7 startx fails as non-root

On a quick look... why is this set in /etc/sysctl.conf? Have you tried without it?
Code:
security.bsd.see_other_uids=0
 
OP
OP
K

ksym

Member

Thanks: 3
Messages: 29

#3
Re: Xorg-7.7 startx fails as non-root

wblock@ said:
On a quick look... why is this set in /etc/sysctl.conf? Have you tried without it?
Code:
security.bsd.see_other_uids=0
Just commented out the line mention above, rebooted, logged in as adm (normal user), startx, same error as before.

Now that I remember I had this problem with another laptop too. The laptop also had a GPU that required the intel driver, either the older or the newer. I solved the problem of not being able to invoke startx as non-root by switching back to the older X.org, which did not use KMS at all.

This problem is really mysterious. I mean, if this problem was common, FreeBSD mailing lists and forums might be flooding with "startx fails as non-root" messages.

Should I also ask the freebsd-x11@freebsd.org mailing list?
 
OP
OP
K

ksym

Member

Thanks: 3
Messages: 29

#4
Re: Xorg-7.7 startx fails as non-root

Okay, I consulted Google for some more information. It seems as other people have the same problem, but they did not document the case as extensively as I did: http://lists.freebsd.org/pipermail/freebsd-x11/2012-January/011421.html

I get the same error when I invoke startx as a normal user. Furthermore, one person suggested that it is a x11/libxcb problem: http://lists.freebsd.org/pipermail/freebsd-x11/2012-January/011426.html

However, I am quite skeptical about the problem being in libXcb, since nowadays x11/libxcb version is 1.9.x, and I assume the problem has been fixed. But I cannot know this for sure unless I consult the freebsd-x11@freebsd.org mailing list, which I have to do later on. Meanwhile I shall wait for replies, maybe somebody had similar issue and found a solution to it.
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 3,615
Messages: 13,850

#5
Re: Xorg-7.7 startx fails as non-root

Do ask on the mailing list, but in the meantime... It really feels like a problem of permissions. Is adm a member of the wheel group?
 
OP
OP
K

ksym

Member

Thanks: 3
Messages: 29

#6
Re: Xorg-7.7 startx fails as non-root

wblock@ said:
Do ask on the mailing list, but in the meantime... It really feels like a problem of permissions. Is adm a member of the wheel group?
/etc/group
Code:
wheel:*:0:root,adm
...
operator:*:5:root,adm
...
User adm is a member in both wheel and operator groups.

Also:
Code:
root@****:~ # ls -al /dev/dri/card1
crw-rw----  1 root  wheel  0x7e 18 Dec 21:29 /dev/dri/card1
Might change adm's login group into wheel.
 
OP
OP
K

ksym

Member

Thanks: 3
Messages: 29

#7
Re: Xorg-7.7 startx fails as non-root

Okay, I changed adm's login group into wheel, rebooted, then invoked startx as adm. Same problem occurred.

The startx script does some extremely funky privelege checking and/or Xorg tuning. Or maybe I just do not comprehend how this new and shiny KMS stuff works.
 
OP
OP
K

ksym

Member

Thanks: 3
Messages: 29

#8
Re: Xorg-7.7 startx fails as non-root

Okay, now I have further contained the problem. Problem seems to be with x11/xinit ...

By invoking X directly, I get a screen with no problems. If I invoke xinit, the Xorg server shuts down with
Code:
[  2827.466] (WW) intel(0): drmDropMaster failed: Unknown error: -22
A workaround for this problem involves crafting a shell-script which invokes X, then sleeps for a while, sets a number of environment variables and invokes a sensible window manager. This is an ugly kludge, but might work better than nothing.

At this point the most reasonable route to solving this problem is to consult freebsd-x11@freebsd.org. I will keep checking for replies here in the forums too, and if I learn something new I will post my findings in this thread.
 
OP
OP
K

ksym

Member

Thanks: 3
Messages: 29

#9
Re: Xorg-7.7 startx fails as non-root [SOLVED]

I had a typo on my ~/.xinitrc, which caused the execution fall thru without stopping at the window manager. For some reason, the line with the window manager in it had & -character at the end. I just had a minor malfunction when wrote the file.

For others with the same problem occurring, remember to sanity-check your ~/.xinitrc. The final line in that file MUST invoke a window manager, and it MUST NOT contain an & -character.

Problem solved.
 
Top