Bug #43676 server installer exits with return code = 0 although an "Error" is shown
Submitted: 16 Mar 2009 14:13 Modified: 22 May 2009 13:59
Reporter: Carsten Segieth Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Installing Severity:S3 (Non-critical)
Version:2.1.0.1015 OS:Linux (x86_64)
Assigned to: BitRock Merlin CPU Architecture:Any
Triage: Needs Triage: D4 (Minor)

[16 Mar 2009 14:13] Carsten Segieth
Description:
The installer exists with a return code '0' even if an error was detected during the install and reported to the user.

-------------------------------------------------------------------------------
.../mysqlmonitor-2.1.0.1015-linux-x86-64bit-installer.bin --mode unattended --installdir /data0/merlin/monitoring/2.1.0.1015/host/38080 --tomcatport 38080 --tomcatshutdownport 38503 --tomcatsslport 38443 --dbport 33300 --usessl 1 --adminuser **user** --adminpassword **pwd**
Error running /data0/merlin/monitoring/2.1.0.1015/host/38080/mysql/bin/mysql --defaults-file=/data0/merlin/monitoring/2.1.0.1015/host/38080/mysql/my.cnf -S /data0/merlin/monitoring/2.1.0.1015/qa-merlin/38080/mysql/tmp/mysql.sock -u root -D mysql -e "update user set Password = PASSWORD('**pwd**') where User = 'root'; update user set User = '**user**' where User = 'root';delete from user where User = '';flush privileges;" : ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data0/merlin/monitoring/2.1.0.1015/host/38080/mysql/tmp/mysql.sock' (2)

How to repeat:
- have a mysqld running on the port that shall be used by the bundled mysql (here: port 33300)
- start installer, e.g. with a command like shown above
- see the error reported by the installer
- check that the return code of the installer is '0'

Suggested fix:
Change return code to a non-zero value in case of detected errors to allow to check for success of the installation by checking the $RC.
[16 Mar 2009 14:17] Carsten Segieth
not checked, but I assume that this problem occurs also on other OS.
[2 Apr 2009 10:41] BitRock Merlin
Patch sent to Keith.
[8 Apr 2009 18:43] Keith Russell
Patch installed in versions => 2.1.0.1024.
[14 Apr 2009 13:13] Carsten Segieth
tested *not OK* with build 2.1.0.1024, the $RC is still '0' when an Error occurs during installation:

$ VERS=2.1.0.1024; M=unattended; mysqlmonitor-${VERS}-linux-x86-64bit-installer.bin --mode $M --installdir /data0/merlin/monitoring/${VERS}/_BOX_/28080 --tomcatport 28080 --tomcatshutdownport 28503 --tomcatsslport 28443 --dbport 23300 --usessl 1 --adminuser *user* --adminpassword *pwd*; echo ... RC = $? ...; echo
Error running /data0/merlin/monitoring/2.1.0.1024/_BOX_/28080/mysql/bin/mysql --defaults-file=/data0/merlin/monitoring/2.1.0.1024/_BOX_/28080/mysql/my.cnf -S /data0/merlin/monitoring/2.1.0.1024/_BOX_/28080/mysql/tmp/mysql.sock -u root -D mysql -e "update user set Password = PASSWORD('*pwd*') where User = 'root'; update user set User = '*user*' where User = 'root';delete from user where User = '';flush privileges;" : ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data0/merlin/monitoring/2.1.0.1024/_BOX_/28080/mysql/tmp/mysql.sock' (2)
... RC = 0 ...

Same result / problem with mode=text, where here also a message ("computerReport2.SetInstallerVariable.errorsOnSQLStatementsText") shown during install does not look OK, and after this one is asked to launch the monitor, which will fail from the Error that happened during install:

----------------------------------------------------------------------------
Completed installing files

Setup has completed installing the MySQL Enterprise Monitor files on your
computerReport2.SetInstallerVariable.errorsOnSQLStatementsText

Uninstalling the MySQL Enterprise Monitor files can be done by invoking:
/data0/merlin/monitoring/2.1.0.1024/_BOX_/28080/uninstall

To complete the installation, launch the MySQL Enterprise Dashboard and complete
the initial setup and product activation information. Refer to the readme file
for additional information and a list of known issues.

Press [Enter] to continue :

----------------------------------------------------------------------------
[30 Apr 2009 11:35] BitRock Merlin
Patch sent to Keith.
[4 May 2009 23:30] Keith Russell
Patch installed in versions => 2.1.0.1036.
[13 May 2009 11:11] Carsten Segieth
checked OK with 2.1.0.1036:
- installer returns non-zero RC in case of errors detected during install, also if running in 'text' mode
- missing text replacement has been fixed
- the problem with the in case of an error shown message 
    "To complete the installation, launch the MySQL Enterprise Dashboard and
    complete the initial setup and product activation information. Refer to
    the readme file for additional information and a list of known issues."
  is still present, this will be noted as a separate problem as it also may
  need translation if the text changes.
[22 May 2009 13:59] Tony Bedford
An entry has been added to the 2.1.0 changelog:

The installer exited with a return code 0, even if an error was detected and reported to the user during the installation.

.../mysqlmonitor-2.1.0.1015-linux-x86-64bit-installer.bin --mode unattended --installdir
/data0/merlin/monitoring/2.1.0.1015/host/38080 --tomcatport 38080 --tomcatshutdownport
38503 --tomcatsslport 38443 --dbport 33300 --usessl 1 --adminuser **user** --adminpassword **pwd**
Error running /data0/merlin/monitoring/2.1.0.1015/host/38080/mysql/bin/mysql
--defaults-file=/data0/merlin/monitoring/2.1.0.1015/host/38080/mysql/my.cnf -S
/data0/merlin/monitoring/2.1.0.1015/qa-merlin/38080/mysql/tmp/mysql.sock -u root -D mysql
-e "update user set Password = PASSWORD('**pwd**') where User = 'root'; update user set
User = '**user**' where User = 'root';delete from user where User = '';flush privileges;"
: ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/data0/merlin/monitoring/2.1.0.1015/host/38080/mysql/tmp/mysql.sock' (2)