5

I am running Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-1045-aws x86_64) on AWS. I am running PHP 7.2.24-0ubuntu0.18.04.7 (cli) (built: Oct 7 2020 15:24:25) ( NTS )

When I migrated to 18.04 from 16 I had to set up the following:

sudo su

nano /etc/systemd/system/multi-user.target.wants/apache2.service

[Service] ... PrivateTmp=true <-- Changed this to "false"

Then do the following:

/var/tmp$ sudo systemctl daemon-reload

/var/tmp$ sudo service apache2 restart

All ran fine after this but as of a few days ago the setting PrivateTmp=false changed to PrivateTmp=true so no files got written into the folder /var/tmp that my application depends on. My suspicion is that an update happened and it changed the setting of PrivateTmp=false. I am not sure how to proved that.

My questions:

is there a way to make the setting sticky and not have it undone by the update process.

Jack

Jack Stein
  • 123
  • 1
  • 14

2 Answers2

8

Use the command sudo systemctl edit apache2, this will create an override.conf file in /etc/systemd/system/apache2.service.d/ which will not be... overridden on a system update :-) and add these lines:

[Service]
PrivateTmp=false

You can also create that file with any name (but ending in .conf) using your preferred editor.

Remebember to run systemctl daemon-reload command after that.

drmad
  • 530
  • 5
  • 16
1

Copy the apache unit file to:

/etc/systemd/system

Unit files in this directory supersede the default location and will not be replaced when the package receives an update. Modify the unit file as needed, then issue:

systemctl daemon-reload
Ganesh MB
  • 1,109
  • 2
  • 14
  • 27
  • Hi Ganesh. You want me to copy this file: /etc/systemd/system/multi-user.target.wants/apache2.service to /etc/systemd/system – Jack Stein Jun 23 '21 at 20:46
  • I did not hear back. I did the following: sudo cp /lib/systemd/system/apache2.service /etc/systemd/system/ and I will assume that this will take care of the issue. Thank you for the help. This issue can be considered closed. – Jack Stein Jun 24 '21 at 21:49