juicedata/juicefs · error

read device list file

Error message

read device list file

What it means

Wraps failures while reading the cgroup v1 devices.list file in grantAccess: the scanner on /sys/fs/cgroup/devices/<group>/devices.list errored. The FUSE device permission check cannot verify or grant /dev/fuse access without it.

Source

Thrown at pkg/fuse/device_linux.go:85

	}

	if len(deviceCgroup) == 0 {
		return errors.Errorf("fail to find device cgroup")
	}

	deviceListPath := path.Join("/sys/fs/cgroup/devices" + deviceCgroup, "/devices.list")
	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 {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Re-run the mount — transient I/O errors usually clear on retry
  2. Verify the cgroup directory still exists and is stable during startup (avoid racing container teardown)
  3. Check dmesg for underlying I/O errors on the sysfs/cgroup mount
  4. If persistent, grant /dev/fuse manually so the devices.list read is skipped

Example fix

// before
./juicefs mount ...   // read device list file: input/output error
// after (retry or manual grant)
echo 'c 10:229 rwm' > /sys/fs/cgroup/devices/.../devices.allow && ./juicefs mount ...
Defensive patterns

Strategy: retry

Validate before calling

// sysfs files rarely fail preemptively; check the mount is stable
if _, err := os.Stat("/sys/fs/cgroup/devices"); err != nil {
  // cgroup dir unstable/missing
}

Try / catch

if err := grantAccess(); err != nil && strings.Contains(err.Error(), "read device list file") {
  time.Sleep(time.Second)
  err = grantAccess() // transient EIO usually clears
}

Prevention

When it happens

Trigger: Reading /sys/fs/cgroup/devices<path>/devices.list fails partway through — e.g. EIO from a corrupted sysfs mount, or the file being removed/unmounted while the scan is in progress.

Common situations: Race with container teardown deleting the cgroup directory during mount startup; fs corruption in sysfs-backed pseudo-filesystems; rare kernel/fs errors under memory pressure.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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