juicedata/juicefs · error

Can't read default config file: %s

Error message

Can't read default config file: %s

What it means

After configuring the RADOS connection, newCeph calls conn.ReadDefaultConfigFile(), which reads the default Ceph config (normally /etc/ceph/ceph.conf). If that file cannot be found or read, construction aborts with this message.

Source

Thrown at pkg/object/ceph.go:360

	}
	if opt := os.Getenv("CEPH_ADMIN_SOCKET"); opt != "none" {
		if opt == "" {
			opt = "$run_dir/jfs-$cluster-$name-$pid.asok"
		}
		if err = conn.SetConfigOption("admin_socket", opt); err != nil {
			logger.Warnf("Failed to set admin_socket to %s: %s", opt, err)
		}
	}
	if opt := os.Getenv("CEPH_LOG_FILE"); opt != "none" {
		if opt == "" {
			opt = "/var/log/ceph/jfs-$cluster-$name.log"
		}
		if err = conn.SetConfigOption("log_file", opt); err != nil {
			logger.Warnf("Failed to set log_file to %s: %s", opt, err)
		}
	}
	if err := conn.ReadDefaultConfigFile(); err != nil {
		return nil, fmt.Errorf("Can't read default config file: %s", err)
	}
	if err := conn.Connect(); err != nil {
		return nil, fmt.Errorf("Can't connect to cluster %s: %s", cluster, err)
	}
	return &ceph{
		name: name,
		conn: conn,
		free: make(chan *rados.IOContext, 50),
	}, nil
}

func init() {
	Register("ceph", newCeph)
}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Install/copy a valid ceph.conf to /etc/ceph/ (or the cluster-specific path)
  2. Set the CEPH_CONF environment variable to point at the correct config file
  3. Fix file permissions so the process user can read the config
  4. Confirm the cluster name matches the config file name convention (<cluster>.conf)

Example fix

// before
# no /etc/ceph/ceph.conf on host
// after
cp ceph.conf /etc/ceph/ceph.conf && chmod 644 /etc/ceph/ceph.conf
export CEPH_CONF=/etc/ceph/ceph.conf
Defensive patterns

Strategy: validation

Validate before calling

// Shell: ensure config readable before start
CONF="${CEPH_CONF:-/etc/ceph/ceph.conf}"
[ -r "$CONF" ] || { echo "missing/unreadable $CONF"; exit 1; }

Try / catch

// Go
obj, err := object.NewCeph(endpoint, cluster, user, "")
if err != nil && strings.Contains(err.Error(), "Can't read default config file") {
    log.Fatalf("install ceph.conf or set CEPH_CONF: %v", err)
}

Prevention

When it happens

Trigger: conn.ReadDefaultConfigFile() errors because /etc/ceph/<cluster>.conf is missing, unreadable (permissions), or malformed for the current user/environment.

Common situations: Running the JuiceFS client on a machine without a Ceph config file; CEPH_CONF not set; file permissions preventing the process user from reading /etc/ceph/ceph.conf; container images lacking ceph configs.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


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