dhcpcd-discuss

Re: interfaces are killed after boot

Roy Marples

Thu Nov 14 16:48:52 2019

On 14/11/2019 15:34, Daniel Huhardeaux wrote:
Try this instead

PATHtoFW=/etc/network/if-post-up.d

if $if_up; then
     case "$protocol" in
         dhcp|ipv4ll) "$PATHtoFW/sfw4" "$interface";;
         ra|dhcp6|static6) "$PATHtoFW/sfw6" "$interface";;
     esac
fi

My script is only launched for eth0 ipv4 and what is strange, not all the script is executed ! It's a sh script which start nftables rules. Inside they are echo "bla bla ..." for debugging. Could this be the problem ? I don't find those datas in syslog, even using logger "..."

dhcpcd-run-hooks provires a syslog function

syslog err "This is an error"

echo won't end up log

This is the logs from dhcpcd in syslog after the pi has booted (sorry for length):

Unsure what to say - looks like a normal log.
Nothing from the hooks will ever appear here unless from the syslog or logger commands. Even then, systemd might filter it out (i really have no idea, don't use it).

What would be a better idea when debugging scripts is to run it on the console so you *can* see some output. I generally use this command

dhcpcd -dB

Very verbose.
Like this, you can now enable shell debugging by putting this at the top of your exit.hook

set -x

And boom, running dhcpcd on the console will force your hook to log each line with variables expanded.


ip a show all addresses. Running manually my scripts after reboot is OK, rules are setted.

Are the scripts in /etc/network/if-[up|down].d or if-post-[up|down].d not used ?

dhcpcd doesn't run anything other than the script - defaults to dhcpcd-run-hooks.
I don't supply any hook that uses /etc/network

Roy

Follow-Ups:
Re: interfaces are killed after bootDaniel Huhardeaux
References:
interfaces are killed after bootDaniel Huhardeaux
Re: interfaces are killed after bootRoy Marples
Re: interfaces are killed after bootDaniel Huhardeaux
Archive administrator: postmaster@marples.name