Network settings not stored in a file?


I cloned my SD card [1] with OSMC on it to another SD card [2] for a second Rpi. When I used the second SD card I could not remotely connect to it. I couldn’t find it on the network. A few minutes later it was found and it had a different IP address. It got an IP address from my DHCP router.

I expected it would have the same IP address from the first SD card. Apparently the network settings are not stored in a file? Is this correct? Can I somehow save the network settings to a file?

Network is handled by connman, so no interface files… ether do it via connmanctl or via kodi ->my Osmc menu…

Ultimately the settings are stored in files - in /var/lib/connman, however you are not supposed to edit these directly, rather by using the dbus API, which means either using our Networking GUI, or using the command line tool connmanctl.

If you cloned the card it should have kept the same IP address, however it is possible that if it detected an IP address conflict with the original device it might have switched back to DHCP. (I don’t know if this would happen, but it may be a possibility)

I only had 1 Rpi connected, so no conflict could occur I think.
Thanks for explaining things.

Ah, I’ve just realised why you lost your network setting when cloning.

Connman stores all network settings per interface - and part of the interface name for an interface whether Ethernet or Wifi is the MAC address of the network adaptor. For example see the following on one of my installs:

osmc@vero:~$ ls -al /var/lib/connman/
total 32
drwxr-xr-x  4 root root 4096 Jul 29 16:17 .
drwxr-xr-x 24 root root 4096 Jun 17 20:48 ..
drwx------  2 root root 4096 Jul 29 16:18 ethernet_d063b4006a03_cable
-rw-------  1 root root  179 Jul 29 16:17 settings
drwx------  2 root root 4096 Jul 29 11:08 wifi_b85af7830635_535454657374_managed_psk

Because the Mac address of the Ethernet controller of the two Pi’s is not the same they don’t match and Connman considers this to be a different Ethernet interface with it’s own settings, which default to DHCP.

So the configuration for your old Ethernet interface will still be on the disk, but it won’t be getting used. If you check that directory you’ll see two ethernet directories.

Plus your router (DHCP server) might also allocate a different IP address because it sees a difference MAC address. Some try to keep an old IP address available to old MAC address long after the lease time expires.

Indeed, I have 2 folders with different mac address.
I tried to delete the old obsolete one but I can’t do this with ftp filezilla?

How to do this?

The file is owned by root so you would need to delete it from the command line with ‘sudo rm’. I wouldn’t bother though as it is completely harmless to leave it there.

I’m want to try. just for fun.
What’s the password for root.

You don’t need a password to use sudo - just type it as entered