You are not logged in.

#1 2012-06-01 20:10:23

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,134
Website

Line in my ~/.profile causes a double login with lxdm -- why? [solved]

My goal is to have lxdm run on the default tty7 and after my user logs in, have an X session on another tty so lxdm always runs on tty7.  I added the following line to my ~/.profile:

exec xinit -- :1 -novtswitch &>/dev/null &

Since /etc/lxdm/xsession sources ~/.profile I assumed that it would put me on the next highest tty.  What it does is to put me into two X sessions at the same time: one on tty7 and one on tty8.  What am I missing?

Using systemd if that matters.  Thanks!

Last edited by graysky (2012-06-02 13:45:01)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2012-06-01 20:44:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,682
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

I don't think I'm following.  You start up with lxdm (X on tty7), and want to go to another tty (say tty1) to start an xsession in tty8 is that right about the goal?

But you find that X is running in both tty7 and tty8 before you log in to any other tty?

Last edited by Trilby (2012-06-01 20:44:49)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2012-06-01 20:46:47

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,134
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

Trilby wrote:

I don't think I'm following.  You start up with lxdm (X on tty7), and want to go to another tty (say tty1) to start an xsession in tty8 is that right about the goal?

But you find that X is running in both tty7 and tty8 before you log in to any other tty?

Yes!

#1) lxdm starts on tty7 just fine
#2) I log into lxdm as normal and it makes TWO different X sessions with my user: one on tty7 and one on tty8

Wild isn't it?  Can you reproduce on your system?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2012-06-01 20:52:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,682
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

No, but I don't use any login/display managers.

In a 'normal' setup are you supposed to call xinit from your .profile to get lxdm to work?  If not, if lxdm starts X in tty7 without that line, then your results are just what I'd expect:
LXDM starts an X-session in tty7, reads .profile, and runs the command (with the -- :1) to launch another xsession in tty8.

Delete the line from .profile.  Use the line that is in .profile as the command from tty1 when you do want to start X in tty8.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2012-06-01 21:30:27

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,134
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

OK.. so the line is only good when starting from a tty not from lxdm?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2012-06-01 21:56:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,682
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

??

No, that line will work when lxdm runs it.  But you don't want lxdm to run it, right?  I thought that was the problem: lxdm was launching a second Xsession on tty8.  It was doing that because that line was telling it to.

That line, whether ran from a tty or in a script sourced by lxdm, will launch a NEW x session.  Lxdm already launches a single x session on tty7, then it reads that line, and launches a new one on tty8.

Last edited by Trilby (2012-06-01 21:57:56)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2012-06-01 21:59:33

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,134
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

I think I understand.  Do you have any insight into how to achieve my goal of keeping lxdm running on tty7 but placing my user's Xsession in tty8 when I authenticate in lxdm?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#8 2012-06-01 22:06:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,682
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

Ooh *lightbulb comes on* now I see what your going for.

So you don't want lxdm to actually start the xsession on tty7.  I'm sure it's possible, but I've never used LXDM, so I don't know if it would be easy.  It would be easy enough to write a (text based) loggin manager that would do just that.

One thing I'd look for is any config file from LXDM that runs "exec startx" or "exec xinit" and try removing the exec.  By default lxdm starts on tty7, waits for you to enter your information, then runs exec (startx|xinit), the "exec" makes the new process (X) replace the lxdm process.  If you logged out of X then you'd be back at a login prompt.  This doesn't happen because your inittab respawn command (or some other daemonizing mechanism) causes lxdm to respawn when nothing else is happening on tty7.

If you remove that exec command, and have it run X as a (backgrounded) subprocess, then that first xsession will start on tty8 as tty7 will still be occupied by lxdm.  That much I know could work.  The problem would be what state lxdm would be in after running that command.  I suspect it is written in such a way that execution of code after that point would be seen as a failed login and it'd ask again for a username.  This would be the result you want.

Edit: I just checked out lxdm, the "exec" commands that would have to be replaced are in /etc/lxdm/Xsession.  I suspect in addition to removing the exec at the beginning of the line, you'd have to add a "&" to the end of the line to background that process.  This may take a good bit of tinkering beyond that though.

Last edited by Trilby (2012-06-01 22:13:27)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2012-06-01 22:23:38

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,134
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

Thanks for the tip.  Since my system does not have /etc/X11/xinit/xinitrc-common, all it does is source /etc/profile and ~/.profile

]$ cat /etc/lxdm/Xsession 
#!/bin/bash

# use bash for "exec -l", howto run login shell by /bin/sh ?

if [ $# -eq 1 -a -n "$1" ]; then
	LXSESSION=$1
else
# default session
	LXSESSION=/usr/bin/startlxde
fi

[ -f /etc/profile ] && . /etc/profile
[ -f ~/.profile ] && . ~/.profile
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile

if [ -f /etc/X11/xinit/xinitrc-common ]; then
# fedora
	. /etc/X11/xinit/xinitrc-common
	if ! [ -z "$XDG_SESSION_COOKIE" ]; then
		CK_XINIT_SESSION=
	elif [ -x /usr/bin/ck-launch-session -a -z "$CK_XINIT_SESSION" ]; then
		CK_XINIT_SESSION="/usr/bin/ck-launch-session"
	fi
	exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
elif [ -x /etc/X11/xinit/Xsession ]; then
# fedora
	exec /etc/X11/xinit/Xsession "$LXSESSION"
elif [ -x /etc/X11/Xsession ]; then
# mandriva, debian, ubuntu
	exec /etc/X11/Xsession "$LXSESSION"
elif [ -x /etc/X11/xinit/xinitrc ]; then
#suse
	export WINDOWMANAGER=$LXSESSION
	exec -l $SHELL -c /etc/X11/xinit/xinitrc
else
# unknown, user should custom /etc/lxdm/xinitrc self
	if [ -x /etc/lxdm/xinitrc ]; then
		. /etc/lxdm/xinitrc
	fi
	if ! [ -z "$XDG_SESSION_COOKIE" ]; then
		CK_XINIT_SESSION=
	elif [ -x /usr/bin/ck-launch-session ]; then
		CK_XINIT_SESSION="/usr/bin/ck-launch-session"
	fi
	exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
fi

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#10 2012-06-01 22:31:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,682
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

Yup, but lower, all those 5 lines starting with exec (I think line #s 26,29,32,etc) that look like

exec -l $SHELL -c /etc/X11/xinit/xinitrc

Could be changed to

$SHELL -l -c /etc/X11/xinit/xinitrc &

or perhaps

nohup $SHELL -l -c /etc/X11/xinit/xinitrc && exit

Or some other permutation.

Last edited by Trilby (2012-06-01 22:31:31)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2012-06-01 22:49:41

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,134
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

Ah, by my system does not have  /etc/X11/xinit/xinitrc-common at all...


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#12 2012-06-01 22:52:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,682
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

LXDM has to execute ONE of those lines.  I just used the xinitrc line as an example.

exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""

would become

$SHELL -l -c "$CK_XINIT_SESSION \"$LXSESSION\"" &

or

nohup $SHELL -l -c "$CK_XINIT_SESSION \"$LXSESSION\"" && exit

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#13 2012-06-02 13:39:06

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,134
Website

Re: Line in my ~/.profile causes a double login with lxdm -- why? [solved]

I emailed the author of lxdm.  Turns out this functionality was built in but not documented:

use lxdm default settings
let user1 login, then run command "lxdm -c USER_SWITCH", let user2 login.

EDIT:  Updated the wiki: https://wiki.archlinux.org/index.php/LX … hing_Users

Last edited by graysky (2012-06-02 13:44:50)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB