You are not logged in.

#1 2012-12-08 11:06:45

ramboman
Member
Registered: 2010-01-23
Posts: 35

[SOLVED] startx vs xinit regarding mounting and power management

I updated the system yesterday, and I came across these issues:

$ udisks --mount /dev/sdb1

	# When in the terminal and
	# When in X started with startx using urxvt
	Mounted /org/freedesktop/UDisks/devices/sdb1 at /media/BOOTCD_USB

	# When in X started with xinit using urxvt
	Mount failed: Not Authorized


$ dbus-send --system --print-reply --dest=org.freedesktop.login1 \
	/org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" \
	boolean:true

	# When in the terminal and
	# When in X started with startx using urxvt
	method return sender=:1.1 -> dest=:1.89 reply_serial=2
		# Suspends with success

	# When in X started with xinit using urxvt
	Error org.freedesktop.DBus.Error.AccessDenied: Operation not permitted
		# No suspend

I usually use xinit to start a windows manager because it is more versatile. I
can put a script in .xinitrc and .bashrc, and then type :

$ x 1 	# start awesome
$ x 2	# start fluxbox
   ...

What should I do to fix this issue regarding xinit?

Last edited by ramboman (2012-12-09 00:28:30)

Offline

#2 2012-12-08 12:42:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,554
Website

Re: [SOLVED] startx vs xinit regarding mounting and power management

Startx is just a script that calls xinit - you can look at it and see all the crap it does - but the relevant part for this is that it starts a dbus session.

In your xinitrc your exec line shoud be

exec dbus-launch --exit-with-session <WM>

where <WM> is replace by your window manager.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2012-12-08 15:46:05

bohoomil
Banned
Registered: 2010-09-04
Posts: 2,377
Website

Re: [SOLVED] startx vs xinit regarding mounting and power management

You can as well add the following to your .xinitrc:

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/* ; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#4 2012-12-08 18:35:24

Antoine
Member
From: Picton Ontario
Registered: 2012-10-11
Posts: 90

Re: [SOLVED] startx vs xinit regarding mounting and power management

bohoomil wrote:

You can as well add the following to your .xinitrc:

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/* ; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

But but but ... the powers-that-are are tinkering with /etc/X11/xinit/xinitrc.d. That script(let) "reads in" /etc/X11/xinit/xinitrc.d/30-dbus, which launches a dbus session in your honour. However, current thinking is that dbus is supposed to do that when it first initializes itself, so the aforementioned powers remvoved it (30-dbus)(in Testing, I guess) from xinitrc.d. They've subsequently put it back, because it probably broke their Thunar too. Anyway, what I'm getting at, for a long time I've had this

#####
## test for an existing bus daemon, just to be safe
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
   ## if not found, launch a new one
    eval `dbus-launch --sh-syntax --exit-with-session`
   echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
fi
#####

in my .xinitrc (and which I found on a wiki somewhere). This does the same thing as /etc/X11/xinit/xinitrc.d/30-dbus, adding a nice line to the log on success, and since it checks first, it can't hurt. The result is that my .xinitrc starts with the script you give, and then does my script; suspenders and a belt, just in case the powers-that-are do more tinkering. That also seems to mean that you don't have to go through all that

 exec dbus-launch --exit-with-session <WM>

Or at least it seems to.

Offline

#5 2012-12-08 19:35:39

bohoomil
Banned
Registered: 2010-09-04
Posts: 2,377
Website

Re: [SOLVED] startx vs xinit regarding mounting and power management

Wow, that's what I didn't know. And it does seem to be a reasonable approach. Thanks for the suggestion, I will try and see how it works for me.


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#6 2012-12-09 00:21:42

ramboman
Member
Registered: 2010-01-23
Posts: 35

Re: [SOLVED] startx vs xinit regarding mounting and power management

I already have some code in .xinitrc sourcing "/etc/X11/xinit/xinitrc.d/30-dbus" for a while. The problem does not change whether dbus-launch is in the "exec [wm]" or not. Trilby mentioned that "startx" is just a script that calls "xinit". I took a look at its execution. When executing startx, the following line is executed:

xinit "$HOME/.xinitrc"  -- "/etc/X11/xinit/xserverrc" :1  -auth /tmp/serverauth.PLXmn1LOx70

removing this:

-- "/etc/X11/xinit/xserverrc"

causes the problem.

I had to add a .xserverrc file in my home to be able to solve the problem, if I have no intention to explicitly mention -- "/etc/X11/xinit/.xserverrc" when executing xinit.

Offline

Board footer

Powered by FluxBB