juicedata/juicefs · error

invalid device list entry: %q

Error message

invalid device list entry: %q

What it means

Each line of the cgroup devices.list file must have the form 'type major:minor access' (3 space-separated fields). If a line splits into fewer than 3 fields, the entry is unparseable and grantAccess aborts with this error.

Source

Thrown at pkg/fuse/device_linux.go:92

	deviceAllowPath := path.Join("/sys/fs/cgroup/devices" + deviceCgroup, "/devices.allow")

	// check if fuse is already allowed
	deviceListFile, err := os.OpenFile(deviceListPath, os.O_RDONLY, 0)
	if err != nil {
		return errors.Wrapf(err, "open %s", deviceListPath)
	}
	defer deviceListFile.Close()
	deviceListScanner := bufio.NewScanner(deviceListFile)
	for deviceListScanner.Scan() {
		if err := deviceListScanner.Err(); err != nil {
			return errors.Wrap(err, "read device list file")
		}
		var (
			text  = deviceListScanner.Text()
			parts = strings.SplitN(text, " ", 3)
		)
		if len(parts) < 3 {
			return errors.Errorf("invalid device list entry: %q", text)
		}

		if (parts[0] == "c" || parts[0] == "a") && (parts[1] == "10:229" || parts[1] == "*:*") && parts[2] == "rwm" {
			logger.Debug("/dev/fuse is already granted")
			// fuse is already allowed
			return nil
		}
	}

	f, err := os.OpenFile(deviceAllowPath, os.O_WRONLY, 0)
	if err != nil {
		return errors.Wrapf(err, "open %s", deviceAllowPath)
	}
	defer f.Close()
	// 10, 229 according to https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
	content := "c 10:229 rwm"
	_, err = f.WriteString(content)
	if err != nil {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Inspect 'cat /sys/fs/cgroup/devices<path>/devices.list' and confirm entries look like 'c 1:3 mr' / 'a *:* rwm'
  2. Run on a standard kernel where devices.list emits the normal 3-field format
  3. Grant /dev/fuse manually (devices.allow write or --device /dev/fuse) to bypass the list parsing
  4. Report persistent malformed output to the runtime/kernel vendor

Example fix

// before (synthetic devices.list)
cat /sys/fs/cgroup/devices/devices.list  # "c 10:229 rwm extra"
// after: verify standard format
# c 10:229 rwm
Defensive patterns

Strategy: validation

Validate before calling

if data, err := os.ReadFile(listPath); err == nil {
  for _, l := range strings.Split(string(data), "\n") {
    if l != "" && len(strings.SplitN(l, " ", 3)) < 3 {
      // malformed devices.list entry; grantAccess will fail
    }
  }
}

Try / catch

if err := grantAccess(); err != nil && strings.Contains(err.Error(), "invalid device list entry") {
  logger.Warnf("device grant skipped, falling back to manual grant: %v", err)
}

Prevention

When it happens

Trigger: The kernel-provided devices.list contains a malformed entry (fields missing) — extremely rare; more practically a modified/patched kernel or a synthetic cgroup file in a testing/sandboxed environment.

Common situations: Unusual kernel configurations or LSMs altering devices.list output; sandboxed CI runners with virtualized /sys; debugging environments with hand-edited cgroup files.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/1464519d5ef38d7f. Report an issue: GitHub.