Project

General

Profile

Actions

Bug #5119

closed

check-rudder-agent fails if an error occurs during sourcing /etc/profile

Added by Nicolas PERRON over 10 years ago. Updated over 9 years ago.

Status:
Released
Priority:
1 (highest)
Assignee:
Jonathan CLARKE
Category:
Packaging
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:

Description

I tried to upgrade Rudder agent from version 2.9 to 2.10 on some machines but it seems that it fails on SLES 10 and SLES 11.

Using rpm will not install the package:

$ rpm -Uvh /tmp/rudder-agent-2.10.2.release-1.SLES.11.x86_64.rpm
warning: /tmp/rudder-agent-2.10.2.release-1.SLES.11.x86_64.rpm: Header V3 RSA/SHA1 signature: NOKEY, key ID 6f07d355
Preparing...                ########################################### [100%]
        package rudder-agent-2.10.2.release-1.SLES.11.x86_64 is intended for a x86_64 architecture
$ rpm -qa | grep rudder
rudder-agent-2.9.4.release-1.SLES.11

And using zypper will let two error appear with two ruder-agent packages:

$ zypper -v in rudder-agent
[...]

The following package is going to be upgraded:
  rudder-agent  1398866025:2.9.3.release-1.SLES.10 -> 1398866025:2.10.2.release-1.SLES.10

The following package is not supported by its vendor:
  rudder-agent  1398866025:2.10.2.release-1.SLES.10

1 package to upgrade.
Overall download size: 22.2 MiB. After the operation, additional 21.0 KiB will be used.
Continue? [y/n/?] (y): y
committing
Retrieving package rudder-agent-1398866025:2.10.2.release-1.SLES.10.i586 (1/1), 22.2 MiB (87.3 MiB unpacked)
Retrieving: rudder-agent-2.10.2.release-1.SLES.10.i586.rpm [done (6.6 MiB/s)]
Installing: rudder-agent-1398866025:2.10.2.release-1.SLES.10 [error]
Installation of rudder-agent-1398866025:2.10.2.release-1.SLES.10 failed:
(with --nodeps --force) Error: Subprocess failed. Error: RPM failed: warning: /var/cache/zypp/packages/Rudder_SLES_10/i586/rudder-agent-2.10.2.release-1.SLES.10.i586.rpm: Header V3 RSA/SHA1 signature: NOKEY, key ID 6f07d355
INFO: A back up copy of /etc/init.d/rudder-agent has been created in /var/backups/rudder
INFO: A back up copy of /etc/default/rudder-agent has been created in /var/backups/rudder
INFO: A back up copy of /etc/cron.d/rudder-agent has been created in /var/backups/rudder
Making sure that the permissions on the CFEngine key directory are correct...
rudder-agent[31110]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[31113]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[31114]: [INFO] Halting CFEngine Community cf-serverd...
rudder-agent[31128]: [OK] CFEngine Community cf-serverd stopped after 2 seconds
rudder-agent[31129]: [INFO] Halting CFEngine Community cf-execd...
rudder-agent[31130]: [INFO] can't read PID file, not stopping cf-execd
rudder-agent[31136]: [INFO] Found no CFEngine Community cf-serverd processes running
rudder-agent[31143]: [INFO] Killing CFEngine Community cf-execd with force...
rudder-agent[31145]: [OK] all CFEngine Community cf-execd processes killed with force
CFEngine binaries copied to workdir
rudder-agent[31436]: [INFO] Using /etc/default/rudder-agent for configuration
rudder-agent[31439]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir
rudder-agent[31440]: [INFO] Launching CFEngine Community cf-serverd...
2014-06-23T16:21:08+0000  warning: Cannot implicitly evaluate bundle 'common cfengine', as this bundle takes arguments.
2014-06-23T16:21:08+0000  warning: Cannot implicitly evaluate bundle 'common cfengine', as this bundle takes arguments.
2014-06-23T16:21:08+0000   notice: Server is starting...
rudder-agent[31486]: [OK] CFEngine Community cf-serverd started after 1 seconds
rudder-agent[31487]: [INFO] Launching CFEngine Community cf-execd...
rudder-agent[31544]: [OK] CFEngine Community cf-execd started after 1 seconds
error: %post(rudder-agent-2.10.2.release-1.SLES.10.i586) scriptlet failed, exit status 1

Abort, retry, ignore? [a/r/i] (a): a
Problem occured during or after installation or removal of packages:
Installation aborted by user

Please see the above error message for a hint.
Checking for running processes using deleted libraries...

$ rpm -qa | grep rudder-agent
rudder-agent-2.10.2.release-1.SLES.10
rudder-agent-2.9.3.release-1.SLES.10

This is the case on SLES 11 too:

$ rpm -qa | grep rudder-agent
rudder-agent-2.10.2.release-1.SLES.11
rudder-agent-2.9.5.rc1.git201403310649-1.SLES.11

I suppose the first error come from this line: https://github.com/Normation/rudder-packages/blob/2.10.2-1/rudder-agent/SPECS/rudder-agent.spec#L336

Actions #1

Updated by Jonathan CLARKE over 10 years ago

Thanks for the report, Nicolas.

I don't see anything indicating a failure in the pre scriptlet. However, this message indicates the error happens in the post scriptlet:

error: %post(rudder-agent-2.10.2.release-1.SLES.10.i586) scriptlet failed, exit status 1
Actions #2

Updated by Nicolas PERRON over 10 years ago

Jonathan CLARKE wrote:

Thanks for the report, Nicolas.

I don't see anything indicating a failure in the pre scriptlet. However, this message indicates the error happens in the post scriptlet:

[...]

Yes, of course but the first error message is:

(with --nodeps --force) Error: Subprocess failed. Error: RPM failed: warning: /var/cache/zypp/packages/Rudder_SLES_10/i586/rudder-agent-2.10.2.release-1.SLES.10.i586.rpm: Header V3 RSA/SHA1 signature: NOKEY, key ID 6f07d355

Just before the message:
INFO: A back up copy of /etc/init.d/rudder-agent has been created in /var/backups/rudder

This message exists only into the preinst. Then, in my opinion, it could be either two errors (one in preinst and one in postinst) or only one error into postrm since the order of rpm is (cf http://fedoraproject.org/wiki/Packaging:ScriptletSnippets) :
- prerm (old package)
- postrm (old package)
- preinst (new package)
- postinst (new package)

Actions #3

Updated by Nicolas PERRON over 10 years ago

Nicolas PERRON wrote:

Jonathan CLARKE wrote:

Thanks for the report, Nicolas.

I don't see anything indicating a failure in the pre scriptlet. However, this message indicates the error happens in the post scriptlet:

[...]

Yes, of course but the first error message is:
[...]
Just before the message:
[...]

This message exists only into the preinst. Then, in my opinion, it could be either two errors (one in preinst and one in postinst) or only one error into postrm since the order of rpm is (cf http://fedoraproject.org/wiki/Packaging:ScriptletSnippets) :
- prerm (old package)
- postrm (old package)
- preinst (new package)
- postinst (new package)

Ouch, I'm tired... the order is not at all what I said. The right order is:
- preinst (new package)
- postinst (new package)
- prerm (old package)
- postrm (old packa
ge)

Actions #4

Updated by Nicolas PERRON over 10 years ago

I understand what the problem is:

Since #4908, check-rudder-agent is a script sourcing the file /etc/profile and which will stop at first error. On SLES, sourcing /etc/profile will return 1 as exit code.

As said before, upgrading a package will be in this order:
- preinst (new package)
- postinst (new package)
- prerm (old package)
- postrm (old package)

Nevertheless, on the postinst step, the script check-rudder-agent is called which will return an error and will stop the upgrade process. The others steps (prerm, remove package, postrm) will not be applied.

I suppose that the solution is to source /etc/profile before the "set -e" of check-rudder-agent.

On my machines, the /etc/profile is sourcing /etc/bash.bashrc which contains these lines:

[...]
if test "$is" != "ash" ; then
    #
    # And now let's see if there is a local bash.bashrc
    # (for options defined by your sysadmin, not SuSE Linux)
    #
    test -s /etc/bash.bashrc.local && . /etc/bash.bashrc.local
fi
[...]

The file /etc/bash.bashrc.local does not exist by default, then the test will fail.
Actions #5

Updated by Nicolas PERRON over 10 years ago

  • Status changed from New to Discussion
  • Assignee set to Jonathan CLARKE

Jon,
what do you think about sourcing /etc/profile before the "set -e" into the script check-rudder-agent ?

Actions #6

Updated by Nicolas PERRON over 10 years ago

I've tried on a fresh SLES 11 SP3 machine and sourcing the /etc/profile is OK so it could be a specificity of our machines. However, I don't think that we should let it cause rudder-agent package fail.

Actions #7

Updated by Nicolas PERRON over 10 years ago

Another effect of this bug:
- CFEngine is never launched since the script check-rudder-agent fail at the beginning.

Actions #8

Updated by Nicolas PERRON over 10 years ago

  • Subject changed from Upgrade rudder-agent package from 2.9 to 2.10 on SLES 10 or 11 fail into preinst or/and postinst and let the system consider that both of the versions are installed to Installation of Rudder agent 2.10 will fail on a system with any command not returning 0 into /etc/profile and during upgrade will let previous package installed too
Actions #9

Updated by Jonathan CLARKE over 10 years ago

  • Assignee changed from Jonathan CLARKE to Nicolas PERRON

Nicolas PERRON wrote:

I've tried on a fresh SLES 11 SP3 machine and sourcing the /etc/profile is OK so it could be a specificity of our machines. However, I don't think that we should let it cause rudder-agent package fail.

Agreed, this should not happen (I assume your /etc/profile is broken) but we shuold be tolerant of the fault.

How about a simple:

. /etc/profile || true
Actions #10

Updated by Nicolas PERRON over 10 years ago

  • Assignee changed from Nicolas PERRON to Jonathan CLARKE

Jonathan CLARKE wrote:

Nicolas PERRON wrote:

I've tried on a fresh SLES 11 SP3 machine and sourcing the /etc/profile is OK so it could be a specificity of our machines. However, I don't think that we should let it cause rudder-agent package fail.

Agreed, this should not happen (I assume your /etc/profile is broken) but we shuold be tolerant of the fault.

How about a simple:

[...]

I've tried this command and it does not work whereas it should work if /etc/profile would be executed.
In fact, as explained in http://superuser.com/questions/176783/what-is-the-difference-between-executing-a-bash-script-and-sourcing-a-bash-scrip , the sourcing will execute the script in the same shell process. Then, the "||" is of no help.

In my opinion, the only way to avoid a fail from sourcing a script is to source it before "set -e". Do you have any other idea ?

Actions #11

Updated by Jonathan CLARKE over 10 years ago

  • Assignee changed from Jonathan CLARKE to Nicolas PERRON

No, OK, go ahead - let's get this done, we need a PR here and quickly. Just make sure all this is explained in comments in the file.

Actions #12

Updated by Nicolas PERRON over 10 years ago

  • Status changed from Discussion to Pending technical review
  • % Done changed from 0 to 100
  • Pull Request set to https://github.com/Normation/rudder-packages/pull/402

PR URL added: https://github.com/Normation/rudder-packages/pull/402

Jon, could you review it please ?

Actions #13

Updated by Nicolas PERRON over 10 years ago

  • Assignee changed from Nicolas PERRON to Jonathan CLARKE
Actions #14

Updated by Nicolas PERRON over 10 years ago

  • Status changed from Pending technical review to Pending release

Applied in changeset commit:a6f21f0058c0fbf918db31f28044e46770e53082.

Actions #15

Updated by Jonathan CLARKE over 10 years ago

Applied in changeset commit:ba41fc1a6dfc7e671313e2567900abda0632f65f.

Actions #16

Updated by Vincent MEMBRÉ over 10 years ago

  • Subject changed from Installation of Rudder agent 2.10 will fail on a system with any command not returning 0 into /etc/profile and during upgrade will let previous package installed too to Rudder-agent install fails if an error occurs when sourcing /etc/profile
Actions #17

Updated by Vincent MEMBRÉ over 10 years ago

  • Subject changed from Rudder-agent install fails if an error occurs when sourcing /etc/profile to rudder-agent install fails if an error occurs when sourcing /etc/profile
Actions #18

Updated by Vincent MEMBRÉ over 10 years ago

  • Subject changed from rudder-agent install fails if an error occurs when sourcing /etc/profile to check-rudder-agent fails if an error occurs during sourcing /etc/profile
Actions #19

Updated by Vincent MEMBRÉ over 10 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 2.10.3 (announcement , changelog) and 2.11.0~beta2 (announcement , changelog), which were released today.

Actions #20

Updated by Benoît PECCATTE over 9 years ago

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

Also available in: Atom PDF