turnkeylinux / tracker

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

Confconsole put incorrect hostname entry in interfaces file #1997

Open OnGle opened 4 days ago

OnGle commented 4 days ago

There seems to be a bug still in the "hostname stuff". I installed the latest turnkey-core on Proxmox. There is only one ethernet interface, eth0. It looks like turnkey added hostname core to eth1, even though that doesn't exist on my container and it's probably rare to have another ethernet interface in a container.

Also, the hostname has been changed to test2, but the one in the interfaces file has not been changed. I suspect that is because I didn't change the hostname in confconsole, yet. This might be a bug in the interaction between Proxmox's container setup and what Turnkey is expecting. I will have to learn more about that.

root@test2 ~# cat /etc/network/interfaces
# UNCONFIGURED INTERFACES
# remove the above line if you edit this file

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet dhcp
 hostname core
root@test2 ~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: eth0@if44: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether bc:24:11:82:26:e3 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.1.1.170/24 brd 10.1.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::be24:11ff:fe82:26e3/64 scope link
       valid_lft forever preferred_lft forever
root@test2 ~# host core
Host core not found: 3(NXDOMAIN)
root@test2 ~# host test2
Host test2 not found: 3(NXDOMAIN)

(Let me know if I should create a new issue for this.)

Originally posted by @ebertland in https://github.com/turnkeylinux/tracker/issues/1711#issuecomment-2453100096

OnGle commented 4 days ago

I'm not entirely sure how/why the hostname got set where it did, a quick glance and these are the only files in confconsole that deal with the hostname:

https://github.com/turnkeylinux/confconsole/blob/master/plugins.d/System_Settings/hostname.py

and

https://github.com/turnkeylinux/confconsole/blob/master/ifutil.py

Although from a quick skim it doesn't seem like either of these could've caused it.

This is the initial overlayed interfaces file: https://github.com/turnkeylinux/common/blob/18.x/overlays/turnkey.d/interfaces/etc/network/interfaces

And this is the inithook that sets the hostname: https://github.com/turnkeylinux/common/blob/986c64c5bc0e229e6db92c6f189cc7c214beaf3e/conf/turnkey.d/hostname#L22

But neither of them seem suspect either.