Project

General

Profile

Actions

Bug #3915

closed

Upgrading to Rudder 2.4.8, 2.6.4, 2.6.5, 2.7.1 or 2.7.2 may cause uuid.hive to be removed

Added by Nicolas CHARLES over 9 years ago. Updated about 7 years ago.

Status:
Released
Priority:
1
Assignee:
Nicolas PERRON
Category:
Packaging
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Regression:

Description

Coredumb add an issue when upgrading rudder-server-root from 2.7.2.rc1.git201309030601-1.EL.6.x86_64 to 2.7.2
Somehow the uuid.hive got removed and a new one was generated, causing major disruptions on the systems.

We cannot reproduce it, but we'd rather track this problem

Actions #1

Updated by Olivier Mauras over 9 years ago

Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package rudder-agent.x86_64 1398866025:2.7.2.rc1.git201309030601-1.EL.6 will be updated
---> Package rudder-agent.x86_64 1398866025:2.7.2.release-1.EL.6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package         Arch      Version                              Repository
                                                                           Size
================================================================================
Updating:
 rudder-agent    x86_64    1398866025:2.7.2.release-1.EL.6      Rudder     17 M

Transaction Summary
================================================================================
Upgrade       1 Package(s)

Total download size: 17 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
redhat-lsb-4.0-3.el6.x86_64 has missing requires of /usr/bin/at
redhat-lsb-4.0-3.el6.x86_64 has missing requires of /usr/bin/batch
  Updating   : 1398866025:rudder-agent-2.7.2.release-1.EL.6.x86_64          1/2 
Making sure that the permissions on the CFEngine key directory are correct...
rudder-agent[832]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[835]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[836]: [INFO] Halting CFEngine Community cf-serverd...
rudder-agent[848]: [OK] CFEngine Community cf-serverd stopped after 2 seconds
rudder-agent[849]: [INFO] Halting CFEngine Community cf-execd...
rudder-agent[853]: [OK] CFEngine Community cf-execd stopped after 2 seconds
CFEngine binaries copied to workdir
rudder-agent[871]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[874]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[875]: [INFO] Launching CFEngine Community cf-serverd...
rudder-agent[884]: [OK] CFEngine Community cf-serverd started after 1 seconds
rudder-agent[885]: [INFO] Launching CFEngine Community cf-execd...
rudder-agent[894]: [OK] CFEngine Community cf-execd started after 1 seconds
  Cleanup    : 1398866025:rudder-agent-2.7.2.rc1.git201309030601-1.EL.6.x   2/2 
INFO: A back up copy of the /opt/rudder/etc/uuid.hive has been created in /var/backups/rudder
  Verifying  : 1398866025:rudder-agent-2.7.2.release-1.EL.6.x86_64          1/2 
  Verifying  : 1398866025:rudder-agent-2.7.2.rc1.git201309030601-1.EL.6.x   2/2 

Updated:
  rudder-agent.x86_64 1398866025:2.7.2.release-1.EL.6                           

Complete!

ls: cannot access /opt/rudder/etc/uuid.hive: No such file or directory
/var/backups/rudder:
total 4
-rw-r--r-- 1 root root 37 Sep 10 08:26 uuid-20130910.hive

The uuid.hive file is deleted when updating from 2.7.2.rc1.git201309030601-1.EL.6.

Actions #2

Updated by Olivier Mauras over 9 years ago

Also after this update, /etc/init.d/rudder-agent is missing!!!
Have to reinstall the package to get it back :(

Actions #3

Updated by Nicolas PERRON over 9 years ago

  • Assignee set to Nicolas PERRON
  • Priority changed from N/A to 1

It seems that our pre and post uninstall needs some rework. As said in http://www.ibm.com/developerworks/library/l-rpm2/:

[...] the order of operations during an upgrade is:

   1. Run the %pre section of the RPM being installed.
   2. Install the files that the RPM provides.
   3. Run the %post section of the RPM.
   4. Run the %preun of the old package.
   5. Delete any old files not overwritten by the newer version. (This step deletes files that the new package does not require.)
   6. Run the %postun hook of the old package.

Steps 4 and 6 may seem a bit suspect, and for good reason: If you are upgrading a package, running the older version's uninstallation hooks could undo portions or all of steps 1 through 3.[...] To prevent unintentional clobbering, RPM passes each hook one argument, a flag. The value of the flag indicates which operation is being performed:

    If the first argument to %pre is 1, the RPM operation is an initial installation. If the argument to %pre is 2, the operation is an upgrade from an existing version to a new one.
    Similarly, the arguments to a %post are 1 and 2 for a new installation and upgrade, respectively. (Again, %pre and %post aren't executed during an uninstallation.)
    If the first argument to %preun and %postun is 1, the action is an upgrade.
    If the first argument to %preun and %postun is 0, the action is uninstallation.

And we don't use these flags:

%preun -n rudder-agent
#=================================================
# Pre Uninstallation
#=================================================

# Keep a backup copy of uuid.hive
mkdir -p /var/backups/rudder
cp -f /opt/rudder/etc/uuid.hive /var/backups/rudder/uuid-$(date +%Y%m%d).hive
echo "INFO: A back up copy of the /opt/rudder/etc/uuid.hive has been created in /var/backups/rudder" 

%postun -n rudder-agent
#=================================================
# Post Uninstallation
#=================================================

# Make sure that CFEngine is not running anymore
for component in cf-agent cf-serverd cf-execd cf-monitord; do
    kill -9 `pidof ${component}`
done

# Remove the cron script we create at installation to prevent mail
# flooding, re-installation surprises, and general system garbage.
rm -f /etc/cron.d/rudder-agent

# Make sure that Rudder agent specific files have been removed
rm -f /etc/init.d/rudder-agent
rm -f /etc/default/rudder-agent
rm -f /opt/rudder/etc/uuid.hive

I'll work on this issue

Actions #4

Updated by Nicolas PERRON over 9 years ago

  • Status changed from New to 8

I've tested all these flags and they work !

Actions #5

Updated by Nicolas PERRON over 9 years ago

  • % Done changed from 0 to 90
  • Pull Request set to https://github.com/Normation/rudder-packages/pull/118
Actions #6

Updated by Nicolas PERRON over 9 years ago

  • Status changed from 8 to In progress
  • Target version set to 2.6.6

It concerns Rudder v2.6+

Actions #7

Updated by Nicolas PERRON over 9 years ago

  • Status changed from In progress to Discussion
  • Assignee changed from Nicolas PERRON to Jonathan CLARKE

Jon, the backup of the uuid file is made during upgrade and uninstall on Debian but only during uninstall on RPM.

What should we do ? This is harmless to backup a file (the worst case could be: too many files) and I prefer to backup even during an upgrade. What's your opinion ?

Actions #8

Updated by Matthieu CERDA over 9 years ago

Do a backup in any case. Seriously. :)

It is much safer this way, and you might want to backup ppkeys too.

Actions #9

Updated by Jonathan CLARKE over 9 years ago

  • Assignee changed from Jonathan CLARKE to Nicolas PERRON

Matthieu CERDA wrote:

Do a backup in any case. Seriously. :)

It is much safer this way, and you might want to backup ppkeys too.

Agreed. If in doubt, err on the side of safety.

PR validated, looks fine to me, but I understand you may want to change it now, so I haven't merged it yet.

Actions #10

Updated by Nicolas PERRON over 9 years ago

  • Status changed from Discussion to Pending technical review
  • Assignee changed from Nicolas PERRON to Jonathan CLARKE
  • % Done changed from 90 to 100

Jonathan CLARKE wrote:

Matthieu CERDA wrote:

Do a backup in any case. Seriously. :)

It is much safer this way, and you might want to backup ppkeys too.

Agreed. If in doubt, err on the side of safety.

PR validated, looks fine to me, but I understand you may want to change it now, so I haven't merged it yet.

As you said, I needed to rework it.

This is done. Could you review it again, please ?

Actions #11

Updated by Nicolas PERRON over 9 years ago

  • Status changed from Pending technical review to Pending release

Applied in changeset commit:70203d4e3eb27a8962ca361ead5c4d0e48599b4f.

Actions #12

Updated by Nicolas PERRON over 9 years ago

Applied in changeset commit:004bf88a5fa2452bef191713c968a3f3190d4192.

Actions #13

Updated by Jonathan CLARKE over 9 years ago

Applied in changeset commit:96a0a046a47b437fb7b7225c794e03a258cb1f79.

Actions #14

Updated by Nicolas PERRON over 9 years ago

  • Subject changed from Upgrading to 2.7.2 may cause uuid.hive to be removed to Upgrading to Rudder 2.4.8, 2.6.4, 2.6.5, 2.7.1 or 2.7.2 may cause uuid.hive to be removed
  • Status changed from Pending release to 8
  • Assignee changed from Jonathan CLARKE to Nicolas PERRON
  • Target version changed from 2.6.6 to 2.4.9
  • % Done changed from 100 to 0

This issue affect 2.4.8 too ! see #3864 and #3896.

I'll revert this commit to reapply it to branch 2.4.

Actions #15

Updated by Nicolas PERRON over 9 years ago

  • Status changed from 8 to Pending technical review
  • % Done changed from 0 to 100

Hmm... revert it is useless. It was possible to cherry-pick the commits from branch 2.6.

Actions #16

Updated by Nicolas PERRON over 9 years ago

  • Status changed from Pending technical review to Pending release

Applied in changeset commit:f33f5607e5d88be3df8a4470d61f8e36ec8d31b3.

Actions #17

Updated by Nicolas PERRON over 9 years ago

Applied in changeset commit:e6b9d8f7e7ca59aee658235c11ffdc0e83954919.

Actions #18

Updated by Nicolas PERRON over 9 years ago

This bug has been fixed in Rudder 2.4.9, which was released today.
Check out:

Actions #19

Updated by Nicolas PERRON over 9 years ago

  • Status changed from Pending release to Released
Actions #20

Updated by Benoît PECCATTE almost 8 years ago

  • Project changed from 34 to Rudder
  • Category set to Packaging
Actions #21

Updated by Benoît PECCATTE about 7 years ago

  • Target version changed from 2.4.9 to 2.6.6
Actions

Also available in: Atom PDF