Bug #36462 | mysql_install_db fails when run as user root and root-directory not writable | ||
---|---|---|---|
Submitted: | 2 May 2008 5:52 | Modified: | 7 Mar 2010 18:46 |
Reporter: | Johannes Martin | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Installing | Severity: | S3 (Non-critical) |
Version: | 5.0.45, 5.0, 5.1, 6.0 bzr | OS: | Linux |
Assigned to: | Jonathan Perkin | CPU Architecture: | Any |
[2 May 2008 5:52]
Johannes Martin
[20 May 2008 15:47]
Sveta Smirnova
Thank you for the report. Please provide output of `ls -laR /var/lib/mysql`
[21 May 2008 6:44]
Johannes Martin
Sorry, the original directory contents are no longer available. Also, I do not quite understand why you would need this. You can verify that "test -w /" does not work as intended quite easily.
[21 May 2008 20:50]
Sveta Smirnova
Thank you for the feedback. But root user is allowed to write even to directory with 000 rights: apple:/test root# ls -ld bug36462/ d--------- 2 apple apple 68 22 май 00:34 bug36462/ apple:/test root# id uid=0(root) gid=0(wheel) groups=0(wheel) ... apple:/test root# if test -w bug36462; then echo 1; fi 1 apple:/test root# rmdir bug36462/ apple:/test root# I ask for output of ls command to be sure directories have correct rights.
[3 Jun 2008 6:03]
Johannes Martin
You wrote: > But root user is allowed to write even to directory with 000 rights: Yes, that's true. But the root user cannot write to a filesystem that is mounted read-only. If you boot from the network or a CD, you may have a root filesystem that is not-writable at all.
[15 Oct 2008 6:13]
Sveta Smirnova
Thank you for the feedback. Verified as described reading source code.
[7 Jan 2009 17:42]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/62625 2667 Jonathan Perkin 2009-01-07 bug#36462: mysql_install_db fails when run as user root and root-directory not writable Rather than use the -w test, attempt the chown and bail out if it fails.
[8 Jan 2009 12:37]
Bjørn Munch
Simple comment: "Check you have" should be "Check that you have", shouldn't it? Also, aren't you also changing the behavior? Before, if you ran this as an ordinary user, it would not try to chown. But now if you do the same, it fails because it can't. Maybe that's the correct behavior but it's changed as far as I can tell.
[8 Jan 2009 13:02]
Jonathan Perkin
'Check that' is probably better grammar, though given the quality of English throughout the rest of the script I'm not sure it matters much :-) The change in behaviour is deliberate. I know of no reasonable way of portably checking that the chown will succeed other than actually running it and checking exit status. Note that this whole test is still wrapped inside the test for --user being passed on the command line, which an 'ordinary user' would be unlikely to use (the --help still suggests that you need to be root to use --user, although that is not necessarily the case).
[8 Jan 2009 13:58]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/62690 2667 Jonathan Perkin 2009-01-08 bug#36462: mysql_install_db fails when run as user root and root-directory not writable Rather than use the -w test, attempt the chown and bail out if it fails.
[8 Jan 2009 14:05]
Bjørn Munch
OK to push.
[26 Mar 2009 20:56]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/70593 2750 Jonathan Perkin 2009-03-26 [merge] bug#36462: mysql_install_db fails when run as user root and root-directory not writable Rather than use the -w test, attempt the chown and bail out if it fails.
[26 Mar 2009 20:58]
Jonathan Perkin
Pushed into mysql-6.0-build.
[6 May 2009 14:07]
Bugs System
Pushed into 6.0.12-alpha (revid:svoj@sun.com-20090506125450-yokcmvqf2g7jhujq) (version source revid:timothy.smith@sun.com-20090402052930-78npdzhwd7hg7dav) (merge vers: 6.0.11-alpha) (pib:6)
[12 May 2009 0:28]
Paul DuBois
Noted in 6.0.12 changelog. mysql_install_db failed if run as root and the root directory (/) was not writable.
[20 Nov 2009 15:11]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/91112 2948 Jonathan Perkin 2009-11-20 bug#36462: mysql_install_db fails when run as user root and root-directory not writable Rather than use the -w test, attempt the chown and bail out if it fails.
[23 Nov 2009 13:35]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/91310 2899 Jonathan Perkin 2009-11-23 bug#36462: mysql_install_db fails when run as user root and root-directory not writable Rather than use the -w test, attempt the chown and bail out if it fails.
[11 Dec 2009 6:02]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091211055901-yp18b3c7xuhl87rf) (version source revid:alik@sun.com-20091211055401-43rjwq7gjed6ds83) (merge vers: 6.0.14-alpha) (pib:13)
[11 Dec 2009 6:04]
Bugs System
Pushed into 5.6.0-beta (revid:alik@sun.com-20091211055628-ltr7fero363uev7r) (version source revid:alik@sun.com-20091211055453-717czhtezc74u8db) (merge vers: 5.6.0-beta) (pib:13)
[11 Dec 2009 10:19]
MC Brown
Entries added to the 5.60 and 6.0.14 changelogs.
[6 Mar 2010 10:53]
Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20091211201717-03qf8ckwiw0np80p) (merge vers: 5.6.0-beta) (pib:16)
[7 Mar 2010 18:46]
Paul DuBois
Moved 5.6.0 changelog entry to 5.5.3.