root@hirsute:~# ./test
access errno 13
path is read only: 0
root@hirsute:~# mount | grep 'sysfs on /sys '
sysfs on /sys type sysfs (rw,relatime)
On focal lxd container:
root@focal:~# ./test
path is read only: 1
root@focal:~# mount | grep 'sysfs on /sys '
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
There is here a change in behavior in lxc/lxd. Running https:/ /paste. ubuntu. com/p/vz7SXcX3K 9/:
On hirsute lxd container:
root@hirsute:~# ./test
access errno 13
path is read only: 0
root@hirsute:~# mount | grep 'sysfs on /sys '
sysfs on /sys type sysfs (rw,relatime)
On focal lxd container:
root@focal:~# ./test nodev,noexec, relatime) nodev,noexec, relatime)
path is read only: 1
root@focal:~# mount | grep 'sysfs on /sys '
sysfs on /sys type sysfs (rw,nosuid,
sysfs on /sys type sysfs (ro,nosuid,
(no idea why there are two mounts in focal)
According to https:/ /systemd. io/CONTAINER_ INTERFACE/ , /sys should be mounted read-only?