You are not logged in.
Pages: 1
Hi all,
I used to start my wm automatically from tty login using the following in .profile:
if [[ ! $DISPLAY && -z `pgrep -u $USER xinit` ]]; then
xinit &
exit
fi
This would automatically start the wm and then logout, freeing up the tty, but the X session would persist.
Since the recent update to util-linux and shadow, this no longer works because the X session is killed upon logout. This is not specific to X, any process launched to the background in .bashrc or .profile is killed on logout. On the other hand, simply executing
xinit & exit
at the console gives the previous behaviour where the X session persists after logout.
Does anyone know why this has changed and if it is possible to go back to the old behaviour?
Last edited by fijit (2012-07-06 13:34:05)
Offline
- Nevermind -
I still have what you describe as the "old" behavior. When did this change for you?
Last edited by Trilby (2012-07-06 14:34:17)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
exec xinit
xinit & disown
exit
The first one only works if it's the last one in the script.
Last edited by guelfi (2012-07-06 14:44:07)
Offline
- Nevermind -
I still have what you describe as the "old" behavior. When did this change for you?
This changed during the last update of util-linux (2.21.2-3) and shadow (4.1.5.1-1). Downgrading those packages restores the old behaviour.
exec xinit
xinit & disown exit
The first one only works if it's the last one in the script.
Thanks for the suggestions. The first doesn't quite do what I want, which is to logout but leave X running. Instead, the user is logged out when the X session is killed. The second seems to make no difference.
I have found that adding nohup seems to allow what I want to do. Still, I'm curious about why this has changed.
Offline
Post your /etc/inittab.
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
Post your /etc/inittab.
It's not meaningfully changed from default
#
# /etc/inittab
#
# Runlevels:
# 0 Halt
# 1(S) Single-user
# 2 Not used
# 3 Multi-user
# 4 Not used
# 5 X11
# 6 Reboot
## Only one of the following two lines can be uncommented!
# Boot to console
id:3:initdefault:
# Boot to X11
#id:5:initdefault:
rc::sysinit:/etc/rc.sysinit
rs:S1:wait:/etc/rc.single
rm:2345:wait:/etc/rc.multi
rh:06:wait:/etc/rc.shutdown
su:S:wait:/sbin/sulogin -p
# -8 options fixes umlauts problem on login
c1:2345:respawn:/sbin/agetty --noclear -8 -s 38400 tty1 linux
c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux
c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux
#c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux
#c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux
# Serial Virtual Console for KVM and others VMs
#s0:2345:respawn:/sbin/agetty -8 -s 9600 ttyS0 linux
# Hypervisor Virtual Console for Xen and KVM
#h0:2345:respawn:/sbin/agetty -8 -s 38400 hvc0 linux
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# Example lines for starting a login manager
#x:5:respawn:/usr/bin/xdm -nodaemon
#x:5:respawn:/usr/sbin/gdm -nodaemon
#x:5:respawn:/usr/bin/kdm -nodaemon
#x:5:respawn:/usr/bin/slim >/dev/null 2>&1
# End of file
Offline
xinit & disown
exit
works for me with both bash and zsh.
Offline
xinit & disown exit
works for me with both bash and zsh.
Well, not for me. This is fine in any other script but not if included in .bashrc or .profile.
Offline
I think you mean ~/.bash_profile, not "~/.profile". Maybe that's why it's not working.
~/.bashrc is for aliases and such.
http://www.cyberciti.biz/faq/change-bash-profile/
~/.bashrc file runs every time you open a new non-login bash shell such as xterm / aterm
~/.bash_profile runs only with login shells i.e when you first log in into system.
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
Before the util-linux-2.21.2-3 update, I was doing manual logins like this:
# ~/.bash_profile
nohup xinit -- /usr/bin/X -br -nolisten tcp vt7 &> /dev/null &
sleep 5
exit
# or, alternatively:
xinit -- /usr/bin/X -br -nolisten tcp vt7 &> /dev/null &
disown -h
sleep 5
exit
# ~/.xinitrc
exec ck-launch-session dbus-launch --exit-with-session openbox-session
But, as several others have also found, the update has broken that, as the X session will now just get killed on exit.
I'm pretty sure that the source of the problem is the change from using shadow/login to util-linux/login, as the two implementations obviously don't behave in precisely the same way.
Anyway, I have found that the original behaviour can be restored by making use of the setsid command (also from util-linux):
# ~/.bash_profile
setsid xinit -- /usr/bin/X -br -nolisten tcp vt7 &> /dev/null &
sleep 5
exit
Offline
I think you mean ~/.bash_profile, not "~/.profile". Maybe that's why it's not working.
~/.bashrc is for aliases and such.
When bash is invoked as an interactive login shell ..., it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order
and .bashrc is called from (my) .profile. .bashrc not be the "correct" place for login commands but it works.
I'm pretty sure that the source of the problem is the change from using shadow/login to util-linux/login, as the two implementations obviously don't behave in precisely the same way.
Anyway, I have found that the original behaviour can be restored by making use of the setsid command (also from util-linux):
I guess that is it. Strangely, nohup still works for me, but setsid is probably cleaner.
Offline
Pages: 1