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 tmuxLoaded: loaded (/home/toogley/.dotfiles/systemd/user/mail.service; enabled; vendor preset: enabled)Active: inactive (dead)$ tmux attach-session -t mailcan't find session mailI 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.serviceDescription=load offlineimap for all mail accounts inside tmuxAfter=network.target graphical.targetRequires=gpg-agent.service[Service]Type=oneshotRemainAfterExit=yesExecStart=/usr/bin/tmux new-session -d -s mail -n dev 'export GPG_TTY=$(tty) && \offlineimap'ExecStop=/usr/bin/tmux kill-window -t mailExecReload=/usr/bin/kill -s USR1 $(pgrep offlineimap)[Install]WantedBy=graphical.targetmy gpg-agent.service:[Unit]Description=GnuPG private key agentIgnoreOnIsolate=true[Service]Type=forkingExecStart=/usr/bin/gpg-agent --daemon --homedir=%h/.gnupgExecStop=/usr/bin/pkill gpg-agentRestart=on-abort[Install]WantedBy=default.targetMy ~/.offlineimaprc[general]accounts = devui = ttyuimetadata = ~/.dev_offimappythonfile=~/.dotfiles/mutt/accounts/decrypt.py[Account dev]synclabels = yeslocalrepository = dev-localremoterepository = dev-remotestatus_backend = sqliteautorefresh = 1quick = 10[Repository dev-local]type = Maildirlocalfolders = ~/mail/dev/[Repository dev-remote]remotepasseval = get_pass(toogley@mailbox.org)ssl = yestype = IMAPremotehost = imap.mailbox.orgremoteuser = toogley@mailbox.orgsslcacertfile = /etc/ssl/certs/ca-bundle.crtkeepalive = 60holdconnectionopen = yes
Systemd Service for Offlineimap + gpg encrypted PW's inside tmux works manually after system start but not autmoatically
systemd;email;gpg agent;offlineimap
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. 