mrdebug
Posts: 72
Joined: Sun Apr 07, 2013 6:08 pm

[Solved] if-up.d (Debian 8)

Sat Jan 09, 2016 5:02 pm

Raspberry (Debian 8) does not run my script stored in the folder
/etc/network/if-up.d
Is there a way to have my script working when the eth0 interface came up?
Last edited by mrdebug on Sun Jan 10, 2016 5:25 pm, edited 1 time in total.
www. ???
www. ???
GMT+1
Skype: mrdebug

User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: if-up.d (Debian 8)

Sat Jan 09, 2016 5:19 pm

Mine works.

Could you post your script?

Did you give it execution privilege?

mrdebug
Posts: 72
Joined: Sun Apr 07, 2013 6:08 pm

Re: if-up.d (Debian 8)

Sat Jan 09, 2016 6:11 pm

This is my script:
#!/bin/sh

echo "Upppppppppppppppppppppppppppppppppppppppppppppppppppp";

root@raspberrypi:/etc/network/if-up.d# cat ../if-down.d/ciao
#!/bin/bash

echo "Downnnnnnnnnnnnnnnnnnnnnnnnnnn";


echo "Time: $(date)" >> Debug.log

Executed by hand works.
www. ???
www. ???
GMT+1
Skype: mrdebug

User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: if-up.d (Debian 8)

Sat Jan 09, 2016 7:01 pm

Try this:

#!/bin/sh
if [ "$IFACE" != eth0 ]; then
exit 0
fi

/bin/echo "Upppppppppppppppppppppppppppppppppppppppppppppppppppp"
exit 0

mrdebug
Posts: 72
Joined: Sun Apr 07, 2013 6:08 pm

Re: if-up.d (Debian 8)

Sat Jan 09, 2016 7:38 pm

Sorry but nothing happens. Have you verified with a Debian 8 raspberry pi? My idea is that Raspberry does not call the script.
www. ???
www. ???
GMT+1
Skype: mrdebug

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: if-up.d (Debian 8)

Sat Jan 09, 2016 11:19 pm

That's because the changes made in raspberry-net-mods broke the network-manager stuff. Because every interface has to be defined as "manual", then if-pre-up.d ip-up.d if-post-down.d and if-down.d are useless.

You'll have to look at putting your stuff in /etc/dhcp/dhclient-enter-hooks.d /etc/dhcp/dhclient-exit-hooks.d as I think they still get run.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: if-up.d (Debian 8)

Sun Jan 10, 2016 5:12 am

mrdebug wrote:Sorry but nothing happens. Have you verified with a Debian 8 raspberry pi? My idea is that Raspberry does not call the script.
allfox@pi1 ~ $ cat /etc/debian_version
8.0

And in my /var/log/syslog during boot:
3689 Jan 10 12:59:02 pi1 ifup[627]: eth0 is Upppppppppppppppppppppppppppppppppppppppppppppppppppp
DougieLawson wrote:Because every interface has to be defined as "manual", then if-pre-up.d ip-up.d if-post-down.d and if-down.d are useless.
That's not true.

From "man interfaces":
The manual Method
This method may be used to define interfaces for which no configuration is done by default. Such interfaces can be
configured manually by means of up and down commands or /etc/network/if-*.d scripts.


The problem I'm facing here is that those scripts do not respond to cable plugging events.
So play with cable won't trigger them.
Booting the system or ifup+ifdown would work.

I have a trauma with ifplugd, so still struggling here to find another way out.

mrdebug
Posts: 72
Joined: Sun Apr 07, 2013 6:08 pm

Re: if-up.d (Debian 8)

Sun Jan 10, 2016 8:13 am

This problem does not exist in the official Debian release. I really want to take from a ear who has decided to set the Raspberry Pi network in this mode.
www. ???
www. ???
GMT+1
Skype: mrdebug

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: if-up.d (Debian 8)

Sun Jan 10, 2016 9:48 am

I'd like the folks who broke this stuff to have a meeting with my educational Louisville Slugger.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mrdebug
Posts: 72
Joined: Sun Apr 07, 2013 6:08 pm

Re: if-up.d (Debian 8)

Sun Jan 10, 2016 5:24 pm

The way to resolve.
- To have a normal dhcp activity please leave the original files.
- To have the static configuration please add at the /etc/dhcpcd.conf file the rows

interface eth0
static ip_address=192.168.1.75/24
static routers=192.168.1.254
static domain_name_servers=192.168.1.254

- To have a backup address please add at the /etc/network/interface the rows

allow-hotplug eth0:1
auto eth0:1
iface eth0:1 inet static
address 10.0.0.1
netmask 255.255.255.0

Only 1 problem: if you unplug and replug the cable, after replug the interface takes many minutes to go up.
A test with a wlan should be done but I haven't got one.
www. ???
www. ???
GMT+1
Skype: mrdebug

Return to “General discussion”