[MDEV-21140] galera_recovery script is incompatible with fs.protected_regular = 1 sysctl Created: 2019-11-24 Updated: 2020-04-22 Resolved: 2019-11-28 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Galera, Scripts & Clients |
| Affects Version/s: | 10.3.18 |
| Fix Version/s: | 10.5.0, 10.1.45, 10.2.32, 10.3.23, 10.4.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander E. Patrakov | Assignee: | Jan Lindström (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | contribution, galera | ||
| Environment: |
Arch Linux; also Debian LXC containers on Arch Linux; any other Linux with modern systemd |
||
| Issue Links: |
|
||||||||
| Description |
|
(this has been already reported as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=945051) I have created a few Debian LXC containers on my Arch Linux system for the purpose of testing Galera replication in MariaDB. Unfortunately, they don't work out of the box, because Arch Linux comes with fs.protected_regular = 1 sysctl by default. The same applies to any other distribution which uses a modern version of systemd: see https://github.com/systemd/systemd/commit/2732587540035227fe59e4b64b60127352611b35 . The failing script during service start is /usr/bin/galera_recovery, the error is: /usr/bin/galera_recovery: 71: /usr/bin/galera_recovery: cannot create /tmp/wsrep_recovery.BLuWHq: Permission denied Let's see why (ine numbers are from Debian). 28 log_file=$(mktemp /tmp/wsrep_recovery.XXXXXX) So, $log_file is created by mktemp, then chowned to $user, and then opened for writing the log. The opening happens by the shell, not by mysqld, and so it's done as root. So, root tries to open a file, owned by someone else, in a sticky world-writeable directory, and this is exactly what fs.protected_regular = 1 disallows. The fix would be to remove this line: [ "$euid" = "0" ] && chown $user $log_file This is valid, because permissions are checked at open time, and it's root, not $user, who opens the file. |
| Comments |
| Comment by Alexander E. Patrakov [ 2019-11-24 ] |
| Comment by Jan Lindström (Inactive) [ 2020-02-18 ] |
|
Merged to 10.4 in commit 2cff5428920a05bc8918d55ba3e221f065313c86 |