Skip to content

devices: ignore .incus-mounts in GetDevices #260

Description

@siretart

In Incus containers, /dev/.incus-mounts is created with mode 0700. Calling devices.GetDevices("/dev") fails with:

open /dev/.incus-mounts: permission denied

Similar to the existing .lxc and .lxd-mounts entries, .incus-mounts should be skipped during directory traversal:

diff --git a/devices/device_unix.go b/devices/device_unix.go
index bd401d3..174979d 100644
--- a/devices/device_unix.go
+++ b/devices/device_unix.go
@@ -100,7 +100,8 @@ func GetDevices(path string) ([]*config.Device, error) {
 			switch f.Name() {
 			// ".lxc" & ".lxd-mounts" added to address https://github.com/lxc/lxd/issues/2825
 			// ".udev" added to address https://github.com/opencontainers/runc/issues/2093
-			case "pts", "shm", "fd", "mqueue", ".lxc", ".lxd-mounts", ".udev":
+			// ".incus-mounts" added for Incus container environments
+			case "pts", "shm", "fd", "mqueue", ".lxc", ".lxd-mounts", ".udev", ".incus-mounts":
 				continue
 			default:
 				sub, err := GetDevices(filepath.Join(path, f.Name()))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions