Comment 6 for bug 1710973

Revision history for this message
Adrien Fleury (fleu42) wrote :

Hi,

I have been facing the same issue this morning.

The code called at that time is the following :

```
        sudo ${_runcon} chroot ${TARGET_ROOT} \
            /usr/sbin/setfiles -F ${_dash_m} \
            /etc/selinux/targeted/contexts/files/file_contexts ${MOUNTPOINT}
    fi
done
```

The thing is `sudo` needs the `-t` option to execute commands in an SELinux context.

We could call it like that to fix this bug:

```
        sudo -t "${_runcon}" chroot ${TARGET_ROOT} \
            /usr/sbin/setfiles -F ${_dash_m} \
            /etc/selinux/targeted/contexts/files/file_contexts ${MOUNTPOINT}
    fi
done
```

`-t ""` allows us to run sudo even if there is no context.