You are not logged in.
Hi,
I am trying to write some systemd user services to automate starting some of the tools that I use (since I already use systemd so why not..) but unfortunately it either does not start or does not start as I would expect it to.. As an example here's a udiskie service that I tried to write:
[Unit]
Description=Automatically mount newly inserted USB drives
After=graphical-session.target
[Service]
ExecStart=/usr/bin/udiskie -ANt
[Install]
WantedBy=graphical-session.targetThis does not work, the service does not start when looking thru the journal:
Sep 01 15:58:28 hostname udiskie[1660]: udiskie: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
Sep 01 15:58:28 hostname systemd[1425]: udiskie.service: Main process exited, code=exited, status=1/FAILURE
Sep 01 15:58:28 hostname systemd[1425]: udiskie.service: Failed with result 'exit-code'.If i'd change the wantedby line to default.target and drop the after target, it will start but tray icon is not visible, and in the logs I see:
Sep 01 21:07:41 hostname systemd[1502]: udiskie.service: Succeeded.
Sep 01 21:08:51 hostname udiskie[1423]: Not run within X session.
Sep 01 21:08:51 hostname udiskie[1423]: Starting udiskie without tray icon.I am autostarting X upon login on TTY, my display and xauthority are properly set, yet I did try to create a local.conf file with these two variables following wiki but this does not solve the issue I either still can't start udiskie or tray icon is not visible... What am I doing wrong? Is it even possible to start it the way I want it (with icon, without notifications)?
Last edited by kord (2020-09-04 07:50:27)
Offline
https://wiki.archlinux.org/index.php/Sy … _variables
I am autostarting X upon login on TTY, my display and xauthority are properly set, yet I did try to create a local.conf file with these two variables following wiki but this does not solve the issue I either still can't start udiskie or tray icon is not visible
Can you be specific about what you tried to do here. As I understand, user instances of systemd do not inherit any system envirornment variables. So depending on where you tried to set these matters. Give us more deets.
https://wiki.archlinux.org/index.php/Sy … XAUTHORITY
Last edited by CarbonChauvinist (2020-09-03 12:52:30)
"the wind-blown way, wanna win? don't play"
Offline
Should the above not be sufficient, post all files that give a you "autologin into x" and relevant dependencies.
(In particular, make sure you've seen: https://wiki.archlinux.org/index.php/Xinit#xserverrc
https://wiki.archlinux.org/index.php/Xinit#xinitrc )
Online
https://wiki.archlinux.org/index.php/Sy … _variables
kord wrote:I am autostarting X upon login on TTY, my display and xauthority are properly set, yet I did try to create a local.conf file with these two variables following wiki but this does not solve the issue I either still can't start udiskie or tray icon is not visible
Can you be specific about what you tried to do here. As I understand, user instances of systemd do not inherit any system envirornment variables. So depending on where you tried to set these matters. Give us more deets.
Based on the link you've posted the two required env variables should be auto set by a systemd script, thou I decided to test out if setting them manually would yield any change:
cat ~/.config/environment.d/local.conf
# Display and XAUTHORITY env variables for user services
DISPLAY=:0
XAUTHORITY=/home/kord/.Xauthorityas for auto login, normally I login at TTY and start X via startx (I sometimes do some quick stuff there and log off), but decided to test out auto starting via bash_profile (taken from wiki):
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
# autostart X
if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx
fimy 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
# annoying bell off
xset b off
#set screen resolution, and refresh rate
xrandr --output DisplayPort-1 --mode 2560x1440 --rate 144 &
# start i3
exec i3Not sure what else could be useful here..
Offline
Particularly see the .xserverrc part. That said if what you just described is how you are intending to use your system a systemd user service seems like the wrong approach to me. start it as part of your .xinitrc as you want to start it within your x session scope. It only makes sense as an --user service if you go full user service (i.e. you create an additional user service that invokes xorg and so you can then depend on that service in your graphical environment needing user services) or you switch to a DM, in which case xorg is guaranteed to be available before a login is invoked.
Online
Thanks Videl, would it make more sense if I'd skip the graphical target and instead use default one (skipping icon?) I found this as a solution from one of the contributors to udiskie.. Or maybe I should try making a i3 user service that would start it and try to start the wm this way? Would it work, does it make more sense? I will eventually switch back to sway once the issues I had there are resolved, so keeping it with user services seem like a better/cleaner (?) approach..
Edit: I did some further reading today, a github repo (that was also linked in the wiki) that explains further what V1idel was saying about a service to start X, so I guess the issue is somewhat solved. Thanks for your help V1idel.
Last edited by kord (2020-09-04 07:50:44)
Offline