Ubuntu server /var/run not persistent

Asked by Andy Ruddock

Using Ubuntu 8.10 server, /var/run and /var/log are mounted on a tempfs, which means they're cleared out on a reboot.

I installed the sks keyserver which keeps pid files in /var/run/sks (a directory owned by debian-sks), but this directory is not recreated on a reboot.

(As a workaround I create the /var/run/sks directory & set its ownership in the sks init script (/etc/init.d/sks), but I imagine this is not a problem unique to this service.)

What's the recommended method for creating directories under /var/run (or /var/log) and making them persistent across reboots?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Florian Diesch
Solved:
Last query:
Last reply:
Revision history for this message
Best Florian Diesch (diesch) said :
#1

/var/log/ shouldn't be on a tempfs (except for live CDs and similar systems where the disk isn't writable) as you don't want logfiles to get removed when booting.

The recommended method for directories in /var/run is indeed to create them in a init script:

| In Ubuntu, /var/run is mounted as a temporary filesystem, so the init.d scripts must handle this
| correctly. This will typically amount to creating any required subdirectories of /var/run dynamically
| when the init.d script is run, rather than including them in the package and relying on dpkg to
| create them.

(http://people.ubuntu.com/~cjwatson/ubuntu-policy/policy.html/ch-opersys.html#s9.3.2)

Revision history for this message
Andy Ruddock (andy-ruddock) said :
#2

Thanks a lot, that means I'll have to submit a bug against the sks package.

Don't know why I typed /var/log - I meant /var/lock.

Thanks for the pointer, useful document.

Revision history for this message
Andy Ruddock (andy-ruddock) said :
#3

Thanks Florian Diesch, that solved my question.