0

In my opinion this happens only because of rackspace build (Freebsd 9.1)

root@office:/root # uname -a
FreeBSD office 9.1-RELEASE-p4 FreeBSD 9.1-RELEASE-p4 #1: Fri Jun 21 04:11:23 UTC 2013     root@freebsd:/usr/obj/usr/src/sys/XENHVM  amd64

With freshly built machine, after updating ports, and compiling mysql-server from ports, I'm trying to launch mysqld and that what's happens:

root@office:/root # cd /usr/
root@office:/root # /usr/local/etc/rc.d/mysql-server start
Starting mysql.
root@office:/root # /usr/local/etc/rc.d/mysql-server status
mysql is not running.
root@office:/root # ps ax | grep mysql
 4886  0  S+      0:00.00 grep mysql
root@office:/root # tail /var/db/mysql/office.err
/usr/local/libexec/mysqld: Can't create/write to file '/tmp/ib1NS09t' (Errcode: 13)
130705 11:35:44  InnoDB: Error: unable to create temporary file; errno: 13
130705 11:35:44 [ERROR] Plugin 'InnoDB' init function returned error.
130705 11:35:44 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130705 11:35:44 [ERROR] Unknown/unsupported storage engine: InnoDB
130705 11:35:44 [ERROR] Aborting

130705 11:35:44 [Note] /usr/local/libexec/mysqld: Shutdown complete

130705 11:35:44 mysqld_safe mysqld from pid file /var/db/mysql/office.pid ended

doing this at home, everything work fine. I think this caused by some partitioning scheme, that rackspace did.

here's some info about perms and partitions:

root@office:/root # df -h
Filesystem                   Size    Used   Avail Capacity  Mounted on
zroot                         15G    958M     15G     6%    /
devfs                        1.0k    1.0k      0B   100%    /dev
zroot/tmp                     15G    192k     15G     0%    /tmp
zroot/usr                     16G    1.3G     15G     8%    /usr
zroot/usr/ports               16G    1.5G     15G     9%    /usr/ports
zroot/usr/ports/distfiles     15G    145M     15G     1%    /usr/ports/distfiles
zroot/usr/ports/packages      15G    144k     15G     0%    /usr/ports/packages
zroot/usr/src                 15G    509M     15G     3%    /usr/src
zroot/var                     15G    1.1M     15G     0%    /var
zroot/var/crash               15G    148k     15G     0%    /var/crash
zroot/var/db                  15G    306M     15G     2%    /var/db
zroot/var/db/pkg              15G    2.2M     15G     0%    /var/db/pkg
zroot/var/empty               15G    144k     15G     0%    /var/empty
zroot/var/log                 15G    256k     15G     0%    /var/log
zroot/var/mail                15G    148k     15G     0%    /var/mail
zroot/var/run                 15G    244k     15G     0%    /var/run
zroot/var/tmp                 15G    152k     15G     0%    /var/tmp
root@office:/root # ls -lah /tmp
total 60
drwxr-xr-x   7 root  wheel     7B Jul  5 03:05 .
drwxr-xr-x  18 root  wheel    24B Jun 20 20:33 ..
drwxrwxrwt   2 root  wheel     2B Jul  4 12:39 .ICE-unix
drwxrwxrwt   2 root  wheel     2B Jul  4 12:39 .X11-unix
drwxrwxrwt   2 root  wheel     2B Jul  4 12:39 .XIM-unix
drwxrwxrwt   2 root  wheel     2B Jul  4 12:39 .font-unix
drwx------   2 root  wheel     3B Jul  4 13:07 tmux-0

Question is: how to find a problem and fix it?

Preferably without setting tmpdir parameter in my.cnf, I wanna fix this in proper way so I could feedback to rackspace that they made some mistake in their build.

holms
  • 1,524
  • 7
  • 20
  • 37
  • chown -R mysql:mysql /tmp change owner of tmp folder and then try to start mysql. – Abhishek Anand Amralkar Jul 05 '13 at 12:25
  • 2
    Not if you ever want anything else to run well in that machine. As Iain and ALex point out below, 1777 is the right mode for /tmp (and root:root the right owner). – MadHatter Jul 05 '13 at 12:30
  • In this case don't forget to add in /etc/fstab option **noexec** for /tmp partition for security reason. Your /etc/fstab should be like this: `/dev/ad0s1e /tmp ufs rw,noexec 2 2` –  Nov 16 '15 at 08:02

2 Answers2

3
root@office:/root # ls -lah /tmp
total 60
drwxr-xr-x   7 root  wheel     7B Jul  5 03:05 .
drwxr-xr-x  18 root  wheel    24B Jun 20 20:33 ..

with such permissions only root has write access into /tmp. You could try to change it

# chmod 777 /tmp
ALex_hha
  • 7,193
  • 1
  • 25
  • 40
  • 5
    You probably want to use 1777 to enable the sticky bit. – user9517 Jul 05 '13 at 12:22
  • is 777 valid for /tmp? i mean from perspective of defaults of linux/unix? – holms Jul 05 '13 at 12:30
  • it's valid. The /tmp directory is a world-writable directory used for temporary file storage by many programs by default. – ALex_hha Jul 05 '13 at 14:00
  • 1
    You definitely want the sticky bit enabled as noted above or users will be able to delete each others files in /tmp. see `man 7 sticky` for details. – Craig Jul 09 '13 at 01:00
  • 1
    In this case don't forget to add in /etc/fstab option **noexec** for /tmp partition for security reason. Your /etc/fstab should be like this: `/dev/ad0s1e /tmp ufs rw,noexec 2 2` –  Nov 16 '15 at 08:02
0

I also strangle with it and solved by changing the default location from on the file my.cnf

[client]
port                                = 3306
# socket                            = /tmp/mysql.sock
socket                          = /var/db/mysql/mysql.sock

[mysqld]
...
# socket                            = /tmp/mysql.sock
socket                          = /var/db/mysql/mysql.sock
...
alexander.polomodov
  • 1,068
  • 3
  • 10
  • 14