turnkeylinux / tracker

TurnKey Linux Tracker
https://www.turnkeylinux.org
71 stars 16 forks source link

Turnkey Core LXC fail to obtain hostname in DHCP request #1992

Open fanyangto opened 1 month ago

fanyangto commented 1 month ago

I believe this issue has existed for a long time.

PVE 8.1, 8.2.4 DHCP server: fresh tomato's dnsmasq

When I create a container with the Turnkey Core LXC template, the LXC obtained the IP address via DHCP. But the DNS name is not set as the hostname configured in PVE. Instead, it's just the hostname derived from the MAC address. I used to workaround it by creating a IP reservation (MAC to IP and hostname mapping).

But recently I found the following:

  1. debian-12-turnkey-core: create a container with this template. Set the hostname in PVE. Start the container, login LXC, it obtained the IP address. But if you look at the dnsmasq hostname, it's not the hostname specified but the MAC address. You can modify the hostname of the container in PVE and then reboot. It has no effect. It's still the mac address is associated with the IP.
  2. debian-12-turnkey-wordpress_18.x has the same problem, as it's based on the same turnkey core LXC template.
  3. debian-12-standard_12.*, debian-11-standard_11.x do not suffer from this bug. You can see the dns name for the container obtained is the host name set in the PVE. You can also change the hostname in PVE, reboot the container and the new hostname will be associated with the IP address.

Based on the experiments of various container templates, I believe the issue is in the turnkey core LXC.

I currently work around this problem by doing the following: I added the following in crontab:


# sleep 30 to avoid race condition
@reboot sleep 30; /usr/sbin/udhcpc renew -x hostname:`cat /etc/hostname
JedMeister commented 3 days ago

Thanks for reporting this. Thanks too for the instructions to reproduce. Knowing that the default Debian build works as expected OOTB will almost certainly make it easier to isolate how we can improve the user experience. Thanks too for sharing your workarounds.

Ideally we'd love to address this sooner than later, but unfortunately we have a backlog a mile long and our resources are very stretched. So any "proper" fix - even if just PoC - would be warmly welcomed and ensure that this issue is resolved sooner rather than later.

Regardless, I've pinned this issue to our next major release. Fingers crossed we'll have time to look into this more closely by then, if not before.