4

I am using devuan linux for my laptop after leaving debian back due to the first's better sequrity and its simplicity compared to debian.

I am really happy with it but I have the next problem:

When the OS starts, if my ethernet cable is not plunged in or even if there is a problem with my connection, it waits for about 20 seconds waiting while:

Configuring internet interfaces

... and after that it says:

ifup already configured. done

or something similar, even if it really configured the interfaces (that is really rare if the cable was not really attached from the beginning s supposed to be attached -I am possibly have a problem with the cable because it is too long or may be because the port has a problem-) even if the interface is not really configured and I will not be able to access internet.

What I want is: 1) A way to save the configuration and not need to wait for these 20 seconds for ifup to be reconfigured at every boot, but the ability to use

service networking restart

if my Internet is not really configure during the boot.

PS: 20 seconds are really many to wait at every boot and many times I just want to work offline without a cable plunged in.

/etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
# This is an autoconfigured IPv6 interface
iface eth0 inet6 auto
  • Please show us the relevant bits of eth0 in /etc/network/interfaces. Btw, I prefer Antix to Devuan, which is another alternative of using Debian without systemd – Rui F Ribeiro Feb 27 at 9:51
  • Thanks for th comment and the suggestion @RuiFRibeiro.... I added the file's contents, but I am not sure if this is what you meant. (poor English) – koleygr Feb 27 at 9:55
  • etho seems ok, are you able to show wlan0? I suspect also 20s is ok for a waiting time... – Rui F Ribeiro Feb 27 at 9:59
  • @RuiFRibeiro: I don't use wlan0... No wi-fi at all... So, I don't know where to find it and also, I prefer to configure myself after boot because in most cases I don't need internet... – koleygr Feb 27 at 10:03
  • A 20s wait seems fine to me. You might want to see what services you are using, Apache is now to hang a bit while without DNS, and in the past X also hanged for a bit if you did not had a local DNS cache. – Rui F Ribeiro Feb 27 at 10:18
4

Maybe the udev equivalent (eudev or mdev according to Devuan) isn't behaving 100% the same with regard to hotplug events. It's also possible if you're using a switch that the switch has a very long forwarding delay before actually letting traffic work both ways (in such case the 2nd solution below won't work).

Anyway, if you only want to have the interface unconfigured, this should be fairly easy. Here are two or three suggestions from easiest to more complex:

  1. exclude the interface from configuration

    1.1. just change default network settings in /etc/default/networking:

    either

    CONFIGURE_INTERFACES=no
    

    this is a bit extreme, as even lo won't be brought up, probably preventing even some non-networked applications to work properly (gdm...).

    1.2. or

    EXCLUDE_INTERFACES=eth0
    

    to exclude just the problematic interface.

    You can then later use ifup eth0 to bring it up.

  2. Or instead you can add a condition in the configuration to check if the link is available, and "fail" the interface if not. As I'm not sure if the dhcp hook is run before or after user-supplied up commands, I cheat and put it in pre-up which requires first bringing manually the interface up. You can check if using the up command is good enough without having to bring it up first.

    Edit the relevant /etc/network/interfaces part to look like this:

    allow-hotplug eth0
    iface eth0 inet dhcp
        pre-up ip link set eth0 up && sleep 1
        pre-up [ $(cat /sys/class/net/eth0/carrier) -eq 1 ]
    iface eth0 inet6 auto
        pre-up ip link set eth0 up && sleep 1
        pre-up [ $(cat /sys/class/net/eth0/carrier) -eq 1 ]
    

    (probably not needed for the ipv6 settings, this probably saves 1s. You could even remove the whole inet6 section if not interested)

    The return result of the test will make ifup consider the configuration failed and leave the logical (ifupdown's point of view) state of the card down.

You can then issue ifup eth0 or service networking restart later after having plugged the cable.

  • Thanks... I already upvoted, but will test your solution before accepting too. – koleygr Feb 27 at 11:50
  • Perfect! Really appreciate your help! Tested the second solution and works fine! Thanks again! – koleygr Feb 27 at 12:01
  • That pre-up is brilliant, upvoted it. Have you any similar trick for wifi? – Rui F Ribeiro Feb 27 at 15:35
  • @koleygr Glad it worked as intended Anyway I just don't know why you had a problem, because Devuan's doc appears to tell the interface should come up only when there is a link (even if it describe what to do before migrating from debian to devuan...) : devuan.org/os/documentation/dev1fanboy/network-configuration – A.B Feb 27 at 20:15
  • @RuiFRibeiro for wifi, detection via only ifupdown would be more difficult. It's a bit asynchronous since the candidates have to be scanned (scan started with wpa_cli scan for example), the end of scan event retrieved, and depending upon results association started. wicd-cli is perhaps easier to use in scripts than plain wpa_cli. – A.B Feb 27 at 20:25

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.