We're an ISO27001:2013 Certified Supplier

If the permissions on the /tmp directory are incorrect, all kinds of odd behaviour can result. Symptoms include the refusal of some system daemon processes to start, such as MySQL and MariaDB. The error messages they give under such circumstances do not make it obvious what the problem is.

Checking /tmp Permissions

To check that the permissions are correct:

# ls -ld /tmp
drwxrwxrwt 30 root root 12288 Jul  7 09:00 /tmp

Note the final t in the permissions. This is the sticky bit. When set on a directory, the directory contents may be deleted only by the file owner despite other users have full access permissions.

Correcting /tmp Permissions

If the file ownership and mode of /tmp are incorrect, they may be reset with:

# chown root:root /tmp
# chmod 1777 /tmp

No Clues

This is what happens if you try to start MariaDB with the incorrect permissions on /tmp. Firstly, let’s stop MariaDB and then  set the permissions of /tmp incorrectly:

# systemctl stop mariadb.service
# chmod 755 /tmp       # THIS IS NOT CORRECT!

Now let’s try starting it:

# systemctl start mariadb.service
Job for mariadb.service failed because the control process exited with error code.
See “systemctl status mariadb.service” and “journalctl -xe” for details.

The journal doesn’t help much, either:

# journalctl -xe
Jul 05 15:04:10 awe systemd[1]: Starting MariaDB database server... 
-- Subject: Unit mariadb.service has begun start-up 
-- Defined-By: systemd 
-- Support: https://www.debian.org/support 
--  
-- Unit mariadb.service has begun starting up. 
Jul 05 15:04:11 awe mysqld[5223]: 2017-07-05 15:04:11 140247815541312 [Note] 
                /usr/sbin/mysqld (mysqld 10.1.23-MariaDB-9+deb9u1) starting as process 5223 ... 
Jul 05 15:04:11 awe systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE 
Jul 05 15:04:11 awe systemd[1]: Failed to start MariaDB database server. 
-- Subject: Unit mariadb.service has failed 
-- Defined-By: systemd 
-- Support: https://www.debian.org/support 
--  
-- Unit mariadb.service has failed. 
--  
-- The result is failed.

There really are no clues.

Don’t forget to reset the /tmp permissions after trying this:

# chmod 1777 /tmp

Could this Linux Tip be improved?

Let us know in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *

Secure. Reliable. Scalable.

If that doesn't describe your current Linux systems, check out our FREE Linux Survival Guide to help you get your systems up to scratch today!

  • This field is for validation purposes and should be left unchanged.