I've finally found it.
I was at the point where I had two (different hardware) embedded
systems. Both with the *same* kernel and mounting the *same* root NFS
filesystem.  Even exchanging the IP-Addresses didn't change the
behaviour, the Orange-Pi issues a DHCPDECLINE, the other system works
fine.

The cause is that on the non-working system the root NFS was mounted
read-only. Note that I mount a (writeable) tmpfs on /var/lib/dhcp where
apparently dhclient puts its leases. So there is another undocumented
location that apparently needs to be writeable.

It would be *very* nice to document which directories dhclient needs to
be writeable and under what circumstances it issues a DHCPDECLINE.
Note that the DHCPDECLINE has an optional message where the client could
tell the server the reason for the decline. It's left empty, I've
checked with tcpdump.

For the record: The message "RTNETLINK answers: File exists" was a red
herring: It is always issued, also in the successful case.

I think we can close this issue unless you want to keep it open as a
reminder that the causes for DHCPDECLINE should be documented.

Oh and dhclient probably should not retry when it detects that something
is unwriteable and effectively perform a denial-of-service attack on the
dhcp server. Instead it should terminate with an error message that is
clearly visible (not just in a log that may not exist at that stage of
booting).

Working example:
root@sun7i:~# mount -oremount,rw 
10.23.5.5:/data/project/project/rootfs/A20-OLinuXino_MICRO

root@sun7i:~# ifup eth0
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/

Listening on LPF/eth0/02:42:b3:f0:2d:3e
Sending on   LPF/eth0/02:42:b3:f0:2d:3e
Sending on   Socket/fallback
Created duid "\000\001\000\001#\367\373\266\002B\263\360->".
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPOFFER of 10.23.5.173 from 10.23.5.254
DHCPREQUEST for 10.23.5.173 on eth0 to 255.255.255.255 port 67
DHCPACK of 10.23.5.173 from 10.23.5.254
RTNETLINK answers: File exists
bound to 10.23.5.173 -- renewal in 1396 seconds.
root@sun7i:~#

Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: off...@runtux.com

Reply via email to