juicedata/juicefs · error
failed to get mount command: %v
Error message
failed to get mount command: %v
What it means
After resolving the mount point, `juicefs debug` calls `getCmdMount(amp)` to find the mount process (uid, pid, command line). This error wraps any failure from that lookup — the underlying error comes from `ps` execution or from ambiguity/no-match in the process table scan.
Source
Thrown at cmd/debug.go:546
timestamp := time.Now().Format("20060102150405")
prefix := strings.Trim(strings.Join(strings.Split(amp, "/"), "-"), "-")
if runtime.GOOS == "windows" {
prefix = strings.ReplaceAll(prefix, ":", "")
}
outDir := ctx.String("out-dir")
currDir := filepath.Join(outDir, fmt.Sprintf("%s-%s", prefix, timestamp))
if err := os.MkdirAll(currDir, os.ModePerm); err != nil {
return fmt.Errorf("failed to create current out dir %s: %v", currDir, err)
}
if err := collectSysInfo(ctx, currDir); err != nil {
logger.Errorf("Failed to collect system info: %v", err)
}
uid, pid, cmd, err := getCmdMount(amp)
logger.Infof("mount point:%q pid:%s uid:%s", amp, pid, uid)
if err != nil {
return fmt.Errorf("failed to get mount command: %v", err)
}
fmt.Printf("\nMount Command:\n%s\n\n", cmd)
requireRootPrivileges := false
if (uid == "0" || uid == "root") && os.Getuid() != 0 {
fmt.Println("Mount point is mounted by the root user, may ask for root privilege...")
requireRootPrivileges = true
}
var wg sync.WaitGroup
if err := collectSpecialFile(ctx, amp, currDir, requireRootPrivileges, &wg); err != nil {
logger.Errorf("Failed to collect special file: %v", err)
}
if err := collectLog(ctx, cmd, requireRootPrivileges, currDir, uid); err != nil {
logger.Errorf("Failed to collect log: %v", err)
}
View on GitHub (pinned to c9a67b23e8)
Solutions
- Read the wrapped `%v` error to distinguish command failure from 'no mount command found' or 'more than one mount process'.
- Verify the mount is visible: `ps -ef | grep juicefs mount`.
- If multiple processes match, dismount stale/duplicate mounts and keep a single mount of the path.
- On restricted environments, run as root so all processes are visible.
Example fix
// before (duplicate mounts, ambiguous) $ juicefs debug /jfs // after (unmount duplicates first) $ sudo umount /jfs && sudo juicefs mount meta.db /jfs $ juicefs debug /jfs
Defensive patterns
Strategy: try-catch
Validate before calling
out, err := exec.Command("ps", "-ef").Output()
if err != nil { return fmt.Errorf("ps unavailable: %w", err) }
matches := 0
for _, l := range strings.Split(string(out), "\n") {
if strings.Contains(l, "mount") && strings.Contains(l, mp) { matches++ }
}
if matches == 0 { return errors.New("no mount process visible") }
if matches > 1 { return errors.New("ambiguous mount processes") } Type guard
null
Try / catch
err := runDebug(mp)
if err != nil && strings.Contains(err.Error(), "failed to get mount command") {
logger.Warn("mount process lookup failed; continuing with remaining debug info")
} Prevention
- Verify a single mount process serves the path before debugging
- Avoid duplicate/stale mounts of the same path
- Run in the same PID namespace as the mount process
When it happens
Trigger: Running `juicefs debug <mp>` when `getCmdMount` fails: the `ps` command cannot execute, no matching mount process is found, or multiple candidate mount processes create ambiguity.
Common situations: Debugging on a system without `ps` or a restricted /proc; a FUSE mount whose process is not visible (different user/namespace); multiple nested JuiceFS mounts on the same path.
Related errors
- find more than one mount process for %s
- no mount command found for %s
- failed to execute command `%s`: %v
- failed to execute command `%s`: %v
- failed to stat %s: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/75e95b36bd9d71cb.
Report an issue: GitHub.