devices: ignore .incus-mounts in GetDevices

Open Beginner friendly
#260 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go

Research direction

Start in devices/device_unix.go at GetDevices and its directory-entry switch, where .lxc and .lxd-mounts are already skipped. Add .incus-mounts to the skipped entries and verify that GetDevices("/dev") no longer attempts to open that mode-0700 path.

Written by the indexing model from the issue text.

Description

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()))
Dominant language
Go
Stars
101
Forks
61
Avg merge
2d 7h
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from moby/sys

All issues in moby/sys

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.