Mailinglist Archive: opensuse-packaging (172 mails)

< Previous Next >
[opensuse-packaging] mounting /var/run as tmpfs
  • From: Andreas Jaeger <aj@xxxxxxxxxx>
  • Date: Sun, 2 May 2010 19:16:30 +0200
  • Message-id: <201005021916.30908.aj@xxxxxxxxxx>
Looking at the failures, I wrote up the following and will post it as blog
post later - anything wrong or missing on this?

Feature #303793 (https://features.opensuse.org/303793) proposes to
mount /var/run as tmpfs.

The description says:

"This would avoid the cleaning of stale files or
sockets on bootup and avoid atime updates of any mounted
filesystems. This is required for eg powermanagement, which
currently wakes up the system from any idle states for a socket
operation.

Services must be modified not to depend on a preexisting content in
/var/run upon startup. RPMs must be modified to not place anything
there."

An rpmlint check has now been implemented to catch files packaged in
/var/run to notify package maintainers of this. This output of the
rpmlint check is e.g.:

hal.x86_64: E: dir-or-file-in-var-run (Badness: 900) /var/run/hald/hald-
runner


So, what options do we have to fix this in packages?

* Check that /var/run is the right place. If you have a home directory
in /var/run with content, consider using /var/lib and remember to
handle the update of the package for users, e.g. use "usermod" in
the post install script of the package to change existing users.
* Create the directory on invocation of your program. Many programs
already do this, so you might not need to make any changes.
Otherwise you have the following options:
- have the program itself check for the directory and create it with
correct permissions
- if the program is normally invoked from an init script, enhance
the init script to do this, e.g.:
if [ ! -d $HALDAEMON_PIDDIR ]; then
mkdir -p $HALDAEMON_PIDDIR
chown haldaemon:haldaemon $HALDAEMON_PIDDIR
fi
- Place a script in /etc/tmpdirs.d that creates the directories and
files, you can look at /etc/tmpdirs.d/01_aaa_base from package
aaa_base for an example.
Note that the first option is the preferred one since it does not
invoke calling of any other programs, the second one comes next
since for both the first and the second one the directories are only
created when needed - and the last one is something for directories
that are always needed since it's called at every boot.
* Make the file or directory known to rpm but do not package it -
use %ghost in the rpm spec file list, e.g.:
%attr(-,avahi,avahi) %ghost %{_localstatedir}/run/avahi-daemon

Andreas
--
Andreas Jaeger, Program Manager openSUSE, aj@{novell.com,opensuse.org}
Twitter: jaegerandi | Identica: jaegerandi
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Maxfeldstr. 5, 90409 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
< Previous Next >