Public bug reported: All our servers' hostnames start with a location identifier, which is mostly numeric e.g. 123, 124 or sometimes 12A. A full hostname might be 12a-proxy-01.mydomain.co.uk, for example.
We are switching to Ubuntu but have hit this bug in the 20.04 curtin installer, which prevents us setting the hostname during installation. (Tested on plain 20.04 and on 20.04.02) Our workaround has been to set a dummy hostname on installation, and then change it back once curtin has finished - but that gets messy especially as we are now looking into cloud-init and automation, where this won't work. The NAME_REGEX quoted by curtin is "[a-z_][a-z0-9_-]*" which correctly prevents hostnames starting with a hyphen.. but it also prevents otherwise perfectly valid hostnames that start with a number. (Interestingly, an underscore is not defined as a valid hostname character, but is included as valid in the regex above) I believe the correct NAME_REGEX would be "[a-z0-9_][a-z0-9_-]*" - i.e. adding 0-9 as valid characters at the start. (I've left the underscore character in, also) Thanks Jonathan Ref: https://man7.org/linux/man-pages/man7/hostname.7.html#:~:text=Valid%20characters%20for%20hostnames%20are,to%20an%20address%20for%20use. Each element of the hostname must be from 1 to 63 characters long and the entire hostname, including the dots, can be at most 253 characters long. Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, and the hyphen (-). A hostname may not start with a hyphen. ** Affects: curtin (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1916325 Title: Overly strict NAME_REGEX rejects valid hostnames To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/curtin/+bug/1916325/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
