3

I'm using Ubuntu 18.04.4 LTS which uses systemd, but the squid package packaged with this version of Ubuntu is configured to start via init.d. It starts and runs via systemctl start squid.service if I start it manually after the system has booted.

However, I'm using a ZFS mount point ("/media") to store the cache data, and during the boot process squid is starting before this mount point is active. Consequently I'm getting the error "Failed to verify one of the swap directories". Full output of systemctl status squid is here

I'd like to tell systemd to wait until after media.mount has completed in the most minimally invasive way possible (e.g. without modifying the /etc/init.d/squid file that is maintained by the package). To that end I created the /etc/systemd/system/squid.service.d/override.conf file like so:

% cat /etc/systemd/system/squid.service.d/override.conf

[Unit]
Wants=network.target network-online.target nss-lookup.target media.mount
After=network.target network-online.target nss-lookup.target media.mount

[Install]
WantedBy=multi-user.target

But squid is still starting too early.

Is what I want to do possible? Or do I have to bite the bullet and define a native /etc/systemd/system/squid.service file and remove the /etc/init.d/squid init script?

  • It looks like it should work to me. You could try adding to the .conf an `ExecStartPre=` command to list the current mounts for debug, or perhaps add a sleep to just get it working. – meuh Jun 10 '20 at 16:26
  • 1
    That worked. A bit clunky, but I added ```ExecStartPre=/bin/sleep 20``` to the override.conf and squid started properly during boot. – Will Marler Jun 11 '20 at 19:40

0 Answers0