I'm having some ubuntu servers with an encrypted root partition, and usually they do ask for the password at boot time on the console. In order to start them remotely, I'm using dropbear in the initramfs to log into the initramfs process with ssh.
Problem:
It works, except for one detail. When the kernel + initramfs process requests a DHCP-address, it doesn't use the regular host name of the machine (which probably hasn't been set at that time of the boot process), but an empty name. Thus, the machine cannot be found by an ssh client to login.
It wouldn't be much of a problem if the boot process wouldn't use the hostname option at all, allowing the dhcp server to remember the last hostname connected to this MAC address and IP address, but using an empty hostname replaces the real hostname.
So the question is: How would one make initramfs use the correct hostname?
Unfortunately, documentation does not tell.
I found a hint at
https://realtechtalk.com/Howto_Set_Static_IP_on_boot_in_initramfs_for_dropbear_or_other_purposes_NFS_Linux_Debian_Ubuntu_CentOS-2278-articles
that setting something like
IP=192.168.1.27::192.168.1.1:255.255.255.0:myhost.com
in /etc/initramfs-tools/initramfs.conf would set this, but this is a static address, not a dhcp request. But /etc/initramfs-tools/initramfs.conf does not document such a parameter.
On the contrary, there are hints that this is a kernel parameter, usually used for nfs booting and described here:
https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
Redhat also has some description at
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-configuring_ip_networking_from_the_kernel_command_line
but that is about dracut, not initramfs.
So my question is:
What is the correct and ubuntu-approved way to have the initramfs use the correct hostname for it's dhcp request at the time dropbear runs?
regards