0

Background

I upgraded my Pi3B from Buster to Bullseye using these instructions.

WiFi is disabled on the Pi. Before the upgrade I had static IP setup and working fine by adding the following lines to the /etc/dhcpcd.conf:

# Custom static IP address for eth0
interface eth0
static ip_address=192.168.0.65/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

After upgrade to Bullseye the static IP address stopped working and a dynamic IP address 192.168.0.146 was assigned to the Pi. I found out that the Ethernet Interface name has changed from eth0 to enxb827ebaceb8a. So, I edited /etc/dhcpcd.conf to:

# Custom static IP address for enxb827ebaceb8a
interface enxb827ebaceb8a
...
...
...

Now I have two IP addresses assigned to the same interface enxb827ebaceb8a. The hostname -I give 192.168.0.65 and 192.168.0.146. ifconfig shows:

enxb827ebaceb8a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.65  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::10aa:7b63:4089:8d73  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:ac:eb:8a  txqueuelen 1000  (Ethernet)
        RX packets 74307  bytes 7398372 (7.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 72692  bytes 23849203 (22.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sudo dhclient -v shows:

Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

RTNETLINK answers: Operation not possible due to RF-kill
Listening on LPF/wlan0/b8:27:eb:f9:be:df
Sending on   LPF/wlan0/b8:27:eb:f9:be:df
Listening on LPF/enxb827ebaceb8a/b8:27:eb:ac:eb:8a
Sending on   LPF/enxb827ebaceb8a/b8:27:eb:ac:eb:8a
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
send_packet: Network is down
dhclient.c:2446: Failed to send 300 byte long packet over wlan0 interface.
DHCPREQUEST for 192.168.0.146 on enxb827ebaceb8a to 255.255.255.255 port 67
receive_packet failed on wlan0: Network is down
DHCPACK of 192.168.0.146 from 192.168.0.1
RTNETLINK answers: File exists
bound to 192.168.0.146 -- renewal in 2861 seconds.

Question

How do I permanently remove the dynamic IP address?

Clarification

This question is not about assigning a predictable or reserved IP address from the DHCP server (the router in my case). I want to set a static IP address outside the range for DHCP IP address assignments, 192.168.0.100 to 192.168.0.250 set in the router.

All my Ethernet connected devices have manually allocated static IP addresses in the range 192.168.0.2 to 192.168.0.99. This Pi has the static IP address 192.168.0.65. I don't want to change that. Neither do I want to change the router setting to include this IP address in the DHCP assignment range.

Thanks

6
  • dynamic IP address is obtained by the dhclient ... so, do not run dhclient
    – jsotola
    Nov 17 '21 at 20:23
  • The post you linked says "First off - we really do not recommend doing this, and we don't support it!" Neither do we.
    – Milliways
    Nov 17 '21 at 21:09
  • @Seamus I have a fresh install of Bullseye, but as usual I did this on another Pi. I agree it is not ready, there are numerous bugs and I am sticking to Buster for daily use.
    – Milliways
    Nov 17 '21 at 23:32
  • You mentioned using dhclient to remove your fixed IP address. I've not tried bullseye yet, but dhcpcd has been the default for a while now... IIRC, dhclient is installed, but not used in the default buster networking mix.
    – Seamus
    Nov 17 '21 at 23:36
  • @user68186: Yeah - I re-read your Q before that finally sank in on me! But two things: THING 1: dhcpcd writes other files in /etc in the course of doing what it does. dhclient does not un-write the files dhcpcd makes. THING 2 : man dhcpcd states: For IPv4, you should use the inform ipaddress option instead of setting a static address..
    – Seamus
    Nov 18 '21 at 0:14
2

Update: a better solution: uninstall connman

Based on the Q&A and comments in connman unable to connect to wifi: No carrier it looks like the installation of connman was an unintended consequence of upgrading the Pi OS from Buster to Bullseye. Thus, uninstalling connman seem to be the best solution.

Note: Uninstalling connman will result in the immediate loss of network connection to the Pi. Do not do this remotely. Login to the Pi locally and use the command:

sudo apt purge connman

Followed by the reboot:

sudo reboot

Alternately you may use the Add-Remove Software app to remove connman and reboot the Pi using the GUI method.

Original Answer:

Changing the file /etc/dhcpcd.conf is not enough

At least that's what it looks to me for the Desktop version. I got the idea for where to look from this guide.

Change the Connman Settings via the GUI

Go to Menu -> Preferences -> Connman Settings -> Wired

Click on the Gear icon

enter image description here

Go to the IPv4 tab on the left panel.

Change the Method from Automatic to Manual, and add the static IP address. Click Apply.

enter image description here

Finally Reboot the Pi.

After the reboot, the change seems to stick.

Command line equivalent text based solution

This solution is based on the changes made in the previous section.

Create a file called settings at the /var/lib/connman/ethernet_b827ebaceb8a_cable where the folder name ethernet_b827ebaceb8a_cable is based on the MAC address of the Ethernet port.

The content of the file is:

[ethernet_b827ebaceb8a_cable]
Name=Wired
AutoConnect=true
Modified=2021-11-18T14:13:46.329497Z
IPv4.method=manual
IPv6.method=off
IPv6.privacy=disabled
IPv4.netmask_prefixlen=24
IPv4.local_address=192.168.0.65
IPv4.gateway=192.168.0.1
Proxy.Method=direct
Nameservers=192.168.0.1;
IPv4.DHCP.LastAddress=192.168.0.146

It looks like these folder and file were created by the changes described in the previous section.

Hope this helps

11
  • I am intrigued how you got this. I did a fresh installation of Raspberry Pi OS-Bullseye (default - Desktop), which continues to use dhcpcd (although I had expected systemd-networkd). I have seen no other reports of Connman (except the link you included). Connman has been in the repository for years, but I have seen few references to its use.
    – Milliways
    Nov 18 '21 at 7:49
  • @Milliways I got it mainly by trial and errors. The linked article gave me the idea of where to look in the GUI. When I found the "Method" selector was set to "Automatic" when I had already changed the /etc/dhcpcd.conf, I knew I had to try changing it in the GUI. I still don't know how to make the same change in connmand via the terminal.
    – user68186
    Nov 18 '21 at 14:02
  • Some doubts are now being expressed about how connman came to be installed in bullseye. I've trawled through other sources & Rpi docs but have yet to find anything indicating that connman has displaced dhcpcd. AFAIK, connman & dhcpcd are incompatible. By that I mean they are likely to interfere with each other - perhaps in ways that are difficult to predict. If you're not interested in maintaining this answer (and that's fine as. many don't) feel free to disregard this comment. I mostly just wanted to give a 'heads-up'.
    – Seamus
    Nov 21 '21 at 20:48
  • @Seamus Thanks for the heads up. The Q&A you linked makes sense. I will uninstall connman today and if all goes well, update my answer tomorrow.
    – user68186
    Nov 22 '21 at 3:30
  • 1
    I think that's a better answer - I'd vote for it again if I could. :)
    – Seamus
    Nov 22 '21 at 17:04
1

I upgraded a Buster install to Bullseye (for pre-release testing of my software) and noted something similar.

There appear to be differences in the dpkg rules, but as it wasn't important to my testing I just installed a workaround.

No problems with a fresh installation of Bullseye.

NOTE using static addresses on a network with a DHCP server is a poor practice and leads to the problem you describe. If you want known addresses use request - See How to set up networking/WiFi

5
  • Thanks! The linked answer is very useful. I could setup my router to reserve a specific IP address within the DHCP range using the Pi's Ethernet MAC address. But that's not what I want.
    – user68186
    Nov 17 '21 at 23:04
  • @user68186: I hadn't seen your answer when I made my comment to Milliways, but yes, the guide you linked was where I'd seen the reference to connman. So - if I understand all of this correctly, the connman is part of the default buster distribution? I guess connmand is the command??
    – Seamus
    Nov 17 '21 at 23:22
  • @Milliways: "Not under your answer"?! Are you serious? I'm happy to follow the rules, but I've not seen one that applies to comments like this.
    – Seamus
    Nov 18 '21 at 0:21
  • @Seamus It is not a rule, but I don't need to be notified of a conversation which has NOTHING to do with the Answer. It is just annoying, and the other poster has his answer. There is a chat for discussions.
    – Milliways
    Nov 18 '21 at 2:09
  • Well that's just it - it does have something to do with the answer. I replied to a comment. IMHO, placing that reply somewhere else is confusing. I try not to practice confusion when I can avoid it. I'm sorry if that upsets you.
    – Seamus
    Nov 18 '21 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.