burmilla / os

Tiny Linux distro that runs the entire OS as Docker containers
https://burmillaos.org
Apache License 2.0
210 stars 13 forks source link

Allow DHCP client in network container to send (correct) hostname to DHCP server #173

Closed danielbodart closed 6 months ago

danielbodart commented 7 months ago

BurmillaOS Version: (ros os version) v2.0.0-rc2

Where are you running BurmillaOS? (docker-machine, AWS, GCE, baremetal, etc.) baremetal

Which processor architecture you are using? amd64

Do you use some extra hardware? (GPU, etc)? External USB hard drive (/dev/sda)

Which console you use (default, ubuntu, centos, etc..) default

Do you use some service(s) which are not enabled by default? No

Have you installed some extra tools to console? No

Do you use some other customizations? No

Please share copy of your cloud-init (remember remove all sensitive data first)

#cloud-config
ssh_authorized_keys:
  - REDACTED

write_files:
  - path: /etc/environment
    content: |
      TZ="Europe/London"
    append: true

hostname: new-server

mounts:
  - ["/dev/sda1", "/data", "ext4", ""]

So I can see maybe 2 issues with the system docker container image:

  1. In the /etc/dhcpcd.conf file inside the network container, hostname is commented out:
# Inform the DHCP server of our hostname for DDNS.
#hostname

So my first question is, what is the recommended way of changing a file like that? Also should that file be volume mounted to the host like other key files in the /etc

  1. Then the next puzzle is that the /etc/hostname file in the network container does not match the /etc/hostname on the host:
$ less /etc/hostname
new-server
$ sudo system-docker exec network less /etc/hostname
burmilla

So again my question is should this be volume mounted to the host?

My gut is that both files should be volume mounted by default so that in cloud-init it would be very easy to modify without having to call system-docker but I am no expert, you are!

danielbodart commented 6 months ago

So I managed to find a work around with cloud-init

write_files:
  - container: network
    path: /etc/dhcpcd.conf
    content: |
      hostname
    append: true

  - container: network
    path: /etc/hostname
    content: |
      some-name

hostname: some-name
olljanat commented 6 months ago

I think that generating dhcpd.conf config always, not only in Wi-Fi use like proposed in https://github.com/burmilla/os/issues/158#issuecomment-1692841749 probably is simplest solution and that most likely will solve old issue #52 too.

olljanat commented 6 months ago

Included to v2.0.0