Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 152787 - dev-db/mysql init script does not handle chroot
Summary: dev-db/mysql init script does not handle chroot
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High enhancement
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-25 07:32 UTC by Cory Visi (RETIRED)
Modified: 2013-01-20 02:56 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
mysql-5.0.26-r1.ebuild.patch (mysql-5.0.26-r1.ebuild.patch,463 bytes, patch)
2006-10-25 07:33 UTC, Cory Visi (RETIRED)
Details | Diff
mysql.rc6.patch (mysql.rc6.patch,5.23 KB, patch)
2006-10-25 07:33 UTC, Cory Visi (RETIRED)
Details | Diff
mysql.conf.d.patch (mysql.conf.d.patch,382 bytes, patch)
2006-10-25 07:34 UTC, Cory Visi (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cory Visi (RETIRED) gentoo-dev 2006-10-25 07:32:56 UTC
The mysql init script has been through many revisions, yet still does not support a chroot'd mysql environment.  Fortuntely, however, it does not require many changes to do so.

I have attached 3 patches which I think provide good chroot support and I've tested it with success in an amd64-multilib environment.

Obviously, if you like the changes to the ebuild, we should migrate them to the eclass.  Also, I'm not sure if mysql needs any other libraries preloaded, but this seems to work perfectly.

Without libnss_compat.so preloaded you'll get the error:
[ERROR] Fatal error: Can't change to run as user 'mysql' ;  Please check that the user exists!

You could also copy this library into the chroot environment, but this is a more robust solution.

Finally, if this ends up being a well-received enhancement, I am willing to make the commits and get the changes tested by the different archs, if you would like.  For now, I defintely would like some feedback from the mysql team.
Comment 1 Cory Visi (RETIRED) gentoo-dev 2006-10-25 07:33:25 UTC
Created attachment 100458 [details, diff]
mysql-5.0.26-r1.ebuild.patch
Comment 2 Cory Visi (RETIRED) gentoo-dev 2006-10-25 07:33:46 UTC
Created attachment 100459 [details, diff]
mysql.rc6.patch
Comment 3 Cory Visi (RETIRED) gentoo-dev 2006-10-25 07:34:03 UTC
Created attachment 100460 [details, diff]
mysql.conf.d.patch
Comment 4 Cory Visi (RETIRED) gentoo-dev 2006-10-25 07:35:37 UTC
I should also state that this chroot environment is created by simply placing:

chroot = /home/mysql

under the mysqld section of my.cnf.
Comment 5 Cory Visi (RETIRED) gentoo-dev 2006-10-25 08:08:28 UTC
I also want to be clear on this point:
I am making this bug "normal" severity, because if you do use the my.cnf line mentioned above, Gentoo's init script thoroughly breaks.
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2006-10-25 08:21:35 UTC
Yeah, we never advertised it does handle/support chroot, why are you surprised? :)
Comment 7 Luca Longinotti (RETIRED) gentoo-dev 2007-01-12 22:29:21 UTC
Re-marking as enhancement, as Jakub stated it was never actually intended to work with chroot support... We'll ponder this and maybe add it, if you could update the patches to cleanly apply to the latest init.d/conf.d scripts, now found in dev-db/mysql-init-scripts, that would be greatly appreciated!
Best regards, CHTEKK.
Comment 8 i3laze 2007-04-28 14:19:53 UTC
I'm trying to run mysql-5.0.38 under chroot..
Without your patches "/etc/init.d/mysql start" was giving me this:
----------
 * Caching service dependencies ...                                       [ ok ]
 * Remounting root filesystem read-only ...
mount: / not mounted already, or bad option                               [ !! ]
 * Checking root filesystem ...
ext2fs_check_if_mount: No such file or directory while determining whether /dev/ROOT is mounted.
fsck.ext3: No such file or directory while trying to open /dev/ROOT
/dev/ROOT: 
The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
...
Press Ctrl+D to debug / reboot, e.t.c....
---------

After all patches there's no halts now.. but:
mysql doesnt launch finally:  "mysqld is already starting", and 'ps ax|grep mysql' shows me startup script is running..

can u check/release your patches for the latest mysql?
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-01-13 19:52:11 UTC
Please respin against mysql-init-scripts-2.0_pre1
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-01-20 02:56:53 UTC
No response from user for 2 years.