sys-power/apcupsd-3.14.10-r5 does not create needed tmpfiles on boot. If using systemd then it is necessary to create a directory for apcupsd to exist in run. Here is the current apcupsd-tmpfiles.conf file r /etc/apcupsd/powerfail r /etc/nologin here is what it needs to be to run correctly D /run/apcupsd 0755 root root r /etc/apcupsd/powerfail r /etc/nologin
Works in rc init system which was updated to reflect switch from /var/run/apcupsd to /run/apcupsd. Systemd team should review and confirm what is needed for systemd init file.
Was surprised to see a reference to /var/run in /etc/init.d/apacupsd.init today, should have been /run - looked in cvs and apcupsd.init.4 which I thought was fixed also had this - updated file and pushed to CVS. Wondering if this causes problems for systemd primarily because /var/run symlink is less likely to exist. Will retest for rc init system in a few hours, and then will request testing again for someone using systemd.
Matthew, I don't believe the problem is in the init. I believe it lies in apcupsds inability to create a directory upon startup. It does not seem to have a problem creating a lock file or pid file but when it comes to creating the directory where the pid files needs to exist, startup fails.
BTW if it was your intention to have this go directly to run, check out what you have set in the ebuild --with-lock-dir=/var/run/apcupsd \ --with-pid-dir=/var/run/apcupsd \
Thanks - fixed those and committed 3.14.10-r6 to cvs. Please test. Hopefully, we've found all references to /var/run/apcupsd or /var/lock/apcupsd and switched them to /run/apcupsd. The files that should exist while apcupsd is running are: matt@hyperion ~/dev/gentoo-x86/sys-power/apcupsd $ ls -al /run/apcupsd/ total 8 drwxrwxr-x 2 root uucp 80 Nov 6 12:11 . drwxr-xr-x 28 root root 980 Nov 20 07:38 .. -rw-r--r-- 1 root root 11 Nov 6 12:11 LCK.. -rw-r--r-- 1 root root 5 Nov 6 12:11 apcupsd.pid LCK = device lock pid = pid of apcupsd master thread/process As for /run/apcupsd directory itself being created, this is what the init file is supposed to handle...which is why I have in the rc-init file: if [ ! -d "${dir}" ]; then einfo " Creating ${dir}" /bin/mkdir -p "${dir}" /bin/chown root:uucp "${dir}" fi with dir set at the start of the file to /run/apcupsd.
(In reply to Matthew Marlowe from comment #5) > > As for /run/apcupsd directory itself being created, this is what the init > file is supposed to handle...which is why I have in the rc-init file: > > if [ ! -d "${dir}" ]; then > einfo " Creating ${dir}" > /bin/mkdir -p "${dir}" > /bin/chown root:uucp "${dir}" > fi > > with dir set at the start of the file to /run/apcupsd. There's already the start_pre() function in the very same init script (apcupsd.init.4) which does exactly the same. Why doing the check twice?
You still need my modified tmpfiles.d, the version you just modified for r6 still does not create the neeeded directory thereby it fails to start
I just emerged r6 with my modified tmpfiles.d file and it works. Again, apcupsd CANNOT CREATE DIRECTORIES ON STARTUP!!!! It will create its lock file but not a directory for it to reside in.
Polynomial-c: history of the init file is confused with prior maintainers, I probably put the start pre check in....should probably have gotten around to taken the redundant old style check out. Will schedule that for next bump.
my output: >>> sys-power/apcupsd-3.14.10-r6 merged. >>> Auto-cleaning packages... >>> No outdated packages were found on your system. * IMPORTANT: 3 config files in '/etc' need updating. * See the CONFIGURATION FILES section of the emerge * man page to learn how to update config files. hyperion FITS2jpeg # dispatch-conf --- /etc/apcupsd/apccontrol 2013-11-01 14:06:23.397484142 -0700 +++ /etc/apcupsd/._cfg0000_apccontrol 2013-12-06 06:46:08.539541660 -0800 @@ -18,7 +18,7 @@ prefix=/usr exec_prefix=${prefix} -APCPID=/var/run/apcupsd/apcupsd.pid +APCPID=/run/apcupsd/apcupsd.pid APCUPSD=/sbin/apcupsd SHUTDOWN=/sbin/shutdown SCRIPTSHELL=/bin/sh >> (1 of 3) -- /etc/apcupsd/apccontrol >> q quit, h help, n next, e edit-new, z zap-new, u use-new m merge, t toggle-merge, l look-merge: --- /etc/apcupsd/apcupsd.conf 2013-11-01 14:06:23.587484324 -0700 +++ /etc/apcupsd/._cfg0000_apcupsd.conf 2013-12-06 06:46:08.757541918 -0800 @@ -90,7 +90,7 @@ # LOCKFILE <path to lockfile> # Path for device lock file. Not used on Win32. -LOCKFILE /var/run/apcupsd +LOCKFILE /run/apcupsd # SCRIPTDIR <path to script directory> # Directory in which apccontrol and event scripts are located. >> (2 of 3) -- /etc/apcupsd/apcupsd.conf >> q quit, h help, n next, e edit-new, z zap-new, u use-new m merge, t toggle-merge, l look-merge: --- /etc/init.d/apcupsd 2013-11-01 14:06:23.952484672 -0700 +++ /etc/init.d/._cfg0000_apcupsd 2013-12-06 06:46:09.151542386 -0800 @@ -1,14 +1,14 @@ #!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/files/apcupsd.init.4,v 1.1 2013/10/15 09:50:19 mattm Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/files/apcupsd.init.4,v 1.2 2013/12/03 22:18:44 mattm Exp $ INSTANCE="${SVCNAME#*.}" if [ -z "${INSTANCE}" ] || [ "${SVCNAME}" = "apcupsd" ]; then INSTANCE="apcupsd" fi -dir="/var/run/apcupsd" +dir="/run/apcupsd" depend() { use net >> (3 of 3) -- /etc/init.d/apcupsd >> q quit, h help, n next, e edit-new, z zap-new, u use-new m merge, t toggle-merge, l look-merge: hyperion FITS2jpeg # /etc/init.d/apcupsd stop * Caching service dependencies ... [ ok ] * Stopping APC UPS daemon ... [ ok ] hyperion FITS2jpeg # rm -rf /run/apcupsd/ hyperion FITS2jpeg # /etc/init.d/apcupsd restart * /run/apcupsd: creating directory * /run/apcupsd: correcting owner * Starting APC UPS daemon ... [ ok ] hyperion FITS2jpeg # tail -10 /var/log/everything/current Dec 06 06:46:44 [portage] sys-power/apcupsd-3.14.10-r6: postinst: _[01m rc-update add apcupsd.powerfail shutdown _[0m Dec 06 06:46:44 [portage] sys-power/apcupsd-3.14.10-r6: postinst: Dec 06 06:46:44 [portage] sys-power/apcupsd-3.14.10-r6: postinst: Starting from version 3.14.9-r1, apcupsd installs udev rules Dec 06 06:46:44 [portage] sys-power/apcupsd-3.14.10-r6: postinst: for persistent device naming. If you have multiple UPS Dec 06 06:46:44 [portage] sys-power/apcupsd-3.14.10-r6: postinst: connected to the machine, you can point them to the devices Dec 06 06:46:44 [portage] sys-power/apcupsd-3.14.10-r6: postinst: in /dev/apcups/by-id directory. Dec 06 06:47:53 [apcupsd] apcupsd exiting, signal 15 Dec 06 06:47:53 [apcupsd] apcupsd shutdown succeeded Dec 06 06:48:05 [apcupsd] NIS server startup succeeded Dec 06 06:48:05 [apcupsd] apcupsd 3.14.10 (13 September 2011) gentoo startup succeeded hyperion FITS2jpeg # ps -aux | grep apc root 9108 0.0 0.0 38176 924 ? Ssl 06:48 0:00 /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf -P /run/apcupsd/apcupsd.pid root 9116 0.0 0.0 12432 888 pts/5 S+ 06:48 0:00 grep --colour=auto apc hyperion FITS2jpeg # ls -al /run/apcupsd/ total 8 drwxrwxr-x 2 root uucp 80 Dec 6 06:48 . drwxr-xr-x 28 root root 980 Dec 6 06:48 .. -rw-r--r-- 1 root root 11 Dec 6 06:48 LCK.. -rw-r--r-- 1 root root 5 Dec 6 06:48 apcupsd.pid What file do you think is not being created? I understand you are running systemd which I'm not - the systemd specific portion of the ebuild is: if use systemd; then systemd_dounit "${FILESDIR}"/${PN}.service systemd_dotmpfilesd "${FILESDIR}"/${PN}-tmpfiles.conf fi I don't know systemd unit files well enough to say if the service file above is in anyway correct or good. I never test systemd. You mention tmpfiles.conf, I guess this somehow instructs systemd about what directories to create. If so, I can add the 1 line you requested to it and that may fix the issue specific to systemd - I assume it wouldn't hurt. To confirm, you want to add the single line: D /run/apcupsd 0755 root root If that is all that is required, I'll do it on next bump. Otherwise, I'll have to assign to other devs familiar with systemd.
That is exactly what is required. Look, with systemd apparently files in the /run folder get deleted upon reboot so it's necessary to create certain directories on boot. The tmpfiles.conf does just that, create files and folders at boot time that would get deleted upon a reboot. As I have previously mentioned, apcupsd cannot create directories on startup which is why the tmpfiles.conf must be written to handle that.
Tempfile line for systemd added and committed to CVS. Note, wiping of /run happens regardless of init system chosen. However, systemd and rc have different ways of telling the init system to create temp directory after reboot which was complicated by the fact that some people have symlinks still in place and the general transition from /var/run to /run within gentoo. I hope we've hit all corners now.