Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 177736

Summary: mysqld fails to start on tmpfs mounted /var/run (can't find /var/run/mysqld)
Product: Gentoo Linux Reporter: Joshua Rich <joshua.rich>
Component: [OLD] ServerAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: VERIFIED WORKSFORME    
Severity: normal CC: d.h.j.takken
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Joshua Rich 2007-05-09 00:21:28 UTC
The mysql init script fails to start mysqld on my system with a tmpfs
mounted /var/run/ directory.   The following is the relevant fstab
entry:

tmpfs /var/run tmpfs defaults,nosuid,size=512m,mode=1777 0 0

Running the mysql init script only produces a "MySQL NOT started (1)"
error message.  Looking in /var/log/mysql/mysqld.err I find the following
messages:

070509  9:51:51 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when t     his MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=/var/run/mysqld/mysqld-bin' to avoid this p     roblem.
/usr/sbin/mysqld: File '/var/run/mysqld/mysqld-bin.index' not found (Errcode: 2)
070509  9:51:51 [ERROR] Aborting

070509  9:51:51 [Note] /usr/sbin/mysqld: Shutdown complete

Creating /var/run/mysqld with root:mysql permissions and user/group
writable allows mysql to start properly with the init script.

Maybe the init script should check for /var/run/mysqld and create if
necessary?  Maybe mounting /var/run in tmpfs is a bad idea?




Reproducible: Always

Steps to Reproduce:
1.  Mount /var/run with tmpfs.  Make sure /var/run/mysqld does not exist.
2.  Start mysql: (i.e. /etc/init.d/mysql start). It will fail.
3.  mkdir /var/run/mysqld; chgrp mysql /var/run/mysqld; chmod g+w /var/run/mysqld
4.  Restart mysql, it works!






## Installed versions:

dev-db/mysql-5.0.38
dev-db/mysql-init-scripts-1.2

## emerge --info output:

Portage 2.1.2.2 (default-linux/x86/2006.1, gcc-4.1.1, glibc-2.5-r2, 2.6.21-gentoo i686)
=================================================================
System uname: 2.6.21-gentoo i686 Genuine Intel(R) CPU           T2500  @ 2.00GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Tue, 08 May 2007 02:50:01 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.31-r5
dev-lang/python:     2.4.4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer noinfo parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp.swin.edu.au/gentoo  http://ftp.planetmirror.com/pub/gentoo http://mirror.pacific.net.au/linux/Gentoo ftp://ftp.swin.edu.au/gentoo ftp://ftp.planetmirror.com/pub/gentoo ftp://mirror.pacific.net.au/linux/Gentoo"
LANG="en_AU.UTF-8"
LC_ALL="en_AU.UTF-8"
LINGUAS="en"
MAKEOPTS="-j3 -l 2.0"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/overlays /usr/local/portage /usr/portage/local/layman/sunrise /usr/portage/local/layman/science /usr/portage/local/layman/java-overlay"
SYNC="rsync://ftp.swin.edu.au/gentoo-portage"
USE="X acpi alsa audiofile bash-completion berkdb bitmap-fonts bzip2 cairo cdr cli cracklib crypt cups curl dbus dri dvd dvdr dvdread emacs encode fam firefox flac foomaticdb fortran gdbm gif gmp gpm gs gstreamer gtk2 hal iconv isdnlog jpeg lcms libg++ logrotate mad midi minimal mmx mng mp3 ncurses nptl nptlonly nsplugin opengl pam pcmcia pcre pdf perl png ppds pppd python readline reflection session shorten spell spl sqlite sse sse2 ssl startup-notification svg tcpd tetex threads tiff truetype truetype-fonts type1-fonts unicode x86 xinerama xml xorg xpm zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="nvidia vesa nv"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-05-09 05:32:57 UTC
Sorry, if you moved /var/run to a volatile filesystem, it's up to you to make sure  the needed dirs get created/bind-mounted or whatever. mysql.eclass already creates the directory, incl. the needed permissions. And note that /var/run subdirectories completely wiped on reboot will break lots more than just mysql.
Comment 2 Joshua Rich 2007-05-09 06:17:16 UTC
Ah, I see.  There appears to be confusing and/or conflicting views as
to whether /var/run can be mounted in this way.  If you say it breaks
other stuff then I guess that is a bad thing, I take it Gentoo expects a non-volatile /var/run in a few programs.  In that case, away with tmpfs!

Thanks for the quick response!

Josh
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-05-09 06:55:27 UTC
Well, at least hal, dbus, samba, nscd, vmware, screen and sudo expect the dirs to be there with appropriate permissions (only the stuff that I have installed here, there's definitely more).

# ls -lAd $(find /var/run -maxdepth 1 -type d)
drwxr-xr-x 12 root      root      2312 2007-05-08 19:25 /var/run
drwxr-xr-x  2 avahi     avahi       96 2007-05-08 18:54 /var/run/avahi-daemon
drwxr-xr-x  3 root      lp         104 2007-05-08 18:54 /var/run/cups
drwxr-xr-x  2 root      root        88 2007-05-08 18:54 /var/run/dbus
drwxr-xr-x  4 haldaemon haldaemon  112 2007-04-27 23:57 /var/run/hald
drwxr-xr-x  2 root      root        96 2007-05-08 18:54 /var/run/nscd
drwxr-xr-x  2 root      root        96 2007-05-08 18:54 /var/run/samba
drwxr-xr-x  4 root      root        96 2006-11-04 01:13 /var/run/screen
drwx------  3 root      root        72 2006-11-10 13:10 /var/run/sudo
drwxr-xr-x  2 tor       tor         72 2007-05-08 18:55 /var/run/tor
drwxr-xr-x  3 root      root       144 2007-05-08 19:25 /var/run/vmware

So, I really don't think it's a good idea to wipe the dir on every reboot. :)
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2007-08-12 08:58:32 UTC
*** Bug 188543 has been marked as a duplicate of this bug. ***