[MDEV-30137] Selinux context have to be manually fixed for 10.4 after backup restore (was: SeLinux prevents backup restore) Created: 2022-11-30 Updated: 2023-05-05 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Backup, Documentation, Packaging |
| Affects Version/s: | 10.4.27 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Timofey Turenko | Assignee: | Ian Gilfillan |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Description |
|
1. make a backup
2. stop server
3. Remove data dir as instructed in the doc
4. prepare and copy back backup
5. Set owner for data dir
6. Start server
Result:
setting Selinux to permissive mode fixes the problem:
tested with RHEL8 |
| Comments |
| Comment by Timofey Turenko [ 2022-12-02 ] | |||||||||||||||||||||||||
|
it is reproducible also without backup:
| |||||||||||||||||||||||||
| Comment by Timofey Turenko [ 2022-12-02 ] | |||||||||||||||||||||||||
|
after `mariadb-install-db` fixes the problem | |||||||||||||||||||||||||
| Comment by Daniel Black [ 2022-12-04 ] | |||||||||||||||||||||||||
|
10.4 seems to have mariadb-backup as a symlink to mariabackup. The fcontext of mariabackup per support-files/policy/selinux/mariadb-server.fc is list as system_u:object_r:mysqld_exec_t. Is this the case where its installed ls -laZ /usr/sbin/maria*? If you manually apply this context to the exe does it backup/restore correctly? Are the fcontext's actually installed sudo semanage fcontext --list | grep mysqld? Is the mariadb module installed sudo semanage module --list|grep mariadb? | |||||||||||||||||||||||||
| Comment by Timofey Turenko [ 2022-12-14 ] | |||||||||||||||||||||||||
|
10.4:
10.6:
| |||||||||||||||||||||||||
| Comment by Timofey Turenko [ 2022-12-14 ] | |||||||||||||||||||||||||
|
module is installed for both 10.6 and 10.4:
| |||||||||||||||||||||||||
| Comment by Timofey Turenko [ 2022-12-14 ] | |||||||||||||||||||||||||
|
sudo semanage fcontext --list | grep mysqld also alse the same for 10.4 nd 10.6
| |||||||||||||||||||||||||
| Comment by Timofey Turenko [ 2023-05-05 ] | |||||||||||||||||||||||||
|
it is reproducible only for 10.4 (the version where 'mariadb' is the symlink to 'mysql') the solution Is to add to the documentation: for 10.4 after restoring backup please execute `chcon -R -t mysqld_db_t /var/lib/mysql` (in the document https://mariadb.com/kb/en/full-backup-and-restore-with-mariabackup/#restoring-the-backup in the section "Then, you may need to fix the file permissions." for 10.,4 in addition to "chown -R mysql:mysql /var/lib/mysql/" also SELinux permission have to be fixed with `chcon -R -t mysqld_db_t /var/lib/mysql` |