You are not logged in.

#1 2017-03-03 21:07:28

sez11a
Member
Registered: 2016-05-11
Posts: 11

systemd user unit can't be found even though it's there

Hi,

I have installed offlineimap and have configured it to grab my email. Now all I want is to run it as a user service. But for whatever reason, systemd does not recognize the unit file is there:

Failed to enable unit: File offlineimap@sezovr.service: No such file or directory

I've symlinked the unit file from /usr/lib/systemd/user like this:

$ ls -l
total 4.0K
lrwxrwxrwx 1 root root   42 Mar  3 11:53 'offlineimap@.service' -> '/usr/lib/systemd/user/offlineimap@.service'
drwxr-xr-x 2 root root 4.0K Mar  1 11:56  sockets.target.wants/

But I cannot get the service to start or enable because systemd seems to be unable to find it.

Does anybody know what I'm doing wrong? Thanks!

Last edited by sez11a (2017-03-03 21:21:50)

Offline

#2 2017-03-03 21:10:40

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,606
Website

Re: systemd user unit can't be found even though it's there

Don't manually symlink, use the systemctl --user <start|enable> $target ... does doing that give a different result?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2017-03-03 21:15:10

sez11a
Member
Registered: 2016-05-11
Posts: 11

Re: systemd user unit can't be found even though it's there

Here's the result:

[root@enterprise:user]# systemctl --user start offlineimap@sezovr
Failed to connect to bus: Operation not permitted

Offline

#4 2017-03-03 21:16:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: systemd user unit can't be found even though it's there

Please edit your post and choose a title that actually reflects your issue: https://wiki.archlinux.org/index.php/Co … ow_to_post


You run --user services from ~/.config/systemd/user/


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2017-03-03 21:36:18

atomicbeef
Member
Registered: 2015-09-30
Posts: 98

Re: systemd user unit can't be found even though it's there

Don't run systemd services as root, run them as a regular user.

EDIT: Are you using root as your day to day user?

Last edited by atomicbeef (2017-03-03 21:37:07)

Offline

#6 2017-03-03 21:47:18

sez11a
Member
Registered: 2016-05-11
Posts: 11

Re: systemd user unit can't be found even though it's there

atomicbeef wrote:

Don't run systemd services as root, run them as a regular user.

EDIT: Are you using root as your day to day user?

No; absolutely not. I was just trying to make sure  it wasn't a permissions issue, since the error was "operation not permitted."

I'm trying to run this as a user service that runs at logon. This is a new install; on my old install, I could, as a user, simply issue:

systemctl start offlineimap@sezovr

and it would start/enable/whatever. I don't remember configuring anything to make this work before, so now I'm confused as to why it's not working.

Offline

#7 2017-03-03 21:51:12

loqs
Member
Registered: 2014-03-06
Posts: 17,638

Re: systemd user unit can't be found even though it's there

General_troubleshooting#Session_permissions
Also what is the output of

$ printenv DBUS_SESSION_BUS_ADDRESS

Offline

#8 2017-03-03 21:53:18

atomicbeef
Member
Registered: 2015-09-30
Posts: 98

Re: systemd user unit can't be found even though it's there

Try the --user flag.

systemctl start offlineimap --user

Offline

#9 2017-03-03 22:01:50

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: systemd user unit can't be found even though it's there

sez11a wrote:

I've symlinked the unit file from /usr/lib/systemd/user like this:

$ ls -l
total 4.0K
lrwxrwxrwx 1 root root   42 Mar  3 11:53 'offlineimap@.service' -> '/usr/lib/systemd/user/offlineimap@.service'
drwxr-xr-x 2 root root 4.0K Mar  1 11:56  sockets.target.wants/

Is this a symlink pointing to itself? Even if that symlink is not in /usr/lib/systemd/user, what is its purpose?

What you should have (after `systemctl --user enable ...`) is a symlink in ~/.config/systemd/user/mail.target.wants/ that points to the template provided by the package and the name of this symlink should include an account name after the @. And then mail.target should also be enabled.

Last edited by Raynman (2017-03-03 22:03:01)

Offline

#10 2017-03-03 22:04:16

sez11a
Member
Registered: 2016-05-11
Posts: 11

Re: systemd user unit can't be found even though it's there

atomicbeef wrote:

Try the --user flag.

systemctl start offlineimap --user

Wow; okay--that worked. Thanks! I guess something in the syntax of systemd changed? I've now enabled it with the same syntax and that worked too:

$ systemctl enable offlineimap --user
Created symlink /home/sezovr/.config/systemd/user/mail.target.wants/offlineimap.service → /usr/lib/systemd/user/offlineimap.service.

Thank you very much!

Offline

#11 2017-03-03 23:54:05

sez11a
Member
Registered: 2016-05-11
Posts: 11

Re: systemd user unit can't be found even though it's there

Okay, so I guess I still have a problem. After enabling the service this way:

systemctl enable offlineimap --user

and then rebooting, the service doesn't start. Is there something else I have to do?

Offline

#12 2017-03-04 09:58:28

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: systemd user unit can't be found even though it's there

You've now enabled a different service than the one we we're talking about before. Whether that's better, worse or just as good depends on your needs.

I answered your last question in my previous reply; maybe you missed it because you were posting around the same time.

Offline

Board footer

Powered by FluxBB