{"record":{"id":"38d4c2eac451e631","repo":"kubernetes/kops","slug":"unknown-distro-v","errorCode":null,"errorMessage":"unknown distro %v","messagePattern":"unknown distro (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/distributions/distributions.go","lineNumber":142,"sourceCode":"}\n\n// DefaultUsers returns the name of the system users for this distribution\nfunc (d *Distribution) DefaultUsers() ([]string, error) {\n\tswitch d.project {\n\tcase \"debian\":\n\t\treturn []string{\"admin\", \"root\"}, nil\n\tcase \"ubuntu\":\n\t\treturn []string{\"ubuntu\", \"root\"}, nil\n\tcase \"centos\":\n\t\treturn []string{\"centos\"}, nil\n\tcase \"rhel\", \"amazonlinux\":\n\t\treturn []string{\"ec2-user\"}, nil\n\tcase \"rocky\":\n\t\treturn []string{\"rocky\"}, nil\n\tcase \"flatcar\":\n\t\treturn []string{\"core\"}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown distro %v\", d)\n\t}\n}\n\n// HasLoopbackEtcResolvConf is true if systemd-resolved has put the loopback address 127.0.0.53 as a nameserver in /etc/resolv.conf\n// See https://github.com/coredns/coredns/blob/master/plugin/loop/README.md#troubleshooting-loops-in-kubernetes-clusters\nfunc (d *Distribution) HasLoopbackEtcResolvConf() bool {\n\tswitch d.project {\n\tcase \"ubuntu\", \"flatcar\":\n\t\treturn true\n\tdefault:\n\t\tif _, err := os.Stat(\"/run/systemd/resolve/resolv.conf\"); err == nil {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n}\n\n// Version returns the (project scoped) numeric version","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/distributions/distributions.go#L124-L160","documentation":"Distribution.DefaultUsers in util/pkg/distributions returns the default SSH/admin username for a known Linux distribution. The Distribution value it receives is not one of the recognized distros (debian, ubuntu, centos, rhel, amazon-linux, rocky, flatcar, etc.), so the method has no mapping and returns this error. It is a guard against unvalidated Distribution values reaching user-selection logic.","triggerScenarios":"Calling DefaultUsers() on a Distribution constructed from a string that FindDistribution never produced — e.g. &distributions.Distribution{\"Fedora\"}, an empty Distribution{}, or a hand-built value from cluster/config parsing that skipped the FindDistribution switch. The error prints the unknown value via %v.","commonSituations":"Parsing /etc/os-release yourself and feeding the raw ID into a Distribution without going through FindDistribution; a newly released distro (e.g. newer Fedora/Alma variant) whose image is used for nodes but is not in the supported list; typo'd distro names in custom tooling or tests; zero-value Distribution structs from failed earlier lookups.","solutions":["Use distributions.FindDistribution() to obtain the Distribution from /etc/os-release instead of constructing it manually","Pick a node image/AMI on a supported distro (debian, ubuntu, rocky, flatcar, amazon-linux, centos/rhel variants)","Add the missing distro case to DefaultUsers (and FindDistribution) if you genuinely need support for it","Print the value: the error includes the offending distribution string; verify spelling/casing against the constants in distributions.go"],"exampleFix":"// before\nd := distributions.Distribution(osRelease[\"ID\"])\nusers, err := d.DefaultUsers()\n// after\nd, err := distributions.FindDistribution(\"/\")\nif err != nil { return err }\nusers, err := d.DefaultUsers()","handlingStrategy":"validation","validationCode":"// validate the distro before asking for its users:\nknown := map[distributions.Distribution]bool{\n    distributions.DistributionDebian9: true, /* ... all supported constants ... */\n}\nd, err := distributions.FindDistribution(\"/\")\nif err != nil { return err }\nif !known[d] {\n    return fmt.Errorf(\"distro %s not supported for node images\", d)\n}\nusers, err := d.DefaultUsers()","typeGuard":"func isKnownDistro(d distributions.Distribution) bool {\n    for _, supported := range distributions.GetSupported() { // if exported, else hardcode list\n        if d == supported { return true }\n    }\n    return false\n}","tryCatchPattern":"users, err := d.DefaultUsers()\nif err != nil {\n    return fmt.Errorf(\"cannot determine default SSH user for %v: %w; use a supported distro image\", d, err)\n}","preventionTips":["Always obtain Distribution values from FindDistribution, never from raw strings or zero values","Use officially supported node images (ubuntu, debian, rocky, flatcar, amazon-linux)","When adding a new distro image, add the matching case to DefaultUsers and FindDistribution first","Log/inspect the %v value in the error — it names the exact unsupported distro string"],"tags":["linux-distributions","ssh","os-detection"],"backgroundTag":"unsupported-distro","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}