2

Short description, what i'm searching for:

I want to have a detached tmux session automatically started as a systemd user service. Inside that, offlineimap should start and decrypt my login credentials. The graphical variant of pinentry should ask me for the password for decrypting my login credentials, when I attach to the session. For managing my login credentials, I want to use the program pass.

What I've got so far:

The desired Behavior works perfectly and reproducibly (starting from reboot), when i start the user service after I've logged into my system.

But unfortunately it doesn't work when I do "symstemctl --user enable mail.service" and reboot:

$ systemctl --user status mail ● mail.service - load offlineimap for all mail accounts inside tmux Loaded: loaded (/home/toogley/.dotfiles/systemd/user/mail.service; enabled; vendor preset: enabled) Active: inactive (dead) $ tmux attach-session -t mail can't find session mail 

I have no idea, what i could analyze or what might be the reason. Does somebody has tips how to address this issue?

Thanks a lot!

My mail.service

Description=load offlineimap for all mail accounts inside tmux After=network.target graphical.target Requires=gpg-agent.service [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/bin/tmux new-session -d -s mail -n dev 'export GPG_TTY=$(tty) && \ offlineimap' ExecStop=/usr/bin/tmux kill-window -t mail ExecReload=/usr/bin/kill -s USR1 $(pgrep offlineimap) [Install] WantedBy=graphical.target 

my gpg-agent.service:

[Unit] Description=GnuPG private key agent IgnoreOnIsolate=true [Service] Type=forking ExecStart=/usr/bin/gpg-agent --daemon --homedir=%h/.gnupg ExecStop=/usr/bin/pkill gpg-agent Restart=on-abort [Install] WantedBy=default.target 

My ~/.offlineimaprc

[general] accounts = dev ui = ttyui metadata = ~/.dev_offimap pythonfile=~/.dotfiles/mutt/accounts/decrypt.py [Account dev] synclabels = yes localrepository = dev-local remoterepository = dev-remote status_backend = sqlite autorefresh = 1 quick = 10 [Repository dev-local] type = Maildir localfolders = ~/mail/dev/ [Repository dev-remote] remotepasseval = get_pass("[email protected]") ssl = yes type = IMAP remotehost = imap.mailbox.org remoteuser = [email protected] sslcacertfile = /etc/ssl/certs/ca-bundle.crt keepalive = 60 holdconnectionopen = yes 
3
  • 1
    does journalctl --user give any clues? Commented Jun 5, 2016 at 18:34
  • 1
    in your mail.service you have After=network.target graphical.target and WantedBy=graphical.target which I dont think is workable. Commented Jun 5, 2016 at 18:49
  • @meuh : Thanks for your suggestions - they were very helpful in finding the problem :D Commented Jun 6, 2016 at 16:59

1 Answer 1

0

It seems that what I'm searched for is currently not possible.

Initially I misread the description of graphical.target - I thought this target would be set after the login has happened. Instead, it just sets up the Login Screen (e.g. lightdm). And for "logged into graphical desktop" does currently no target exist.

The ArchLinux Wiki describes a method of starting the window manager per systemd user services - which doesn't work for me, because it depends when the user logs into lightdm.

As a workaround I use an alias for starting my service when I need it.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.