Hi,

I built the RPMs with the following configure options to specify
the uid/gid for hacluster/haclient on RedHat Linux, but 
the user is created with the different uid/gid with the RPMs.

./ConfigureMe rpm --with-group-id=90  --with-ccmuser-id=90

/etc/passwd is like this.
hacluster:x:1001:1001::/home/hacluster:/bin/bash


The attached patch fixes this.


The cause of this problem comes from the default behavior of
useradd command. There are at least two kinds of 'useradd' for
Linux and the useradd used by RedHat trys to create the home
directory by default, therefore it fails during the %pre scripts
execution because the directory
'/var/lib/heartbeat/cores/hacluster' does not exist yet.

FYI, the difference of the two useradds is summarized as:

1) pwdutils version (used by SuSE)
  - it does not create the home directory unless '-m' option is specified.
  - ref. http://rpmfind.net/linux/rpm2html/search.php?query=pwdutils

2) shadow-utils version (used by RedHat etc.)
  - it depends on /etc/login.defs configuration whether if it
    creates the home directory by default.
  - in the case of RedHat, it's configured to create the home
    directory by default.
  - '-M' option is available if you don't want to create it.
  - ref. http://rpmfind.net/linux/rpm2html/search.php?query=shadow-utils

I hope it helps.
Thanks,
-- 
Keisuke MORI
NTT DATA Intellilink Corporation
diff -r 12246952c083 heartbeat.spec.in
--- a/heartbeat.spec.in	Wed Nov 15 14:09:13 2006 +0900
+++ b/heartbeat.spec.in	Wed Nov 15 14:53:56 2006 +0900
@@ -1529,7 +1529,9 @@ else
 else
   USEROPT="-g @HA_APIGROUP@ -u @HA_CCMUID@ -d @HA_COREDIR@/@HA_CCMUSER@"
   if
-    /usr/sbin/useradd $USEROPT @HA_CCMUSER@ 2>/dev/null
+    /usr/sbin/useradd $USEROPT @HA_CCMUSER@ 2>/dev/null \
+    || /usr/sbin/useradd -M $USEROPT @HA_CCMUSER@ 2>/dev/null
+    # -M force to suppress to create the home directory on RedHat
   then
     : OK we were able to add user @HA_CCMUSER@
   else
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to