IF_* variables are not defined (for static IP) in post-up phase

Bug #1641108 reported by Per Olav Kroka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ifupdown (Ubuntu)
New
Undecided
Unassigned

Bug Description

SYMPTOM
My computer is set up with static IP on interface eno1 and running 'sudo apt update' fails. Adding nameserver aaa.bbb.ccc.ddd in resolv.conf helps, as a workaround, but this is reset on reboot. Another workaround is to create a secondary IP on the same interface using DHCP (it works), but I don't want that.

ANALYSIS
I have traced the problem to the IF_* variables not being set at "post-up" phase, where resolvconf tries to get the values. (see 000resolvconf file in /etc/network/if-up.d.)

To verify this I created a script named 0000dbg which I placed in all the if-*.d folders:
#---- Start
DBGDIR=/etc/test
mkdir -p $DBGDIR
DEBUGFILE=$DBGDIR/$PHASE

set | grep -E "^(IF_|(IFACE|LOGICAL|ADDRFAM|METHOD|MODE|PHASE|VERBOSITY|PATH)\b)" > $DEBUGFILE
#--- end

(For some reason the mkdir command did not work, so I created the directory manually.)

These where the resulting files (listed with tail -n20 ...):
==> /etc/test/post-down <==
ADDRFAM='meta'
IFACE='--all'
LOGICAL='auto'
METHOD='none'
MODE='stop'
PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
PHASE='post-down'
VERBOSITY='0'

==> /etc/test/post-up <==
ADDRFAM='meta'
IFACE='--all'
LOGICAL='auto'
METHOD='none'
MODE='start'
PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
PHASE='post-up'
VERBOSITY='0'

==> /etc/test/pre-down <==
ADDRFAM='inet'
IFACE='eno1'
IF_ADDRESS='192.168.0.3'
IF_BROADCAST='192.168.0.255'
IF_DNSNAMESERVERS='193.213.112.4
IF_GATEWAY='192.168.0.1'
IF_HOSTNAME='hopper'
IF_NETMASK='255.255.255.0'
LOGICAL='eno1'
METHOD='static'
MODE='stop'
PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
PHASE='pre-down'
VERBOSITY='0'

==> /etc/test/pre-up <==
ADDRFAM='inet'
IFACE='lo'
LOGICAL='lo'
METHOD='loopback'
MODE='start'
PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
PHASE='pre-up'
VERBOSITY='0'

As you can see the IF_* variables were created in the 'pre-down' phase but not in the 'post-up' as expected.

I would expect that some of the code in the ifdown program should have been in the ifup program.

VERSIONS
Distribution: Ubuntu 16.04 (LTS) (latest and greatest)
ifupdown 0.8.10ubuntu1.1 amd64

I also found this one <http://irclogs.thegrebs.com/debian/2014/02/03> (search for "IF_" )

description: updated
description: updated
description: updated
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.