Wednesday, June 30, 2021

RHEL7 - Mount filesystem with selinux enabled content

 
Got following error while trying to mount the filesystem.

After mounting the disk the listed below problem appears.

root# mount -v /dev/vg1/lv_ssd /mnt/backup
mount: /home/ssd does not contain SELinux labels.
You just mounted an file system that supports labels which does not
contain labels, onto an SELinux box. It is likely that confined
applications will generate AVC messages and not be allowed access to
this file system. For more details see restorecon(8) and mount(8).
mount: /dev/vg1/lv_ssd mounted on /home/ssd.
root#


Tried the solution below, didn't work,
# semanage fcontext -a -s system_u /home/ssd
# cat /etc/selinux/targeted/contexts/files/file_contexts.local

still no change,
# ls -lZ /home/ssd

Tried,
# restorecon -vF /home/ssd

# ls -lZ /home/ssd
Still, didn't work

Tried again,
# restorecon -R /home/ssd 

didn't work,
# restorecon -Rv /home/ssd 

finally ran systemctl daemon-reload and remounted, it simply worked.

In fact fstab entries are converted to systemd units, so you have to run systemctl daemon-reload and try to mount again.

No comments:

Post a Comment

Git branch show detached HEAD

  Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03)   00 2. Run re-set hard $ git reset --hard 3. ...