[MDEV-29910] mysql_install_db fails with libpam-tmpdir Created: 2022-10-28 Updated: 2023-11-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.6.10 |
| Fix Version/s: | 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sunil Mohan Adapa | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug, regression | ||
| Environment: |
OS: Debian GNU/Linux (unstable) |
||
| Description |
| Comments |
| Comment by Daniel Black [ 2022-10-28 ] | ||||||||||||
|
Because mysql_install_db passes --user mysql to the mariadbd server process, and the server process does setuid to the mysql user, the $TMPDIR isn't changed from the root user. Running su -l mysql mysql_install_db ... Might trigger the pam bits to set $TMPDIR to the path for the mysql user. If you could test that it would be appreciated. | ||||||||||||
| Comment by Sunil Mohan Adapa [ 2022-10-28 ] | ||||||||||||
|
I believe
is not working (perhaps because mysql user is not allowed to have a shell). My test:
However, bypassing the disabled shell for mysql user using sudo works as I tried in one of the workarounds:
| ||||||||||||
| Comment by Otto Kekäläinen [ 2022-10-29 ] | ||||||||||||
|
A MR to fix this in Debian directly was submitted at https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/23 the the same author. Thanks Sunil! | ||||||||||||
| Comment by Daniel Black [ 2022-10-31 ] | ||||||||||||
|
Thanks for testing. I was wondering about locked accounts. sudo probably isn't always available. Setting TMPDIR to empty is a nice, probably portable fix for pushing into mysql_install_db. | ||||||||||||
| Comment by Tuukka Pasanen [ 2022-11-07 ] | ||||||||||||
|
Thank you for good bug report sunil. After little bit digging this I like to ask some questions if I understood correctly. does I understand correctly that pam-tmpdir does this:
I would see that TMPDIR should be filled with
neither than just unset it. | ||||||||||||
| Comment by Sunil Mohan Adapa [ 2022-11-07 ] | ||||||||||||
It looks like /tmp/users is created by the PAM module with superuser privileges. I did the following to confirm:
| ||||||||||||
| Comment by Tuukka Pasanen [ 2022-11-09 ] | ||||||||||||
|
Thank you for fast reply. Need little bit digging and testing on my side to get this straight. danblack do you have opinion on this? | ||||||||||||
| Comment by Daniel Black [ 2022-11-09 ] | ||||||||||||
|
Opinion on "I would see that TMPDIR should be filled with mkstemp neither than just unset it.":
| ||||||||||||
| Comment by Sunil Mohan Adapa [ 2022-11-10 ] | ||||||||||||
|
I don't know the exact code we are talking about here but in order for 'mysql' user to get a proper value for TMPDIR, one could start a proper PAM session. So, instead of doing sometime like 'setuid ; do task' one could do 'su -c task'. |