[Nut-upsuser] nut suddenly stopped working...

Charles Lepple
Tue, 27 Feb 2007 14:31:11 -0000

[for general debugging like this, please keep the list copied.]

On 2/27/07, A.Lizard <alizard@ecis.com> wrote:
> At 05:09 AM 2/27/07, you wrote:
> >On 2/27/07, A.Lizard <alizard@ecis.com> wrote:
> >>At 04:48 AM 2/27/07, you wrote:
> >> >On 2/27/07, A.Lizard <alizard@ecis.com> wrote:
> >> >>and "upsd gets a 'connection refused'
message" was a typo, I meant
> >> *upsc* .
> >> >>I haven't tried running upsd since building the wrong
source package.
> >> >
> >> >upsc connects to upsd (this is the network portion of
"Network UPS
> >> >Tools"), so upsd needs to be running or else you will get
a
> >> >"connection refused" message from upsc.
> >> >
> >> >upsd also connects to the individual drivers, as Arjen as
pointed out.
> >> >
> >> >--
> >> >- Charles Lepple
> >>
> >>interesting... so I tried this and got:
> >>
> >>terrarium:/home/alizard#  /usr/local/ups/sbin/upsd -u root
> >>Network UPS Tools upsd 2.0.5-pre2
> >>/usr/local/ups/etc/upsd.conf is world readable
> >>Connected to UPS [belkin-ups]: belkin-ups
> >>/usr/local/ups/etc/upsd.users is world readable
> >>terrarium:/home/alizard#
> >>
> >>and knutclient suddenly started displaying.
> >>
> >>Afterwards, I tried:
> >>   2469 ?        00:00:00 upsd
> >>   2515 pts/1    00:00:00 ps
> >>terrarium:/home/alizard# kill -9 2469
> >>terrarium:/home/alizard# /etc/init.d/nut start
> >>Starting Network UPS Tools: (upsdrvctl failed).
> >>terrarium:/home/alizard# /etc/init.d nut stop
> >>bash: /etc/init.d: is a directory
> >>terrarium:/home/alizard# /etc/init.d/nut stop
> >>Stopping Network UPS Tools: (upsdrvctl failed) upsd upsmon.
> >>terrarium:/home/alizard#  /usr/local/ups/sbin/upsd -u root
> >>Network UPS Tools upsd 2.0.5-pre2
> >>/usr/local/ups/etc/upsd.conf is world readable
> >>Connected to UPS [belkin-ups]: belkin-ups
> >>/usr/local/ups/etc/upsd.users is world readable
> >>
> >>[note - I have root , nut , alizard entries in upsd.users ]
> >
> >upsd.users lists roles - they don't have to be named like the
system
> >users such as root or nut.
> >
> >The "-u" parameter for the daemons is for overriding the
choice of the
> >"nut" system user.
> >
> >>terrarium:/home/alizard#  /usr/local/ups/sbin/upsd -u alizard
> >>Network UPS Tools upsd 2.0.5-pre2
> >>Can't chdir to /var/state/ups: Permission denied
> >
> >Right, permissions are usually restricted to the nut system user on
> >that directory.
> >
> >>terrarium:/home/alizard#  /usr/local/ups/sbin/upsd -u nut
> >>Network UPS Tools upsd 2.0.5-pre2
> >>/usr/local/ups/etc/upsd.conf is world readable
> >>Can't connect to UPS [belkin-ups] (belkin-ups): Permission
denied
> >
> >This is also expected, since it sounds like you still have the driver
> >running with "-u root".
>
> I haven't been able to get it to run any other way - newhidups outputs
> (non-root and root) below.

Right. The fact that it works when both the driver and upsd are passed
"-u root" points to a permissions problem.

Basically, you need to pass the same system user to "-u" on both the
driver and upsd.

Users in ups.users are not connected to the system user IDs, but they
are one part of the system used to prevent random users from being
able to shut down the system.

--
- Charles Lepple