{"record":{"id":"2008fb17f26939ce","repo":"juicedata/juicefs","slug":"can-t-read-default-config-file-s","errorCode":null,"errorMessage":"Can't read default config file: %s","messagePattern":"Can't read default config file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/ceph.go","lineNumber":360,"sourceCode":"\t}\n\tif opt := os.Getenv(\"CEPH_ADMIN_SOCKET\"); opt != \"none\" {\n\t\tif opt == \"\" {\n\t\t\topt = \"$run_dir/jfs-$cluster-$name-$pid.asok\"\n\t\t}\n\t\tif err = conn.SetConfigOption(\"admin_socket\", opt); err != nil {\n\t\t\tlogger.Warnf(\"Failed to set admin_socket to %s: %s\", opt, err)\n\t\t}\n\t}\n\tif opt := os.Getenv(\"CEPH_LOG_FILE\"); opt != \"none\" {\n\t\tif opt == \"\" {\n\t\t\topt = \"/var/log/ceph/jfs-$cluster-$name.log\"\n\t\t}\n\t\tif err = conn.SetConfigOption(\"log_file\", opt); err != nil {\n\t\t\tlogger.Warnf(\"Failed to set log_file to %s: %s\", opt, err)\n\t\t}\n\t}\n\tif err := conn.ReadDefaultConfigFile(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Can't read default config file: %s\", err)\n\t}\n\tif err := conn.Connect(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Can't connect to cluster %s: %s\", cluster, err)\n\t}\n\treturn &ceph{\n\t\tname: name,\n\t\tconn: conn,\n\t\tfree: make(chan *rados.IOContext, 50),\n\t}, nil\n}\n\nfunc init() {\n\tRegister(\"ceph\", newCeph)\n}\n","sourceCodeStart":342,"sourceCodeEnd":375,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/ceph.go#L342-L375","documentation":"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.","triggerScenarios":"conn.ReadDefaultConfigFile() errors because /etc/ceph/<cluster>.conf is missing, unreadable (permissions), or malformed for the current user/environment.","commonSituations":"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.","solutions":["Install/copy a valid ceph.conf to /etc/ceph/ (or the cluster-specific path)","Set the CEPH_CONF environment variable to point at the correct config file","Fix file permissions so the process user can read the config","Confirm the cluster name matches the config file name convention (<cluster>.conf)"],"exampleFix":"// before\n# no /etc/ceph/ceph.conf on host\n// after\ncp ceph.conf /etc/ceph/ceph.conf && chmod 644 /etc/ceph/ceph.conf\nexport CEPH_CONF=/etc/ceph/ceph.conf","handlingStrategy":"validation","validationCode":"// Shell: ensure config readable before start\nCONF=\"${CEPH_CONF:-/etc/ceph/ceph.conf}\"\n[ -r \"$CONF\" ] || { echo \"missing/unreadable $CONF\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// Go\nobj, err := object.NewCeph(endpoint, cluster, user, \"\")\nif err != nil && strings.Contains(err.Error(), \"Can't read default config file\") {\n    log.Fatalf(\"install ceph.conf or set CEPH_CONF: %v\", err)\n}","preventionTips":["Bake a valid ceph.conf into container images","Set CEPH_CONF explicitly in systemd units / docker env","Check config file permissions for the running user"],"tags":["object-storage","ceph","rados","configuration"],"backgroundTag":"config-file-not-found","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}