You are not logged in.
Hi,
With zsh as my default shell, I am trying to do automatic login and then launch xmonad from my ~/.xinitrc:
#!/bin/zsh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
# Load resources
xrdb -merge $HOME/.Xresources
unclutter -idle 1 &
xsetroot -cursor_name left_ptr
# Set up an icon tray
trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --alpha 0 --tint 0x000000 --height 17 &
# disable trackpad while typing
syndaemon -k -i 0.6 -d &
/usr/bin/start-pulseaudio-x11
export DISPLAY=":0"
xmonad
#exec xmonad DOESNT MAKE MUCH DIFFERENCEthe hard drive light flashes a bit then stops but the screen remains
completely blank. If I press the keys to spawn a terminal and blindly type
$ grep -r x *the hard drive light flashes away as if it is doing something. If I switch
terminals to tty2, log in, I get:
'Cannot open display "default display"'
which comes from the line 'setxkbmap gb' in my ~/.zshrc . Looking at the processes:
$ ps aux | grep x
root 151 0.0 0.0 0 0 ? S< 22:03 0:00 [ext4-rsv-conver]
root 280 0.0 0.0 0 0 ? S< 22:03 0:00 [ext4-rsv-conver]
root 290 0.0 0.0 0 0 ? S< 22:03 0:00 [ext4-rsv-conver]
root 292 0.0 0.0 0 0 ? S< 22:03 0:00 [ext4-rsv-conver]
myles 331 0.0 0.1 13748 1808 tty1 Ss+ 22:04 0:00 /bin/sh /usr/bin/startx
myles 580 0.0 0.0 15896 876 tty1 S+ 22:04 0:00 xinit /home/myles/.xinitrc -- /etc/X11/xinit/xserverrc :0 -auth /tmp/serverauth.3q5MOSDAwz
myles 687 0.0 0.1 13748 1704 tty1 S 22:04 0:00 sh /home/myles/.xinitrc
myles 698 0.0 0.6 143016 6596 tty1 S 22:04 0:00 trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --alpha 0 --tint 0x000000 --height 17
myles 805 0.0 0.0 18004 476 ? S< 22:05 0:00 dbus-launch --autolaunch 25e46ca385a5862de3232ee4000004ad --binary-syntax --close-stderr
myles 850 0.0 0.4 59392 4624 tty1 S 22:05 0:00 /home/myles/.xmonad/xmonad-x86_64-linux
myles 863 2.9 0.8 65716 8540 ? Ss 22:05 0:15 xmobar
root 965 0.0 0.1 30232 1328 ? Ss 22:05 0:00 wpa_supplicant -B -P /run/wpa_supplicant_wlan0.pid -i wlan0 -D nl80211,wext -c/etc/wpa_supplicant.conf
myles 1141 0.4 1.5 84132 15908 ? Ss 22:05 0:02 urxvt
myles 1428 0.0 0.1 13124 1368 tty2 R+ 22:14 0:00 ps aux
myles 1429 0.0 0.1 10916 1100 tty2 S+ 22:14 0:00 grep --color=auto xand things look okay I think. If I kill this process:
myles 687 0.0 0.1 13748 1704 tty1 S 22:04 0:00 sh /home/myles/.xinitrcI get switched back to tty1 and there is a garbled X11 message :
"Suspending AIGLX clients for VT switch"
and
'waiting for X server to shut down urxvt: X connection to ':0' broken, unable
to recover, exiting. XIO: fatal IO error 11 (Resource temporarily
unavailable on X server ":0"'
Switching back to tty2, and:
$ startxit starts up XMonad normally.
If I change the line in the .xinitrc from 'xmonad' to 'exec xmonad' then kill the process that has the description:
xinit /home/myles/.xinitrc -- /etc/X11/xinit/xserverrc :0 -auth /tmp/serverauth.HKVDz7laEOthe same thing happens but when I do startx it almost works: I can see the dark background and the pointer, trayer flashes up then it goes back to the tty. Killing it again and the next startx starts normally.
What do I need to do to have it start up first time on tty1?
Is it something to do with the DISPLAY environment variable? Looking at 'man X' it says "this variable is set automatically by the xterm terminal emulator", well that would be urxvt.
Should it matter that the file /etc/X11/xinit/xserverrc has #!/bin/sh at the top and I am using zsh?
I have this at the end of ~/.zprofile:
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startxThanks.
Last edited by myles (2014-01-01 22:03:25)
Offline
Does the default xorg setup described here run?
Stuff like setxkbmap shouldn't be in your ~/.zshrc since it's reliant on X. I assume you think you're always going to have an X session running, but it's still best to place stuff that is dependent on an X session already running in ~/.xinitrc so that it doesn't run when you do stuff like hop over to a virtual console.
Lines like
export DISPLAY=":0"should probably come before you start running things that expect a properly-set $DISPLAY variable. A lot of stuff that uses the X server might be using this, so keep it near the top to avoid bugs related to having the wrong environment variables set.
One way this can be caused is if one of these processes is starting and then not handing control back to the ~/.xinitrc script process.
First thing I'd try is adding `&` after the lines that might be spawning a process that doesn't immediately close or fork. For example, replace
/usr/bin/start-pulseaudio-x11with
/usr/bin/start-pulseaudio-x11 &which will cause that process to immediately fork to the background. I don't know if start-pulseaudio-x11 automatically does this or not, however, so this might not be the problem.
Last edited by ndt (2014-01-01 17:54:25)
[~/.]
Offline
Change the shebang to sh. Or remove it completely.
Offline
xinit sets DISPLAY, so remove that export too.
And why don't you run the scripts in /etc/X11/xinit/xinitrc.d like /etc/skel/.xinitrc does? Typically that takes care of at least pulseaudio and dbus; you seem to be relying on dbus autostarting, I don't think that's the recommend way.
Offline
Thanks a lot ndt, jasonwryan and Raynman, I did all that you suggested and it works now.
Offline