View Issue Details

IDProjectCategoryView StatusLast Update
0002821CentOS-5-OTHERpublic2009-04-22 12:50
Reporterkwanlowe 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version5.0 - i386 
Target VersionFixed in Version 
Summary0002821: "yum install heartbeat" fails
DescriptionInstalling the "heartbeat" package fails, components missing. Possibly related to 0002214, 0002716.

I ran "yum install heartbeat" and received the following output:
[root@vm-c32-001 ~]# yum -y install heartbeat
[snip]
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for heartbeat to pack into transaction set.
heartbeat-2.1.3-3.el5.cen 100% |=========================| 208 kB 00:02
---> Package heartbeat.i386 0:2.1.3-3.el5.centos set to be updated
--> Running transaction check
--> Processing Dependency: libstonith.so.1 for package: heartbeat
--> Processing Dependency: libpils.so.1 for package: heartbeat
--> Processing Dependency: heartbeat-pils = 2.1.3-3.el5.centos for package: heartbeat
--> Processing Dependency: heartbeat-stonith = 2.1.3-3.el5.centos for package: heartbeat
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for heartbeat-stonith to pack into transaction set.
heartbeat-stonith-2.1.3-3 100% |=========================| 160 kB 00:07
---> Package heartbeat-stonith.i386 0:2.1.3-3.el5.centos set to be updated
---> Downloading header for heartbeat-pils to pack into transaction set.
heartbeat-pils-2.1.3-3.el 100% |=========================| 153 kB 00:05
---> Package heartbeat-pils.i386 0:2.1.3-3.el5.centos set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package Arch Version Repository Size
=============================================================================
Installing:
 heartbeat i386 2.1.3-3.el5.centos extras 1.7 M
Installing for dependencies:
 heartbeat-pils i386 2.1.3-3.el5.centos extras 213 k
 heartbeat-stonith i386 2.1.3-3.el5.centos extras 311 k

Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 2.2 M
Downloading Packages:
[snip]
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: heartbeat-pils ######################### [1/3]
  Installing: heartbeat-stonith ######################### [2/3]
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

Installed: heartbeat.i386 0:2.1.3-3.el5.centos
Dependency Installed: heartbeat-pils.i386 0:2.1.3-3.el5.centos heartbeat-stonith.i386 0:2.1.3-3.el5.centos
Complete!
-- end of output

heartbeat shows as installed, but doing an "rpm -q heartbeat" shows it is *not* installed. If I re-run "yum install heartbeat" then the package is successfully installed.
Additional InformationIt may be some other dependency issue as the documentation in /usr/share/doc/heartbeat-2.13 has dummy/missing .txt files that are supposed to be created during the build.
TagsNo tags attached.

Activities

range

range

2008-06-16 09:02

administrator   ~0007408

I'm seeing the same error but cannot explain where it comes from, as the script which is executed during install (or pre install) works fine from a normal shell.

And: It does not break if the user hacluster is already on the system, only if you install it on a fresh system.
MRWatts

MRWatts

2008-10-01 14:45

reporter   ~0008078

In the %pre section, the following is executed:

#######
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
######

For some reason, on a system with no hacluster user, the useradd command is run twice, once without -M and once with -M.
I cannot say why this is done - I suspect the logic is expecting the first useradd to fail on Red Hat systems, which it doesn't.

Reinstalling heartbeat works because the "getent passwd hacluster" call succeeds this time, so the useradd logic is never hit.

Changing to this piece of logic in %pre fixes the problem:

######
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 -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
######
Dan Fruehauf

Dan Fruehauf

2009-03-19 13:30

reporter   ~0008924

OK, so what happens is this :
Assuming no hacluster user exists you run the following :
# /usr/sbin/useradd $USEROPT hacluster
The command fails, but the user is created
So then you try to run this :
# /usr/sbin/useradd -M $USEROPT hacluster
And then the whole scriptlet fails because the user exists and it fails.

One might ask why the following fails :
# /usr/sbin/useradd $USEROPT hacluster
Take a look at $USEROPT and notice that it tries to create a home directory at /var/lib/heartbeat/cores/hacluster.
Since the whole tree does not exist (/var/lib/heartbeat/cores) the scriptlet fails.

I'll let the packagers decide how they would like to resolve this.
Obviously performing :
# mkdir -p /var/lib/heartbeat/cores
Before trying to issue useradd will solve the problem, but on the other hand I wonder why would i need hacluster's homedir at /var/lib/heartbeat/cores/hacluster.

I'll prepare a patch if anyone is interested.
kwanlowe

kwanlowe

2009-04-20 11:56

reporter   ~0009200

Dan:
I am interested. I've also patched the spec file with your suggestion:

--heartbeat.spec--
else
  USEROPT="-g %{HA_APIGROUP} -u %{HA_CCMUID} -d %{HA_COREDIR}/%{HA_CCMUSER}"
  mkdir -p %{HA_COREDIR}
  if
-- end --

However, I'm not certain if it's the proper way to go about it. Is there an macro for this sort of thing within RPM?

There are also a couple other minor issues with the spec file. The *.txt versions of the docs, for example, do not get built. Setting the HTML2TXT and adding a w3m BuildRequires dependency gets them built, but I'm also wondering if it's quite "right". I'll add another report for this issue if needed.

Thanks for your efforts.

2009-04-22 12:48

 

heartbeat.spec.diff (513 bytes)
--- heartbeat.spec	2009-04-22 15:45:41.000000000 +0300
+++ heartbeat-fixed.spec	2009-04-22 15:46:27.000000000 +0300
@@ -236,7 +236,7 @@
 #add 1 to rpmrel for centos
 %if %{is_centos}
 	%undefine RPMREL
-	%define RPMREL 3 
+	%define RPMREL 4
 %endif
 Summary: %{HB_PKG} - The Heartbeat Subsystem for High-Availability Linux
 Name:	%{HB_PKG}
@@ -690,6 +690,9 @@
   fi
 fi
 
+# create the directory, so we don't fail when running useradd
+mkdir -p %{HA_COREDIR}
+
 if
   getent passwd %{HA_CCMUSER} >/dev/null
 then
heartbeat.spec.diff (513 bytes)
Dan Fruehauf

Dan Fruehauf

2009-04-22 12:50

reporter   ~0009238

diff for spec is attached.
It is a very simple patch and it gets the job done.
Most important issue is getting the package installed (on the first time!). The documentation issues you mention perhaps deserve a different ticket.

Issue History

Date Modified Username Field Change
2008-05-05 19:36 kwanlowe New Issue
2008-06-16 09:02 range Note Added: 0007408
2008-06-16 09:02 range Status new => acknowledged
2008-10-01 14:45 MRWatts Note Added: 0008078
2009-03-19 13:30 Dan Fruehauf Note Added: 0008924
2009-04-20 11:56 kwanlowe Note Added: 0009200
2009-04-22 12:48 Dan Fruehauf File Added: heartbeat.spec.diff
2009-04-22 12:50 Dan Fruehauf Note Added: 0009238