Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 177887 - sys-power/nut upsd init script fails with "upsd: caught SIGTERM, aborting"
Summary: sys-power/nut upsd init script fails with "upsd: caught SIGTERM, aborting"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-10 04:47 UTC by Craig Andrews
Modified: 2008-06-25 01:31 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Andrews gentoo-dev 2007-05-10 04:47:20 UTC
When one runs /etc/init.d/upsd start, the result is:
 * Caching service dependencies ...                                                                                                                    [ ok ]
 * Starting upsd ...
 * upsd: caught SIGTERM, aborting

upsd is now not running. However, if one runs: /usr/sbin/upsd directly, upsd starts right up, and runs fine.

Reproducible: Always

Steps to Reproduce:
1. run /etc/init.d/upsd start

Actual Results:  
 * Caching service dependencies ...                                                                                                                    [ ok ]
 * Starting upsd ...
 * upsd: caught SIGTERM, aborting

Expected Results:  
upsd starts without errors

I'm using these packages (that I believe are relevant):
sys-power/nut-2.0.5-r1
sys-apps/baselayout-2.0.0_alpha2-r1

And my emerge --info:
Portage 2.1.2.7 (default-linux/amd64/2006.1, gcc-4.1.2, glibc-2.5-r2, 2.6.21-gentoo x86_64)
=================================================================
System uname: 2.6.21-gentoo x86_64 AMD Athlon(tm) 64 Processor 3300+
Gentoo Base System release 2.0.0_alpha2
Timestamp of tree: Thu, 10 May 2007 01:50:01 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.32
dev-lang/python:     2.5-r2
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17.50.0.15
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=athlon64 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/php/apache1-php5/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo"
CXXFLAGS="-O2 -march=athlon64 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer parallel-fetch prelink sandbox sfperms strict usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LDFLAGS="-Wl,--hash-style=both,-z,relro,--enable-new-dtags,-O1,-z,now,--as-needed"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/webapps-experimental /usr/portage/local/layman/mythtv-overlay /usr/portage/local/layman/java-overlay /usr/portage/local/layman/sunrise /usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X a52 aac acpi aiglx alsa amd64 animation apache2 artworkextra asf aspnet2 authdaemond avahi avi bash-completion berkdb bitmap-fonts bluetooth bzip2 cairo cdda cdparanoia cdr chm cli cracklib crypt cups curl daap dbus dga divx4linux dlloader dpms dri dts dv dvd dvdr dvdread encode exif fam fame fat fbsplash ffmpeg fftw firefox flac foomaticdb fortran freetype gaim gd gdbm geoip gif gimpprint glib glibc-omitfp glitz glut gnome gnutls gphoto2 gpm gstreamer gstreamer10 gtk gtk2 hal hardenedphp hbci howl howl-compat iconv imagemagick imap imlib innodb ipv6 isdnlog ivtv java java5 joystick jpeg jpeg2k junit kde kdehiddenvisibility lcms libfame libg++ libnotify libusb lirc live lm_sensors lzo mad maildir mdnsresponder-compat midi mjpeg mmap mng mono motif mozilla mozsvg mp3 mpeg mpeg2 mplayer musepack mysql mythtv nautilus ncurses network nls nptl nptlonly ntfs nvidia offensive ofx ogg oggvorbis openexr opengl pam pango pcre pdf pdflib perl pic pie png pnp ppd ppds pppd prelude pulseaudio python qt qt3 qt4 quicktime rar readline reflection rtc samba sasl screensaver sdl session sharedmem shout snmp sox speex spell spl sqlite ssl suspend2 svg tcpd theora threads tiff transcode truetype truetype-fonts type-fonts type1-fonts unicode unzip ups usb v4l v4l2 vcd videos vorbis webdav webservices wifi wmf wv x264 xanim xcb xine xinerama xml2 xorg xpm xprint xrandr xscreensaver xv xvid xvmc zeroconf zip zlib" ALSA_CARDS="via82xx" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="evdev joystick keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" LIRC_DEVICES="mceusb2" USERLAND="GNU" VIDEO_CARDS="nv nvidia"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-05-11 09:37:13 UTC
Can you reproduce this with baselayout-1?
Comment 2 Craig Andrews gentoo-dev 2007-05-11 14:26:23 UTC
(In reply to comment #1)
> Can you reproduce this with baselayout-1?
> 

I don't know unfortunately. I'm not going to reinstall baselayout-1 to test this... perhaps someone else can give it a shot?
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-10-08 18:48:16 UTC
Well, get back to us if you are able to provide requested info.
Comment 4 Craig Andrews gentoo-dev 2007-10-08 18:54:09 UTC
(In reply to comment #3)
> Well, get back to us if you are able to provide requested info.
> 
baselayout-2 is almost keyworded unstable (perhaps it is already on some platforms?). Can we look into this problem with baselayout-2? Once it does become unstable, a lot more people are going to start encountering this bug. I'll be happy to help in figuring out what is wrong in this configuration.
Comment 5 Xepher 2007-12-16 03:08:46 UTC
Solved it with a simple fix. In /etc/init.d/upsd there's a line:

pkill -u root -x upsd

That line is causing the script to kill itself, since the init.d script shares the same "upsd" name with the binary. Simply change that line to:

pkill -u root -x /usr/sbin/upsd

Which should make it only kill instances of the binary.
Comment 6 Craig Andrews gentoo-dev 2007-12-18 19:27:45 UTC
Sweet! Someone want to put this in portage? :-)
Comment 7 Csaba Tóth 2008-01-13 03:18:29 UTC
I just installed 2.2.1 to some servers, for me they worked fine with the "pkill -u root -x upsd" syntax.
Comment 8 Markos Chandras (RETIRED) gentoo-dev 2008-04-11 13:04:55 UTC
I verify that is the baselayout-2 which cause the problem. I didnt have it on baselayout-1
Comment 9 Guillaume Castagnino 2008-04-16 17:48:30 UTC
(In reply to comment #5)
> Solved it with a simple fix. In /etc/init.d/upsd there's a line:
> 
> pkill -u root -x upsd
> 
> That line is causing the script to kill itself, since the init.d script shares
> the same "upsd" name with the binary. Simply change that line to:
> 
> pkill -u root -x /usr/sbin/upsd
> 
> Which should make it only kill instances of the binary.
> 

I confirm this problem is triggered after upgrading to openrc.
This proposed solution fixes the problem.
Comment 10 dswhite42 2008-04-27 20:09:10 UTC
The proposed fix "works", but only by breaking the pkill command in a couple of ways.  For one thing, upsd will most likely be running as the "nut" user, so the "-x root" will not match anything.  For another, the "-x" parameter matches only the command name, not the full command line.

A better choice might be:

    pkill -f /usr/sbin/upsd

or more restrictively:

    pkill -u root,nut -f /usr/sbin/upsd

Or else just remove the whole "kill upsd if it's running before launching the start() process" entirely, since that's not how most rc scripts do it.
Comment 11 James 2008-05-12 00:02:19 UTC
Can someone commit this?  baselayout2 is now in unstable, and the suggestions above seem to be adequate and helpful.  I'm using pkill -u root,nut -f /usr/sbin/upsd to good effect, but was able to use the -x /usr/sbin/upsd line to good effect as well.
Thanks,
cctsurf
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-06-25 01:31:52 UTC
fixed for 2.2.2