raspberrypi / Raspberry-Pi-OS-64bit

Repository for containing issues on the 64 bit operating system (as distinct from the 32 bit one)
466 stars 21 forks source link

Problem with resolv.conf and fetchmail script #93

Open run2000 opened 4 years ago

run2000 commented 4 years ago

This seemed to start happening on 1 August, having been working ok up until this point.

I was having problems where the eth0 interface would fail to start. Looking in journalctl, I was seeing these error messages:

journalctl -u ifup@eth0.service

Aug 26 10:44:08 eila systemd[1]: Started ifup for eth0.
Aug 26 10:44:13 eila sh[361]: /etc/resolvconf/update-libc.d/fetchmail: 4: /etc/resolvconf/update-libc.d/fetchmail: invoke-rc.d: not found
Aug 26 10:44:13 eila sh[361]: run-parts: /etc/resolvconf/update-libc.d/fetchmail exited with return code 127
Aug 26 10:44:13 eila sh[361]: run-parts: /etc/resolvconf/update.d/libc exited with return code 1
Aug 26 10:44:14 eila sh[361]: RTNETLINK answers: File exists
Aug 26 10:44:14 eila sh[361]: ifup: failed to bring up eth0
Aug 26 10:44:14 eila systemd[1]: ifup@eth0.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 10:44:14 eila systemd[1]: ifup@eth0.service: Failed with result 'exit-code'.
-- Reboot --
Aug 26 12:17:05 eila systemd[1]: Started ifup for eth0.
Aug 26 12:27:03 eila sh[358]: /etc/resolvconf/update-libc.d/fetchmail: 4: /etc/resolvconf/update-libc.d/fetchmail: invoke-rc.d: not found
Aug 26 12:27:03 eila sh[358]: run-parts: /etc/resolvconf/update-libc.d/fetchmail exited with return code 127
Aug 26 12:27:03 eila sh[358]: run-parts: /etc/resolvconf/update.d/libc exited with return code 1
Aug 26 12:27:03 eila sh[358]: RTNETLINK answers: File exists
Aug 26 12:27:04 eila sh[358]: ifup: failed to bring up eth0
Aug 26 12:27:04 eila systemd[1]: ifup@eth0.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 12:27:04 eila systemd[1]: ifup@eth0.service: Failed with result 'exit-code'.
-- Reboot --

The actual problem is in the fetchmail script under /etc/resolvconf/update-libc.d/fetchmail:

#!/bin/sh

if [ -x /etc/init.d/fetchmail ] && [ -n "$(pidof fetchmail)" ]; then
    invoke-rc.d --quiet fetchmail awaken
fi

The problem is that invoke-rc.d is not on the path. The workaround is to provide the absolute path in this script:

#!/bin/sh

if [ -x /etc/init.d/fetchmail ] && [ -n "$(pidof fetchmail)" ]; then
    /usr/sbin/invoke-rc.d --quiet fetchmail awaken
fi

Result:

journalctl -u ifup@eth0.service

-- Reboot --
Aug 29 10:12:07 eila systemd[1]: Started ifup for eth0.
Aug 29 10:12:13 eila sh[354]: Awakening mail retriever agent: fetchmail.
Aug 29 10:12:15 eila sh[354]: Waiting for DAD... Done
Aug 29 10:12:15 eila sh[354]: eth0=eth0
run2000 commented 4 years ago

Other bits of information that may be relevant:

I had previously de-installed dhcpcd5 and installed iproute2, which may be the reason this script is being used. I'm using Fetchmail in daemon mode, setting the appropriate variable in /etc/default/fetchmail:

# This file will be used to declare some vars for fetchmail
#
# Uncomment the following if you don't want localized log messages
# export LC_ALL=C

# If you want to specify any additional OPTION to the start
# scripts specify them here
# OPTIONS=...

# Declare here if we want to start fetchmail. 'yes' or 'no'
START_DAEMON=yes

systemctl restart fetchmail

It's also likely that 1 August was the day that I happened to install Fetchmail, so the /etc/resolvconf/update-libc.d/fetchmail script has probably been failing the whole time.