I've been having difficulties getting a heartbeat 2.1.3 RPM to
install under CentOS 5.1. This issue surrounds the %pre logic of
managing the creation of the haclient UID.
# grep hacluster /etc/passwd
# rpm -i /var/tmp/heartbeat-2.1.3-3.el5.centos.i386.rpm
warning: /var/tmp/heartbeat-2.1.3-3.el5.centos.i386.rpm: Header V3 DSA
signature: NOKEY, key ID e8562897
useradd: user hacluster exists
error: %pre(heartbeat-2.1.3-3.el5.centos.i386) scriptlet failed, exit
status 9
error: install: %pre scriptlet failed (2), skipping
heartbeat-2.1.3-3.el5.centos
Under CentOS 5.1, that scriptlet snippet looks like this:
if
getent passwd hacluster >/dev/null
then
: OK user hacluster already present
else
USEROPT="-g haclient -u 498 -d /var/lib/heartbeat/cores/hacluster"
if
/usr/sbin/useradd $USEROPT hacluster 2>/dev/null \
|| /usr/sbin/useradd -M $USEROPT hacluster 2>/dev/null
# -M to suppress creation of home directory on Red Hat
then
: OK we were able to add user hacluster
else
/usr/sbin/useradd hacluster
fi
fi
The problem I see is that the first command does create the UID,
but exits with a non-zero status:
# userdel hacluster
# /usr/sbin/useradd -g haclient -u 498 -d /var/lib/heartbeat/cores/hacluster
hacluster
useradd: cannot create directory /var/lib/heartbeat/cores/hacluster
# echo $?
12
# grep hacluster /etc/passwd
hacluster:x:498:496::/var/lib/heartbeat/cores/hacluster:/bin/bash
The rest of the OR clause continues:
# /usr/sbin/useradd -M -g haclient -u 498 -d
/var/lib/heartbeat/cores/hacluster hacluster
useradd: user hacluster exists
9
Because they both fail, the 'else' clause is run:
# /usr/sbin/useradd hacluster
useradd: user hacluster exists
# echo $?
9
The home directory doesn't exist until the payload is delivered by
the RPM.
This is an extention of this bug:
http://developerbugs.linux-foundation.org/show_bug.cgi?id=960
My proposal is to _not_ supply '-d /var/lib/heartbeat/cores/hacluster'
clause in the %pre section, and to then use a 'usermod' command in
the %post section:
# usermod -d /var/lib/heartbeat/cores/hacluster hacluster
The first 'useradd' failure mode also exists in RHEL4. I expect
this has been breaking for a while...
--
Brian Reichert <[EMAIL PROTECTED]>
55 Crystal Ave. #286 Daytime number: (603) 434-6842
Derry NH 03038-1725 USA BSD admin/developer at large
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems