Project

General

Profile

Actions

Architecture #4140

closed

RPM packages don't fail on pre/post-uninst/inst scripts

Added by Jonathan CLARKE about 11 years ago. Updated almost 7 years ago.

Status:
Rejected
Priority:
2
Assignee:
-
Category:
Packaging
Effort required:
Name check:
Fix check:
Regression:

Description

I just installed a fresh version of Rudder 2.8.0 on CentOS 6. The installation reported completing succesfully, but I could not access the webapp, and after some investigating, I found that httpd was not running.

Here is an extract from the install logs:

  Installing : 1398866025:rudder-webapp-2.8.0.release-1.EL.6.noarch                                                                                               66/72 
INFO: Setting Apache HTTPd as a boot service... Done
INFO: Restrating syslog... Done
INFO: Stopping Apache HTTPd... Done
INFO: No usable SSL certificate detected for Rudder HTTP/S support, generating one automatically... Done
INFO: Starting Apache HTTPd...INFO: Launching script to check if a migration is needed

(on a side note: the "echo " Done" line is missing after the apache start)

Running "/sbin/service httpd start" manually, I see this:

[vagrant@server ~]$ sudo /sbin/service httpd start
Starting httpd: Syntax error on line 30 of /etc/httpd/conf.d/rudder-vhost-ssl.conf:
SSLCertificateFile: file '/opt/rudder/etc/ssl/rudder-webapp.crt' does not exist or is empty
                                                           [FAILED]

This is true:

[vagrant@server ~]$ ls /opt/rudder/etc/ssl/
rudder-webapp.key

When I remove everything under /opt/rudder/etc/ssl, and try to run the key and crt generation command manually, I get this:

[vagrant@server ~]$ sudo openssl req -new -x509 -newkey rsa:2048 -subj "/CN=$(hostname --fqdn)/" -keyout /opt/rudder/etc/ssl/rudder-webapp.key -out /opt/rudder/etc/ssl/rudder-webapp.crt -days 1460 -nodes -sha256
Generating a 2048 bit RSA private key
......................................................................+++
.........+++
writing new private key to '/opt/rudder/etc/ssl/rudder-webapp.key'
-----
problems making Certificate Request
140679770867528:error:0D07A097:asn1 encoding routines:ASN1_mbstring_ncopy:string too long:a_mbstr.c:154:maxsize=64
[vagrant@server ~]$ echo $?
1

I figured out that this comes from my hostname being too long, which is used as the certificate's CN:

[vagrant@server ~]$ hostname --fqdn
server.rudder.local.rudder.local.rudder.local.rudder.local.rudder.local.rudder.local

(on a side note, this is a bug in the rudder-vagrant provisioning scripts, that appends "rudder.local" onto the hostname even if it's already there)

Nothing warned me about this during the install process, even though the openssl command returned a non-zero code.

From https://fedoraproject.org/wiki/Packaging:ScriptletSnippets, I see:

rpm in its default configuration does not at the moment execute shell scriptlets with the -e argument to the shell

So, all of our post/pre inst/uninst scripts have been written in the assumption that, like Debian packaging, if anything goes wrong (ie returns non-zero), the package manager will complain and alert the user. This is not the case, and our RPM packages end up being installed, errors happen, but the user gets told "Success". This is bad.

I'm not sure how to proceed, I see several options:

  1. We add "set -e" to all our post/pre in/unin scripts in the .spec files. This will cause the package installation to fail and the user will be alerted. It seems like a quick and easy solution to implement, although if we decide to go with it, I think we should only make this change in 2.8.x, not in older versions, because this may break something (we may have some commands failing, but that don't matter). However, I wonder if this approach doesn't go against "the RPM way". I know that in the Debian world, it is common to tell apt-get/aptitude to "try again with configuring that package", but I've never heard of this in the RPM world...
  2. We add detection to anything important, as in "do_stuff || "Failed to do_stuff, OMG, you should totally check the docs now and fix this yourself!". I don't like this solution as much, because it would be complicated and error-prone to implement, and doesn't really fix the problem. But it may be more the "RPM way".
  3. Can't think of any other approaches for now.

Thoughts?


Related issues 1 (0 open1 closed)

Related to Rudder - Architecture #10542: Merge rudder-reports into rudder-webappResolvedActions
Actions #1

Updated by Jonathan CLARKE about 11 years ago

Jonathan CLARKE wrote:

(on a side note: the "echo " Done" line is missing after the apache start)

Fix proposed in #4141.

(on a side note, this is a bug in the rudder-vagrant provisioning scripts, that appends "rudder.local" onto the hostname even if it's already there)

And this needs fixing in #4142.

Actions #2

Updated by Nicolas PERRON about 11 years ago

  • Target version changed from 2.8.1 to 2.8.2
Actions #3

Updated by Vincent MEMBRÉ almost 11 years ago

  • Target version changed from 2.8.2 to 2.8.3
Actions #4

Updated by Vincent MEMBRÉ almost 11 years ago

  • Target version changed from 2.8.3 to 2.8.4
Actions #5

Updated by Matthieu CERDA almost 11 years ago

  • Assignee changed from Matthieu CERDA to Jonathan CLARKE

Well, I'd go for the second option, it seems like the best compromise :)

Should we do this then ?

Actions #6

Updated by Vincent MEMBRÉ almost 11 years ago

  • Target version changed from 2.8.4 to 133
Actions #7

Updated by Vincent MEMBRÉ over 10 years ago

  • Target version changed from 133 to 2.9.5
Actions #8

Updated by Vincent MEMBRÉ over 10 years ago

  • Target version changed from 2.9.5 to 2.9.6
Actions #9

Updated by Jonathan CLARKE over 10 years ago

  • Target version changed from 2.9.6 to 2.9.7
Actions #10

Updated by Jonathan CLARKE over 10 years ago

  • Target version changed from 2.9.7 to 150
Actions #11

Updated by Vincent MEMBRÉ over 10 years ago

  • Target version changed from 150 to 2.10.4
Actions #12

Updated by Nicolas PERRON over 10 years ago

  • Target version changed from 2.10.4 to 2.10.5
Actions #13

Updated by Vincent MEMBRÉ over 10 years ago

  • Target version changed from 2.10.5 to 2.10.6
Actions #14

Updated by Matthieu CERDA about 10 years ago

  • Target version changed from 2.10.6 to 2.10.7
Actions #15

Updated by Vincent MEMBRÉ about 10 years ago

  • Target version changed from 2.10.7 to 2.10.8
Actions #16

Updated by Vincent MEMBRÉ about 10 years ago

  • Target version changed from 2.10.8 to 2.10.9
Actions #17

Updated by Vincent MEMBRÉ almost 10 years ago

  • Target version changed from 2.10.9 to 2.10.10
Actions #18

Updated by Vincent MEMBRÉ almost 10 years ago

  • Target version changed from 2.10.10 to 2.10.11
Actions #19

Updated by Vincent MEMBRÉ almost 10 years ago

  • Target version changed from 2.10.11 to 2.10.12
Actions #20

Updated by Benoît PECCATTE almost 10 years ago

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

Updated by Vincent MEMBRÉ almost 10 years ago

  • Target version changed from 2.10.12 to 2.10.13
Actions #22

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.13 to 2.10.14
Actions #23

Updated by Benoît PECCATTE over 9 years ago

  • Assignee deleted (Jonathan CLARKE)
Actions #24

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.14 to 2.10.15
Actions #25

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.15 to 2.10.16
Actions #26

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.16 to 2.10.17
Actions #27

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.17 to 2.10.18
Actions #28

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.18 to 2.10.19
Actions #29

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.19 to 2.10.20
Actions #30

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.20 to 2.11.18
Actions #31

Updated by Vincent MEMBRÉ almost 9 years ago

  • Target version changed from 2.11.18 to 2.11.19
Actions #32

Updated by Vincent MEMBRÉ almost 9 years ago

  • Target version changed from 2.11.19 to 2.11.20
Actions #33

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.20 to 2.11.21
Actions #34

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.21 to 2.11.22
Actions #35

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.22 to 2.11.23
Actions #36

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.23 to 2.11.24
Actions #37

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.24 to 308
Actions #38

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 308 to 3.1.14
Actions #39

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 3.1.14 to 3.1.15
Actions #40

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 3.1.15 to 3.1.16
Actions #41

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 3.1.16 to 3.1.17
Actions #42

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 3.1.17 to 3.1.18
Actions #43

Updated by Vincent MEMBRÉ almost 8 years ago

  • Target version changed from 3.1.18 to 3.1.19
Actions #44

Updated by François ARMAND over 7 years ago

  • Tracker changed from Bug to Architecture

The installation of recent version is much more resilient, and the http service is checked to be running. But the underlying problem is still there, and it needs to be adressed as an architecture problem: I'm linking it to #10542

Actions #45

Updated by François ARMAND over 7 years ago

Actions #46

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.19 to 3.1.20
Actions #47

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.20 to 3.1.21
Actions #48

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.21 to 3.1.22
Actions #49

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.22 to 3.1.23
Actions #50

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.23 to 3.1.24
Actions #51

Updated by Vincent MEMBRÉ about 7 years ago

  • Target version changed from 3.1.24 to 3.1.25
Actions #52

Updated by Benoît PECCATTE about 7 years ago

  • Target version changed from 3.1.25 to 4.1.9
Actions #53

Updated by Vincent MEMBRÉ about 7 years ago

  • Target version changed from 4.1.9 to 4.1.10
Actions #54

Updated by Benoît PECCATTE almost 7 years ago

  • Target version changed from 4.1.10 to Ideas (not version specific)
Actions #55

Updated by Benoît PECCATTE almost 7 years ago

  • Status changed from Discussion to Rejected

Rudder now have a common postinst between rpm and dpkg, and this script uses set -e.
This is not a problem anymore.

Actions

Also available in: Atom PDF