How to start appimaged via systemd

Guru’s,

I am struggeling a bit with starting appimaged via systemd. The appimaged package is installed and comes with a service file in /usr/lib/systemd/user/appimaged.service (which makes sence since it should run under uid of a “normal” user).
In /home/arjan/.config/systemd/user/graphical.target.wants a link is made to the (package) appimaged.service file:

arjan@arjanpc:~> ls -l /home/arjan/.config/systemd/user/graphical.target.wants
totaal 0
lrwxrwxrwx 1 arjan users 39 15 jan 20:53 appimaged.service -> /usr/lib/systemd/user/appimaged.service
arjan@arjanpc:~> 

The service file itself is straightforward:

[Unit]
Description=AppImage daemon
After=basic.target

[Service]
ExecStart=/usr/bin/appimaged
Restart=always
RestartSec=5s
StartLimitInterval=0

[Install]
WantedBy=graphical.target

I have enabled (as user arjan) appimaged but after login appimaged is not started, however if I start it manually it does what it should do.

arjan@arjanpc:~> systemctl --user status  appimaged
● appimaged.service - AppImage daemon
   Loaded: loaded (/usr/lib/systemd/user/appimaged.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
arjan@arjanpc:~> systemctl --user start  appimaged
arjan@arjanpc:~> systemctl --user status  appimaged
● appimaged.service - AppImage daemon
   Loaded: loaded (/usr/lib/systemd/user/appimaged.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-01-16 20:09:02 CET; 17s ago
 Main PID: 2881 (appimaged)
   CGroup: /user.slice/user-1000.slice/user@1000.service/appimaged.service
           └─2881 /usr/bin/appimaged
arjan@arjanpc:~>

Any hints or tips on what I am missing?

There is no user graphical.target, just user default.target.

Sorry but there IS a graphical.target, loaded and set as default target:

arjanpc:/usr/lib/systemd # cat ./system/graphical.target
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
Wants=display-manager.service
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes
arjanpc:/usr/lib/systemd # systemctl list-units --type target
UNIT                   LOAD   ACTIVE SUB    DESCRIPTION                  
basic.target           loaded active active Basic System                 
cryptsetup.target      loaded active active Local Encrypted Volumes      
getty.target           loaded active active Login Prompts                
graphical.target       loaded active active Graphical Interface          
local-fs-pre.target    loaded active active Local File Systems (Pre)     
local-fs.target        loaded active active Local File Systems           
multi-user.target      loaded active active Multi-User System            
network-online.target  loaded active active Network is Online            
network.target         loaded active active Network                      
nfs-client.target      loaded active active NFS client services          
nss-lookup.target      loaded active active Host and Network Name Lookups
nss-user-lookup.target loaded active active User and Group Name Lookups  
paths.target           loaded active active Paths                        
remote-fs-pre.target   loaded active active Remote File Systems (Pre)    
remote-fs.target       loaded active active Remote File Systems          
rpcbind.target         loaded active active RPC Port Mapper              
slices.target          loaded active active Slices                       
sockets.target         loaded active active Sockets                      
sound.target           loaded active active Sound Card                   
swap.target            loaded active active Swap                         
sysinit.target         loaded active active System Initialization        
time-sync.target       loaded active active System Time Synchronized     
timers.target          loaded active active Timers                       

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

23 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
arjanpc:/usr/lib/systemd # systemctl get-default
graphical.target
arjanpc:/usr/lib/systemd #

So I must be missing/overlooking something else :slight_smile:

BUT, thanks for looking at suggestion!!

arvidjaar, I have to admit that my previous reply was send to early. You speak about “user” targets while I was refering to “system” targets. … sorry my mistake.

The test I did was that I extended my systemd configuration in $HOME/.config:

arjan@arjanpc:~/.config/systemd/user> ls -lR
.:
totaal 8
drwxr-xr-x 2 arjan users 4096 17 jan 11:45 default.target.wants
drwxr-xr-x 2 arjan users 4096 15 jan 20:53 graphical.target.wants

./default.target.wants:
totaal 0
lrwxrwxrwx 1 arjan users 39 17 jan 11:45 appimaged.service -> /usr/lib/systemd/user/appimaged.service

./graphical.target.wants:
totaal 0
lrwxrwxrwx 1 arjan users 39 15 jan 20:53 appimaged.service -> /usr/lib/systemd/user/appimaged.service
arjan@arjanpc:~/.config/systemd/user> cat /usr/lib/systemd/user/appimaged.service
[Unit]
Description=AppImage daemon
After=basic.target

[Service]
ExecStart=/usr/bin/appimaged
Restart=always
RestartSec=5s
StartLimitInterval=0

[Install]
#WantedBy=graphical.target
WantedBy=default.target
arjan@arjanpc:~/.config/systemd/user>

The graphical.target.wants folder was already there, I created the default.target.wants folder and created a link to the service file. The service file states the default.target.

Logged-out and in … still inactive :frowning:

You show the system graphical target, not the user graphical target (which I can understand that it does not exist).

Ps, I never tried to use systemd on the user level, but found this: https://wiki.archlinux.org/index.php/Systemd/User

There is something there about the target.

“Logged-out” does not necessarily mean systemd user instance was stopped and then started. Reboot to be sure; if it still does not work, post (upload to https://susepaste.org) output of “journalctl -b”.

It seems that my answer was about 14 minutes after you detected that already. Sorry, but in the mean time I tried to find some information about this and kept the answer open without sending it.

All, Thanks for spending time on this. I’ll investigate further and let you know the outcome.

Read any system events related to this service with the following command. If you want to read a previous boot, apply the addiitonal “-b -number” flag where *number *is the iternative boot count. You’re looking for whether the service started at all when you logged in and then stopped or if it never started at all.

journalctl -u appimaged.service

You can also try running the following as described in the ArchWiki reference by henk… It is used to automatically start any User systemd services on login…

# loginctl enable-linger *username*

TSU

********. …

All,

Thanks for all your effort and time.I now got it up and running. How did I get there?

It was pointed out that graphical.target is not a user target, so that is an error in the service file of appimaged. I replaced this target with default.target. That was again a good suggestion of one of you :wink:
After changing this I logged out and logged back in. Again somebody mentioned that that is probably is not good enough. Rebooting did the trick. It is now running!
Thinking about this, I expect that systemctl daemon-reload would have done the trick as well.

I will search for the opensuse package maintainer and let hem know about this little bug in his service file.

Again, all thanks for spending time and effort on this, really appreciated!!

Congratulations and thanks for reportng back!