trafficserver unit will not start with /var/run/trafficserver default runtimedir

Bug #1978492 reported by Kara O'Dell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
trafficserver (Ubuntu)
New
Undecided
Unassigned

Bug Description

With no modification, attempting to start the service through systemd produces a fatal error.

journalctl -xeu trafficserver.service:
> traffic_cop[5972]: unable to locate local state directory '/var/run/trafficserver'

Attempting to resolve this issue through custom systemd unit with RuntimeDirectory option results in another fatal error due to insufficient permissions (a symptom of configuration, not the root cause).

/etc/systemd/system/trafficserver.service.d/runtimedir_override.conf
> [Service]
> RuntimeDirectory=trafficserver

journalctl -xeu trafficserver.service:
> traffic_manager[6493]: Fatal: [LocalManager::initMgmtProcessServer] failed to bind socket at /var/run/trafficserver/processerver.sock

The resolution is to be able to create this directory with the expected write permission for trafficserver, or more preferrably override it in the environment defaults for the unit in /etc/defaults/trafficserver.

It's perhaps better to use tmpfiles.d for this, but I like being able to clean up the process directory on exit (especially in /run), so I've come up with a systemd solution.

This can either go in the /lib/systemd/system/trafficserver.service file (beware of upgrades), or in a custom unit under /etc/systemd/system/trafficserver.service.d/ .

Additionally, this solution requires that you have the 'install' program on your system.

The actual paths will most likely depend on your system.

/etc/systemd/system/trafficserver.service.d/runtimedir_override.conf
> [Service]
> ExecStartPre=/usr/bin/install -m0755 -o trafficserver -g trafficserver -d /run/trafficserver
> ExecStop=/bin/rm -r /run/trafficserver

I'm providing this as my resolution to this issue. I haven't seen this fix anywhere else short of creating a boot-time tmpfile.d directory or manually creating a permanent directory. Hopefully this helps!

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: trafficserver 7.1.2+ds-3
ProcVersionSignature: Ubuntu 4.15.0-184.194-generic 4.15.18
Uname: Linux 4.15.0-184-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.28
Architecture: amd64
Date: Mon Jun 13 11:53:29 2022
InstallationDate: Installed on 2022-03-10 (94 days ago)
InstallationMedia: Ubuntu-Server 18.04.6 LTS "Bionic Beaver" - Release amd64 (20210915)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/zsh
SourcePackage: trafficserver
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.trafficserver.parent.config: [modified]
modified.conffile..etc.trafficserver.plugin.config: [modified]
modified.conffile..etc.trafficserver.records.config: [modified]
modified.conffile..etc.trafficserver.remap.config: [modified]
modified.conffile..etc.trafficserver.storage.config: [modified]
mtime.conffile..etc.trafficserver.parent.config: 2022-06-13T10:15:17.928434
mtime.conffile..etc.trafficserver.plugin.config: 2022-06-13T10:15:17.988434
mtime.conffile..etc.trafficserver.records.config: 2022-06-10T16:09:38.115777
mtime.conffile..etc.trafficserver.remap.config: 2022-06-13T10:15:17.940434
mtime.conffile..etc.trafficserver.storage.config: 2022-06-13T10:15:17.868434

Revision history for this message
Kara O'Dell (kro1147) wrote :
Revision history for this message
Kara O'Dell (kro1147) wrote :

Updated Proposed solution, changed ExecStopPost to ExecStop in order to avoid systemctl restart causing directory removal.

description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.