Bug #68117 mysql_intall_db does not work in solaris 10 sparse root zones
Submitted: 18 Jan 2013 10:48 Modified: 1 Mar 2013 17:05
Reporter: Detlef Ulherr Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:5.6 OS:Solaris (10u9)
Assigned to: CPU Architecture:Any

[18 Jan 2013 10:48] Detlef Ulherr
The mysql_install_db script reports FATAL ERROR if called in the following environment.
OS=Solaris 10 u9

/usr/local/mysql/scripts/mysql_install_db --datadir=/mysql/data

It does work int he global zone.
Obviously it needs write permission in /usr/local/mysql tow create a my.cnf file. I found no way to direct it to create the my.cnf file under /mysql/data

How to repeat:
in the global zone:
create a spares root zone in Solaris 10
untar the binaries under /usr/local
link /usr/local/mysql to the binaries

In the local zone:
call the mysql_install_db --datadir=/mysql/data
[18 Jan 2013 11:36] Hartmut Holzgraefe
Reproducible with basedir being read-only for the user running mysql_install_db, e.g.:

sudo make install # install as root
cd /usr/local/mysql
sudo mkdir data
sudo chmod a+rwx data

Fails at

454: open (CFG, "> $copy_cfg_file") or error("Could not open config file");

as $copy_cfg_file is in basedir ... and giving the script a different --basedir option makes it fail with

FATAL ERROR: Could not find my-default.cnf

Suggested fix: restore old behavior and make creating a my.cnf from my-default.cnf optional, or at least add an option to fall back to the old "don't write a my.cnf" behavior
[18 Jan 2013 11:37] Hartmut Holzgraefe
The "FATAL ERROR:" without message btw is due to error() taking two arguments ($opt and $text) but being called with just one argument in several places ... separate bug report about that coming soon ...
[21 Jan 2013 11:28] Erlend Dahl
Verified as described by Hartmut.
[8 Feb 2013 13:17] Leandro Morgado
Same problem is happening when running mysql_install_db as a non root user. In a RHEL5 installation, it tries to create /usr/my*.cnf files and it can't because /usr is only writaeble by root:

open("/usr/my-new.cnf", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 EACCES (Permission denied)
brk(0x3bd5000)                          = 0x3bd5000
write(1, "FATAL ERROR: Could not open conf"..., 40) = 40
close(3)                                = 0
brk(0x3bd4000)                          = 0x3bd4000
exit_group(1)                           = ?

[mysql@localhost ~]$ ls -la /usr/my.cnf
-rw-r--r-- 1 root root 943 Feb  6 10:44 /usr/my.cnf
[19 Feb 2013 17:50] Sveta Smirnova
See also Bug #68416
[1 Mar 2013 17:05] Paul DuBois
Noted in 5.6.11, 5.7.1 changelogs.

mysql_install_db did not work in Solaris 10 sparse root zones.
[9 May 2014 10:05] Terje Røsten
See also Bug #71600.