You are not logged in.

#1 2018-03-18 15:54:39

glasgowgrrrl
Member
Registered: 2018-03-18
Posts: 3

[SOLVED] Unable to start Fetchmail daemon with systemd

I have used Debian-based systems ([k]Ubuntu/Mint/) for 15 years now, and have recently migrated to Arch. The setup went smoothly and most things I need are working well. I have had a problem with Fetchmail, however. I have plugged the gap with Getmail for now but as I have several email sources to collate (and because I'm stubborn and hate leaving a problem unsolved) I'd really like to get Fetchmail working.

Previously I handled all my mail with Fetchmail/Exim/Dovecot. This has always been straightforward, and in particular my /etc/fetchmailconf file (which I won't reproduce here) has served for years with only minor tweaks. Indeed, Fetchmail runs without problems as a local user under Arch. It's when I try to run it as a system daemon that the problem arises.

First of all, I copied over my local .fetchmailrc and established that the permissions were correct.

[enitharmon@eilidh ~]$ sudo cp ~/.fetchmailrc /etc/fetchmailrc
[enitharmon@eilidh ~]$ lsl /etc/fetchmailrc 
-rw------- 1 root root 1250 Mar 18 15:04 /etc/fetchmailrc

Then I attempted to start Fetchmail in systemd. There was no feedback and i checked the status.

[enitharmon@eilidh ~]$ sudo systemctl enable fetchmail.service
[enitharmon@eilidh ~]$ sudo systemctl start fetchmail.service
[enitharmon@eilidh ~]$ sudo systemctl status fetchmail.service
● fetchmail.service - Fetchmail
   Loaded: loaded (/usr/lib/systemd/system/fetchmail.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2018-03-18 15:08:38 GMT; 20s ago
  Process: 6410 ExecStart=/usr/bin/fetchmail -d 900 -f /etc/fetchmailrc (code=exited, status=6)
 Main PID: 6410 (code=exited, status=6)

Mar 18 15:08:38 eilidh systemd[1]: Started Fetchmail.
Mar 18 15:08:38 eilidh fetchmail[6410]: File /etc/fetchmailrc must be owned by you.
Mar 18 15:08:38 eilidh systemd[1]: fetchmail.service: Main process exited, code=exited, status=6/NOTCONFIGURED
Mar 18 15:08:38 eilidh systemd[1]: fetchmail.service: Failed with result 'exit-code'.

I'd never seen that 'must be owned by you' message before, so I went to Google. It seems that it's not enitharmon that needs to own the file but user fetchmail, so I changed it

[enitharmon@eilidh ~]$ sudo chown fetchmail /etc/fetchmailrc 
[sudo] password for enitharmon: 
[enitharmon@eilidh ~]$ lsl /etc/fetchmailrc 
-rw------- 1 fetchmail root 1250 Mar 18 15:04 /etc/fetchmailrc

Then I tried again to fire up the daemon

[enitharmon@eilidh ~]$ sudo systemctl start fetchmail.service
[enitharmon@eilidh ~]$ sudo systemctl status fetchmail.service
● fetchmail.service - Fetchmail
   Loaded: loaded (/usr/lib/systemd/system/fetchmail.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2018-03-18 15:35:59 GMT; 4s ago
  Process: 6684 ExecStart=/usr/bin/fetchmail -d 900 -f /etc/fetchmailrc (code=exited, status=8)
 Main PID: 6684 (code=exited, status=8)

Mar 18 15:35:59 eilidh systemd[1]: Started Fetchmail.
Mar 18 15:35:59 eilidh systemd[1]: fetchmail.service: Main process exited, code=exited, status=8/n/a
Mar 18 15:35:59 eilidh systemd[1]: fetchmail.service: Failed with result 'exit-code'.

Fetchmail's exit code 8 is

FetchmailManual wrote:

Client-side exclusion error. This means fetchmail either found another copy of itself already running, or failed in such a way that it isn’t sure whether another copy is running.

so I checked:

[enitharmon@eilidh ~]$ ps aux | grep fetchmail
enithar+  6881  0.0  0.0  10888  2468 pts/2    S+   15:45   0:00 grep fetchmail

and there's nothing there beyond my own request.

The dearth of information I found from Googling this new error suggests that either I've done something wrong or I've missed something. Is anybody here able to point me in the right direction?

Last edited by glasgowgrrrl (2018-03-18 18:05:43)

Offline

#2 2018-03-18 17:29:10

loqs
Member
Registered: 2014-03-06
Posts: 18,437

Re: [SOLVED] Unable to start Fetchmail daemon with systemd

glasgowgrrrl wrote:

in particular my /etc/fetchmailconf file (which I won't reproduce here) has served for years with only minor tweaks.

I suspect you are wrongly concluding that it can not be a config issue because it worked on other distributions and not sharing it does not help confirm if it is a config issue.
Please remember arch may not use the same service files or have packages configured the same way as another distributiuon

#cat /etc/fetchmailrc 
set pidfile=/run/fetchmail/fetchmail.pid

poll localhost protocol pop3 username "username" password "XXX"
systemctl start fetchmail.service
systemctl status fetchmail.service
● fetchmail.service - Fetchmail
   Loaded: loaded (/usr/lib/systemd/system/fetchmail.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-03-18 17:23:26 UTC; 3s ago
 Main PID: 2995 (fetchmail)
    Tasks: 1 (limit: 4915)
   Memory: 704.0K
   CGroup: /system.slice/fetchmail.service
           └─2995 /usr/bin/fetchmail -d 900 -f /etc/fetchmailrc

Offline

#3 2018-03-18 17:57:59

glasgowgrrrl
Member
Registered: 2018-03-18
Posts: 3

Re: [SOLVED] Unable to start Fetchmail daemon with systemd

Thank you. That appears to have done the trick.

Offline

#4 2018-03-18 18:00:57

loqs
Member
Registered: 2014-03-06
Posts: 18,437

Re: [SOLVED] Unable to start Fetchmail daemon with systemd

The arch wiki is not my area of expertise but you could create a wiki page for fetchmail covering the steps required for system wide configuration.

Offline

#5 2018-03-18 18:07:08

glasgowgrrrl
Member
Registered: 2018-03-18
Posts: 3

Re: [SOLVED] Unable to start Fetchmail daemon with systemd

I could indeed. Not right now though, I need a break!

I could do with amending the Exim page too. That one I've cracked.

Offline

Board footer

Powered by FluxBB