You are not logged in.

#1 2017-07-05 03:38:20

krlanguet
Member
Registered: 2017-06-25
Posts: 2

Lightdm for xinitrc with awesome fails, but startx fine

Update: After a clean re-install the lightdm cooperates as desired with my xinitrc and awesome so as long as I enable the session wrapper. I suspect that my xinitrc fails to load something necessary which is loaded by the session wrapper, though casually comparing the two files has not lead me to see what.
I have since switched to a different setup so I will not be looking further, but I recommend that anyone else experiencing this problem make sure that their session wrapper is enabled and unmodified.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

I have used Arch in the past with full DE’s like Gnome or KDE. Now I am trying to get a deeper grasp of the X system and put together my own setup with awesomewm, lightdm, and eventually others. Unfortunately, I am stuck on a rather simple step.

In trying to minimize the number of dotfiles to track (while I’m still learning some of the basics) I’ve opted to focus on my ~/.xinitrc. I have the file configured to launch awesome and I understand how to use it for launching other apps and how it includes other configurations, from Xresources for example. I can run startx from a tty and everything works as desired.

 > ls -l .xinitrc
rw-r--r-- 1 keith keith 802 Jun 29 20:15 .xinitrc
 > .xinitrc
#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

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


# default environment - use for minimal GUI
#twm &
#xclock -geometry 50x50-1+1 &
#xterm -geometry 80x50+494+51 &
#xterm -geometry 80x20+494-0 &
#exec xterm -geometry 80x66+0+0 -name login



# awesome wm
exec awesome

To use lightdm to launch my .xinitrc, I have installed xinit-xsession from the AUR.

 > ls -l /usr/share/xsessions/
total 8
-rw-r--r-- 1 root root 128 Mar 29 20:33 awesome.desktop
-rw-r--r-- 1 root root 163 Jul  2 13:44 xinitrc.desktop
 > awesome.desktop
[Desktop Entry]
Name=awesome
Comment=Highly configurable framework window manager
TryExec=awesome
Exec=awesome
Type=Application
 > xinitrc.desktop
[Desktop Entry]
Name=xinitrc
Comment=Executes the .xinitrc script in your home directory
Exec=xinitrcsession-helper
TryExec=xinitrcsession-helper
Type=Application

I examined the session-wrapper /etc/lightdm/Xsession and did not see anything that my .xinitrc does not already do, so I first tried configuring lightdm as follows (with the wrapper disabled):

 > /etc/lightdm/lightdm.conf
#
# General configuration
#
# start-default-seat = True to always start one seat if none are defined in the configuration
# greeter-user = User to run greeter as
# minimum-display-number = Minimum display number to use for X servers
# minimum-vt = First VT to run displays on
# lock-memory = True to prevent memory from being paged to disk
# user-authority-in-system-dir = True if session authority should be in the system location
# guest-account-script = Script to be run to setup guest account
# logind-check-graphical = True to on start seats that are marked as graphical by logind
# log-directory = Directory to log information to
# run-directory = Directory to put running state in
# cache-directory = Directory to cache to
# sessions-directory = Directory to find sessions
# remote-sessions-directory = Directory to find remote sessions
# greeters-directory = Directory to find greeters
# backup-logs = True to move add a .old suffix to old log files when opening new ones
# dbus-service = True if LightDM provides a D-Bus service to control it
#
[LightDM]
#start-default-seat=true
#greeter-user=lightdm
#minimum-display-number=0
#minimum-vt=7 # Setting this to a value < 7 implies security issues, see FS#46799
#lock-memory=true
#user-authority-in-system-dir=false
#guest-account-script=guest-account
#logind-check-graphical=false
#log-directory=/var/log/lightdm
run-directory=/run/lightdm
#cache-directory=/var/cache/lightdm
sessions-directory=/usr/share/xsessions
#remote-sessions-directory=/usr/share/lightdm/remote-sessions
#greeters-directory=$XDG_DATA_DIRS/lightdm/greeters:$XDG_DATA_DIRS/xgreeters
#backup-logs=true
#dbus-service=true

#
# Seat configuration
#
# Seat configuration is matched against the seat name glob in the section, for example:
# [Seat:*] matches all seats and is applied first.
# [Seat:seat0] matches the seat named "seat0".
# [Seat:seat-thin-client*] matches all seats that have names that start with "seat-thin-client".
#
# type = Seat type (local, xremote, unity)
# pam-service = PAM service to use for login
# pam-autologin-service = PAM service to use for autologin
# pam-greeter-service = PAM service to use for greeters
# xserver-backend = X backend to use (mir)
# xserver-command = X server command to run (can also contain arguments e.g. X -special-option)
# xmir-command = Xmir server command to run (can also contain arguments e.g. Xmir -special-option)
# xserver-config = Config file to pass to X server
# xserver-layout = Layout to pass to X server
# xserver-allow-tcp = True if TCP/IP connections are allowed to this X server
# xserver-share = True if the X server is shared for both greeter and session
# xserver-hostname = Hostname of X server (only for type=xremote)
# xserver-display-number = Display number of X server (only for type=xremote)
# xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true)
# xdmcp-port = XDMCP UDP/IP port to communicate on
# xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf)
# unity-compositor-command = Unity compositor command to run (can also contain arguments e.g. unity-system-compositor -special-option)
# unity-compositor-timeout = Number of seconds to wait for compositor to start
# greeter-session = Session to load for greeter
# greeter-hide-users = True to hide the user list
# greeter-allow-guest = True if the greeter should show a guest login option
# greeter-show-manual-login = True if the greeter should offer a manual login option
# greeter-show-remote-login = True if the greeter should offer a remote login option
# user-session = Session to load for users
# allow-user-switching = True if allowed to switch users
# allow-guest = True if guest login is allowed
# guest-session = Session to load for guests (overrides user-session)
# session-wrapper = Wrapper script to run session with
# greeter-wrapper = Wrapper script to run greeter with
# guest-wrapper = Wrapper script to run guest sessions with
# display-setup-script = Script to run when starting a greeter session (runs as root)
# display-stopped-script = Script to run after stopping the display server (runs as root)
# greeter-setup-script = Script to run when starting a greeter (runs as root)
# session-setup-script = Script to run when starting a user session (runs as root)
# session-cleanup-script = Script to run when quitting a user session (runs as root)
# autologin-guest = True to log in as guest by default
# autologin-user = User to log in with by default (overrides autologin-guest)
# autologin-user-timeout = Number of seconds to wait before loading default user
# autologin-session = Session to load for automatic login (overrides user-session)
# autologin-in-background = True if autologin session should not be immediately activated
# exit-on-failure = True if the daemon should exit if this seat fails
#
[Seat:*]
#type=local
#pam-service=lightdm
#pam-autologin-service=lightdm-autologin
#pam-greeter-service=lightdm-greeter
#xserver-backend=
#xserver-command=X
#xmir-command=Xmir
#xserver-config=
#xserver-layout=
#xserver-allow-tcp=false
#xserver-share=true
#xserver-hostname=
#xserver-display-number=
#xdmcp-manager=
#xdmcp-port=177
#xdmcp-key=
#unity-compositor-command=unity-system-compositor
#unity-compositor-timeout=60
#greeter-session=example-gtk-gnome
#greeter-hide-users=false
#greeter-allow-guest=true
#greeter-show-manual-login=false
#greeter-show-remote-login=true
user-session=xinitrc
#allow-user-switching=true
#allow-guest=true
#guest-session=
#session-wrapper=/etc/lightdm/Xsession
#greeter-wrapper=
#guest-wrapper=
#display-setup-script=
#display-stopped-script=
#greeter-setup-script=
#session-setup-script=
#session-cleanup-script=
#autologin-guest=false
#autologin-user=
#autologin-user-timeout=0
#autologin-in-background=false
#autologin-session=
#exit-on-failure=false

#
# XDMCP Server configuration
#
# enabled = True if XDMCP connections should be allowed
# port = UDP/IP port to listen for connections on
# listen-address = Host/address to listen for XDMCP connections (use all addresses if not present)
# key = Authentication key to use for XDM-AUTHENTICATION-1 or blank to not use authentication (stored in keys.conf)
# hostname = Hostname to report to XDMCP clients (defaults to system hostname if unset)
#
# The authentication key is a 56 bit DES key specified in hex as 0xnnnnnnnnnnnnnn.  Alternatively
# it can be a word and the first 7 characters are used as the key.
#
[XDMCPServer]
#enabled=false
#port=177
#listen-address=
#key=
#hostname=

#
# VNC Server configuration
#
# enabled = True if VNC connections should be allowed
# command = Command to run Xvnc server with
# port = TCP/IP port to listen for connections on
# listen-address = Host/address to listen for VNC connections (use all addresses if not present)
# width = Width of display to use
# height = Height of display to use
# depth = Color depth of display to use
#
[VNCServer]
#enabled=false
#command=Xvnc
#port=5900
#listen-address=
#width=1024
#height=768
#depth=8
 > lightdm-gtk-greeter.conf
# LightDM GTK+ Configuration
# Available configuration options listed below.
#
# Appearance:
#  theme-name = GTK+ theme to use
#  icon-theme-name = Icon theme to use
#  background = Background file to use, either an image path or a color (e.g. #772953)
#  user-background = false|true ("true" by default)  Display user background (if available)
#  transition-duration = Length of time (in milliseconds) to transition between background images ("500" by default)
#  transition-type = ease-in-out|linear|none  ("ease-in-out" by default)
#
# Fonts:
#  font-name = Font to use
#  xft-antialias = false|true  Whether to antialias Xft fonts
#  xft-dpi = Resolution for Xft in dots per inch (e.g. 96)
#  xft-hintstyle = none|slight|medium|hintfull  What degree of hinting to use
#  xft-rgba = none|rgb|bgr|vrgb|vbgr  Type of subpixel antialiasing
#
# Login window:
#  active-monitor = Monitor to display greeter window (name or number). Use #cursor value to display greeter at monitor with cursor. Can be a semicolon separated list
#  position = x y ("50% 50%" by default)  Login window position
#  default-user-image = Image used as default user icon, path or #icon-name
#  hide-user-image = false|true ("false" by default)
#
# Panel:
#  panel-position = top|bottom ("top" by default)
#  clock-format = strftime-format string, e.g. %H:%M
#  indicators = semi-colon ";" separated list of allowed indicator modules. Built-in indicators include "~a11y", "~language", "~session", "~power", "~clock", "~host", "~spacer". Unity indicators can be represented by short name (e.g. "sound", "power"), service file name, or absolute path
#
# Accessibility:
#  a11y-states = states of accessibility features: "name" - save state on exit, "-name" - disabled at start (default value for unlisted), "+name" - enabled at start. Allowed names: contrast, font, keyboard, reader.
#  keyboard = command to launch on-screen keyboard (e.g. "onboard")
#  keyboard-position = x y[;width height] ("50%,center -0;50% 25%" by default)  Works only for "onboard"
#  reader = command to launch screen reader (e.g. "orca")
#
# Security:
#  allow-debugging = false|true ("false" by default)
#  screensaver-timeout = Timeout (in seconds) until the screen blanks when the greeter is called as lockscreen
#
# Template for per-monitor configuration:
#  [monitor: name]
#  background = overrides default value
#  user-background = overrides default value
#  laptop = false|true ("false" by default) Marks monitor as laptop display
#  transition-duration = overrides default value
#
[greeter]
#background=
#user-background=
#theme-name=
#icon-theme-name=
#font-name=
#xft-antialias=
#xft-dpi=
#xft-hintstyle=
#xft-rgba=
#indicators=~session; ~power; ~clock; ~host
clock-format=%H:%M
#keyboard=
#reader=
#position=
#screensaver-timeout=

Unfortunately, after enabling lightdm service (with the below command) and rebooting I can enter my password and change the selected session, but regardless of what I select, lightdm never launches awesome and instead keeps returning to itself.

 > sudo systemctl enable lightdm 

The same result occurs with the wrapper enabled and awesome selected in the conf. I have read all of the arch wiki pages that I thought could be relevant and browsed/searched the manual pages for lightdm, awesome, xinit, startx and others. I have also tried testing lightdm in test-mode with xorg-server-xephyr but I have been unable to make heads or tails of much there.

Here is some more information that I thought might be helpful:

 > ls -l .Xauthority
-rw------- 1 keith keith 159 Jul  4 17:39 .Xauthority
 > sudo tail /var/log/lightdm/lightdm.log
[+30.07s] DEBUG: Sending signal 9 to process 485
[+30.08s] DEBUG: Process 485 terminated with signal 9
[+30.08s] DEBUG: XServer 0: X server stopped
[+30.08s] DEBUG: Releasing VT 7
[+30.08s] DEBUG: XServer 0: Removing X server authority /run/lightdm/root/:0
[+30.08s] DEBUG: Seat seat0: Display server stopped
[+30.08s] DEBUG: Seat seat0: Stopped
[+30.08s] DEBUG: Display manager stopped
[+30.08s] DEBUG: Stopping daemon
[+30.08s] DEBUG: Exiting with return value 0

Where should I look next?

Last edited by krlanguet (2017-08-19 17:24:38)

Offline

#2 2017-08-10 05:29:08

ifrite
Member
Registered: 2017-08-05
Posts: 8

Re: Lightdm for xinitrc with awesome fails, but startx fine

I'm also stuck on this. Have you figured it out?

Offline

#3 2017-08-10 06:47:26

seth
Member
Registered: 2012-09-03
Posts: 50,927

Re: Lightdm for xinitrc with awesome fails, but startx fine

Wild guess: remove the "exec" in xinitrc - xinitrcsession-helper has one as well.

Offline

#4 2017-08-19 17:22:21

krlanguet
Member
Registered: 2017-06-25
Posts: 2

Re: Lightdm for xinitrc with awesome fails, but startx fine

Update: After a clean re-install the lightdm cooperates as desired with my xinitrc and awesome so as long as I enable the session wrapper. I suspect that my xinitrc fails to load something necessary which is loaded by the session wrapper, though casually comparing the two files has not lead me to see what.

I have since switched to a different setup so I will not be looking further, but I recommend that anyone else experiencing this problem make sure that their session wrapper is enabled and unmodified.

Offline

#5 2020-07-04 20:17:49

rogue_xc
Member
Registered: 2020-07-04
Posts: 1

Re: Lightdm for xinitrc with awesome fails, but startx fine

I know this is an old issue, but I ran into and fixed it on my computer - although the problem with my setup might not apply to everybody.

tl;dr: my issue was that zsh bindings for fzf were loaded in my ~/.profile and were returning a bad exit code to lightdm's Xsession /bin/sh wrapper, which was causing lightdm to exit early.

I was getting the same issue - after authenticating as my user in lightdm, the screen would blink and lightdm sent me back to itself without doing anything.

In my xinit, I have the following relevant lines:

> .xinitrc
# <snipped>

exec >>~/.xsession-errors 2>&1

exec bspwm -c $HOME/.config/bspwm/bspwmrc

I debugged this with sudo lightdm --test-mode --debug from a virtual terminal. Reading through it I saw that right after the greeter was requesting a session for xinitrc, it was exiting with return code 2:

$ sudo lightdm --test-mode --debug

** (process:172991): WARNING **: 03:32:58.844: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files
[+3.39s] DEBUG: Session pid=172991: Authentication complete with return value 0: Success
[+3.39s] DEBUG: Authenticate result for user rogue_xc: Success
[+3.39s] DEBUG: User rogue_xc authorized
[+3.40s] DEBUG: Greeter requests session xinitrc
[+3.40s] DEBUG: Seat seat0: Stopping greeter; display server will be re-used for user session
[+3.40s] DEBUG: Session pid=172977: Sending SIGTERM
[+3.41s] DEBUG: Greeter closed communication channel
[+3.41s] DEBUG: Session pid=172977: Exited with return value 0
[+3.41s] DEBUG: Seat seat0: Session stopped
[+3.41s] DEBUG: Seat seat0: Greeter stopped, running session
[+3.41s] DEBUG: Registering session with bus path /org/freedesktop/DisplayManager/Session0
[+3.41s] DEBUG: posix_spawn avoided (fd close requested) (child_setup specified) 
[+3.41s] DEBUG: Session pid=172991: Running command /etc/lightdm/Xsession xinitrcsession-helper
[+3.41s] DEBUG: Creating shared data directory /var/lib/lightdm-data/rogue_xc
[+3.41s] DEBUG: Session pid=172991: Logging to .xsession-errors

** (process:172991): WARNING **: 03:32:58.877: Failed to open CK session: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.ConsoleKit was not provided by any .service files
[+3.42s] DEBUG: Activating VT 7
[+3.44s] DEBUG: Session pid=172991: Exited with return value 2
[+3.44s] DEBUG: Seat seat0: Session stopped
[+3.44s] DEBUG: Seat seat0: Stopping display server, no sessions require it
[+3.44s] DEBUG: Sending signal 15 to process 172961
[+3.94s] DEBUG: Process 172961 exited with return value 0
[+3.94s] DEBUG: XServer 0: X server stopped
> .xsession-errors

/usr/share/fzf/key-bindings.zsh: line 22: syntax error near unexpected token `)'
/usr/share/fzf/key-bindings.zsh: line 22: `  () {'

Poking into lightdm's wrapper (cut down for brevity):

> /etc/lightdm/Xsession

#!/bin/sh
#
# LightDM wrapper to run around X sessions.

echo "Running X session wrapper"

# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
##

# Load resources
for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
##

# Load keymaps
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
##

# Load xmodmap if not using XKB
if [ -z "$XKB_IN_USE" ]; then
##

# Run all system xinitrc shell scripts
xinitdir="/etc/X11/xinit/xinitrc.d"
if [ -d "$xinitdir" ]; then
##

# Run user xsession shell script
script="$HOME/.xsession"
if [ -x "$script" -a ! -d "$script" ]; then
##

exec $@

The wrapper is sourcing quite a few files, and uses /bin/sh as its shell. I source fzf.zsh in my ~/.profile, and when the Xsession wrapper was getting exit code 2 back from sourcing a zsh file (incompatible with sh) it just stopped early.

My solution was to update my profile like this:

> ~/.profile

if [[ -n "$ZSH" ]]; then
    # ($ZSH is set inside my .zshrc)
    [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
fi

lightdm's wrapper isn't starting a login shell, so it never sources my .zshrc so doesn't run into the fzf.zsh error anymore. Can now use lightdm to call xinitrcsession-helper.

I suppose if you're still seeing a problem like this, ensure that all the files sourced by the Xsession wrapper or by your .xinitrc return exit codes of 0 (success) when sourced from a /bin/sh shell.

Offline

Board footer

Powered by FluxBB