sys-power/apcupsd-3.14.10-r1 fails to start: Apr 9 13:06:20 localhost apcupsd[16242]: Lock file data error: Apr 9 13:06:20 localhost apcupsd[16242]: apcupsd FATAL ERROR in apcupsd.c at line 285 Apr 9 13:06:20 localhost Failed to acquire device lock file Apr 9 13:06:20 localhost apcupsd[16242]: Lock file data error: Apr 9 13:06:20 localhost apcupsd[16242]: apcupsd error shutdown completed Apr 9 13:06:20 localhost /etc/init.d/apcupsd[16240]: start-stop-daemon: did not create a valid pid in `/var/run/apcupsd.pid' Apr 9 13:06:20 localhost /etc/init.d/apcupsd[16228]: ERROR: apcupsd failed to start I believe that this is due to a stale lock file. removing '/var/lock/LCK..' allowed 'apcupsd' to start.
# emerge --info Portage 2.1.10.56 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.14.1-r2, 3.1.0-gentoo-r1 x86_64) ================================================================= System uname: Linux-3.1.0-gentoo-r1-x86_64-Intel-R-_Core-TM-2_CPU_6700_@_2.66GHz-with-gentoo-2.1 Timestamp of tree: Mon, 09 Apr 2012 19:15:01 +0000 app-shells/bash: 4.2_p24 dev-lang/python: 2.7.2-r3, 3.2.2 dev-util/cmake: 2.8.7-r5 dev-util/pkgconfig: 0.26 sys-apps/baselayout: 2.1 sys-apps/openrc: 0.9.9.3 sys-apps/sandbox: 2.5 sys-devel/autoconf: 2.13, 2.68 sys-devel/automake: 1.11.3 sys-devel/binutils: 2.22-r1 sys-devel/gcc: 4.5.3-r2 sys-devel/gcc-config: 1.5.1-r1 sys-devel/libtool: 2.4.2 sys-devel/make: 3.82-r3 sys-kernel/linux-headers: 3.2-r1 (virtual/os-headers) sys-libs/glibc: 2.14.1-r2 Repositories: gentoo ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA google-chrome-18.0.1025.11_beta121089:beta google-chrome AdobeFlash-11_beta AdobeFlash-10.3 googleearth" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=core2 -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=core2 -O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="" GENTOO_MIRRORS="ftp://mirror.mcs.anl.gov/pub/gentoo/ ftp://ftp.free.fr/mirrors/ftp.gentoo.org/" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="en" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.us.gentoo.org/gentoo-portage" USE="X acl alsa amd64 apng berkdb bzip2 cairo cli consolekit cracklib crypt css cups cxx demosaic dri ffmpeg fortran gdbm gdu gpm gtk gudev iconv icu ipv6 jpe jpeg jpg minizip mmx modules mp3 mudflap multilib ncurses nls nptl nptlonly ogg openmp pam pcre png policykit ppds pppd python readline ruby session sndfile sse sse2 ssl sysfs tcpd tiff udev ufraw unicode v4l wav xmp xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON (In reply to comment #1) > sys-power/apcupsd-3.14.10-r1 fails to start: > > Apr 9 13:06:20 localhost apcupsd[16242]: Lock file data error: > Apr 9 13:06:20 localhost apcupsd[16242]: apcupsd FATAL ERROR in apcupsd.c > at line 285 > Apr 9 13:06:20 localhost Failed to acquire device lock file > Apr 9 13:06:20 localhost apcupsd[16242]: Lock file data error: > Apr 9 13:06:20 localhost apcupsd[16242]: apcupsd error shutdown completed > Apr 9 13:06:20 localhost /etc/init.d/apcupsd[16240]: start-stop-daemon: did > not create a valid pid in `/var/run/apcupsd.pid' > Apr 9 13:06:20 localhost /etc/init.d/apcupsd[16228]: ERROR: apcupsd failed > to start > > > I believe that this is due to a stale lock file. > > removing '/var/lock/LCK..' allowed 'apcupsd' to start.
Uhm are you using the new /run setup or the old one?
(In reply to comment #3) > Uhm are you using the new /run setup or the old one? I don't know what you mean by this.
Do you have /var/lock symlinked to /run/lock and /run mounted as tmpfs?
(In reply to comment #5) > Do you have /var/lock symlinked to /run/lock and /run mounted as tmpfs? Negative on all counts. # ls -l /var total 40 drwxr-xr-x 9 root root 4096 Nov 9 22:27 cache drwxr-xr-x 3 root root 4096 Apr 10 19:52 db drwxr-xr-x 3 root root 4096 Mar 17 23:25 empty drwxr-xr-x 19 root root 4096 Mar 18 00:12 lib drwxr-xr-x 2 root uucp 4096 Apr 9 13:53 lock drwxr-xr-x 7 root root 4096 Apr 8 03:10 log lrwxrwxrwx 1 root root 15 Oct 8 2011 mail -> /var/spool/mail drwxr-xr-x 7 root root 4096 Apr 9 13:52 run drwxr-xr-x 5 root root 4096 Oct 9 2011 spool drwxrwxrwt 3 root root 4096 Apr 11 18:25 tmp drwxr-xr-x 3 apache root 4096 Nov 9 22:27 www localhost new_soft # ls -l /var/lock total 0 localhost new_soft # mount rootfs on / type rootfs (rw) /dev/root on / type ext4 (rw,noatime,user_xattr,acl,barrier=1,data=ordered) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) rc-svcdir on /lib64/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime) cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755) openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc) cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu) cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct) freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620) shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
Uhm okay, so I'm afraid I can't do much better.. the lock file is probably stale from once the system closed down "dirty". My suggestion would be to create /run, which your openrc will mount as tmpfs at boot for you, then replace /var/lock with a symlink to ../run/lock (symlinking /var/run might cause a few more issues). That way each boot will have clean locks.
(In reply to comment #7) > Uhm okay, so I'm afraid I can't do much better.. the lock file is probably > stale from once the system closed down "dirty". My suggestion would be to > create /run, which your openrc will mount as tmpfs at boot for you, then > replace /var/lock with a symlink to ../run/lock (symlinking /var/run might > cause a few more issues). > > That way each boot will have clean locks. Thank you for your help, I appreciate it. I wonder... looking at '/etc/init.d/apcupsd', there is: start_pre() { rm -f /etc/apcupsd/powerfail export SERVICE="${SVCNAME}" } making an assumption on when 'start_pre(){}' gets executed, could we stick a 'rm -f /var/lock/LCK..' in there to get rid of stale locks in a timely manner?
The powerfail is something you have from a previous iteration, and in a position that we can't cleanup automatically, and makes no other sense to have it around at that point. The lock file on the other hand _could_ be created by userland applications configuring up the device, so I'd rather not remove it "just because".
(In reply to comment #9) > The powerfail is something you have from a previous iteration, and in a > position that we can't cleanup automatically, and makes no other sense to > have it around at that point. > > The lock file on the other hand _could_ be created by userland applications > configuring up the device, so I'd rather not remove it "just because". Very good. Thanks for your help.