/etc/machine-id changes with every reboot

Bug #1619721 reported by Oliver Grawert
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snappy
Fix Released
Critical
Unassigned
nplan (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

when trying to create working rpi image today i noticed that the IP changes with every reboot ... in the light that we now dropped the ubuntu user from the image and only allow ssh logins this is rather critical since you can not guess the IP anymore after a reboot and can not log in then ...

the MAC address of this device stays fixed at b8:27:eb:04:db:1c, the device name is always enxb827eb04db1c with pre-netplan images this device always got the same IP from my dhcp server.

Oliver Grawert (ogra)
description: updated
Changed in snappy:
importance: Undecided → Critical
Revision history for this message
Oliver Grawert (ogra) wrote :

http://paste.ubuntu.com/23124588/ has an excerpt of my DHCP server log

Revision history for this message
Oliver Grawert (ogra) wrote :

... and i only used console-conf to configure the booted image ...

Revision history for this message
Martin Pitt (pitti) wrote :

I cannot reproduce this; I'm using dnsmasq as a DNS server, not sure if that makes any difference -- but the networkd (via netplan) client sends the MAC and hostname, and dnsmasq always hands out the same IP for the same MAC/host name. Can you check the leases file of your DHCP server whether it actually stores MAC/hostname?

Changed in nplan (Ubuntu):
status: New → Incomplete
Revision history for this message
Oliver Grawert (ogra) wrote :

@pitti, well, it does so for all other devices relibaly ...

ogra@wall2:~$ ls -l /var/lib/dhcp/dhcpd.leases
-rw-r--r-- 1 root root 2076248 Sep 5 12:36 /var/lib/dhcp/dhcpd.leases

ogra@wall2:~$ grep DHC /var/log/syslog|tail -1
Sep 5 12:36:48 wall2 dhcpd: DHCPACK on 192.168.2.66 to 44:d9:e7:58:80:f9 (APOffice) via p4p1

i highly doubt it is in any way related to the server ...

Revision history for this message
Oliver Grawert (ogra) wrote :

http://paste.ubuntu.com/23136718/ has a grep for the MAC through the leases file ...

Revision history for this message
Oliver Grawert (ogra) wrote :

note that the device has not been rebooted since 2016/09/02 19:03:33 ... (line 2746 in above paste), it only gets a new IP on reboot

Revision history for this message
Martin Pitt (pitti) wrote :

networkd sends a DUID (https://tools.ietf.org/html/rfc3315#section-9) composed of a constant vendor ID and /etc/machine-id. Does /etc/machine-id change in between reboots for you for some reason?

FTR, we can also set "ClientIdentifier=mac" in the .network config.

Revision history for this message
Oliver Grawert (ogra) wrote :

ogra@localhost:~$ cat /etc/machine-id
79a9b831ef0c46e1afbb3bbd00816461
ogra@localhost:~$ sudo reboot
Connection to 192.168.2.47 closed by remote host.
Connection to 192.168.2.47 closed.
...

i see the IP changed to 192.168.2.23 in teh serial console output ...

ogra@localhost:~$ cat /etc/machine-id
144a0d35563d419fa404d833641b6f51
ogra@localhost:~$

... and so did the machine-id ...

Revision history for this message
Martin Pitt (pitti) wrote :

Ah, that explains it. IRC conversation suggests that /etc/machine-id is not part of the root file system but mounted from someplace else -- this must happen in the initramfs already, not during boot (that's too late).

summary: - IP changes with every reboot
+ /etc/machine-id changes with every reboot
Changed in nplan (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Oliver Grawert (ogra) wrote :

so i added the necessary fixes to the ubuntu-core image, but there is still something wrong even with a non-moving machine-id ...

i have verified the id stays the same from first boot on, but the IP still changes once on second boot, but then stays the same for all subsequent ones ...

sadly on first boot console-conf runs and tells you which IP to use so you can not find the device if you actually try to use this IP after a reboot.

Revision history for this message
Simon Fels (morphis) wrote :

@Oliver: What is console-conf using to retrieve a IP address over DHCP? If it is dhclient and in a subsequent boot networkd is used then we have different storage locations for the leases which would explain why the DHCP request is sent again and a new IP address assigned.

Oliver Grawert (ogra)
Changed in snappy:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.