0

Every time Linux boots I have to manually use the two commands below in order to have an working internet connection.

ethtool -s eth0 autoneg off speed 100 duplex full

ifup eth0

If I run ethtool eth0 immediately after boot, it describes the problem as Link detected: no. https://paste.debian.net/hidden/d2b0d461/

The same Linux machine receives internet connection after reboot, with no other supplementary commands, if I only change the cable from this router, to my previous DSL router connection (another ISP, but even using the same ethernet cable to the Linux machine).

I am looking for a method so the internet connection will start automatically when Lubuntu boots up.

/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
#auto eth0
iface eth0 inet dhcp

ethtool -s eth0 autoneg off speed 100 duplex full
allow-hotplug eth0

#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

/etc/rc.local:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo 500 > /sys/class/backlight/intel_backlight/brightness
xrandr -s 960x540
rfkill block bluetooth
rfkill block wifi
ethtool -s eth0 autoneg off speed 100 duplex full
ip link set eth0 up
ifup eth0
dhcpcd eth0

exit 0

systemctl status rc-local: 
globalisation@WindowsXP:~$ systemctl status rc-local
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: 
  Drop-In: /lib/systemd/system/rc-local.service.d
           └─debian.conf
   Active: failed (Result: exit-code) since Sun 2017-06-04 00:31:28 CEST; 15min 
  Process: 636 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)

Jun 04 00:31:27 WindowsXP systemd[1]: Starting /etc/rc.local Compatibility...
Jun 04 00:31:28 WindowsXP rc.local[636]: Can't open display
Jun 04 00:31:28 WindowsXP systemd[1]: rc-local.service: Control process exited, 
Jun 04 00:31:28 WindowsXP systemd[1]: Failed to start /etc/rc.local Compatibilit
Jun 04 00:31:28 WindowsXP systemd[1]: rc-local.service: Unit entered failed stat
Jun 04 00:31:28 WindowsXP systemd[1]: rc-local.service: Failed with result 'exit

globalisation@WindowsXP:~$

When Lubuntu boots it appears these errors:

Failed to start LSB: IPV4 DHCP client with IPV4ALL support. See 'systemctl status dhcpcd.service' for details 16.780656 usb 1-1.4.3: device descriptor read/64, error -110

/etc/sysctl.conf:

#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#

#kernel.domainname = example.com

# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3

##############################################################3
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1


###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

If you have please any ideas how this could happen, I have just remembered that this in discussion same machine + same OS(Linux no changed configurations) + same Ethernet cable always "received and kept" the internet automatically (no extra manual commands) from all the 3 different models of routers.

All 3 connections and routers were from the same ISP, other than this forth problematic connection and router.

Best wishes.

  • 2
    in interfaces, the ethtool line is wrong. It needs to either start with pre-up, or just remove it. If you have allow-hotplug, I don't think the ethtool line will be helpful - because I think allow-hotplug waits for the link to be detected ("carrier detect"), and you tell us that the ethtool command is necessary otherwise the DHCP client times out waiting for a carrier. – sourcejedi Jun 4 '17 at 7:53
  • 1
    "When Lubuntu boots it appears these errors:" yay, no 5 minute delay :). Note, you should watch out for this coming back, in case the reason it doesn't happen is that ifup failed early when it saw the line in interfaces, which starts ethtool. – sourcejedi Jun 4 '17 at 8:08
  • 1
    cat /lib/systemd/system/rc-local.service.d/debian.conf Is this something you wrote? – user192526 Jun 4 '17 at 8:34
  • 1
    Thanks @sourcejedi Ideed, no more 5 minutes delay thanks to you To avoid the five minute delay while testing, you could start by commenting out the auto eth0 line (add a # at the start to disable it) unix.stackexchange.com/a/369003/198195 After boot if immediately the first command is ethtool eth0 the output is: paste.debian.net/hidden/d2b0d461 – XPDIN Jun 4 '17 at 13:54
  • 1
    @XPDIN it's definitely a problem involving the onboard NIC. It also involves the router. Whether it's the NIC's fault, or the router - or both are equally wrong - I really doubt we would get enough information to find out. If you have the opportunity not to use this problematic combination instead of working around it, then feel free to do so. In principle it could be an issue with the Linux device driver for r8169... but it sounds like this is recent linux on old hardware, if the driver is not fixed by 16.04 then it doesn't seem likely it will be in a newer version. – sourcejedi Jun 4 '17 at 19:01
2

This error message in rc.local is an xrandr error. xrandr does not work in rc.local. Then, because rc.local is being run with sh -e, it exits at the first error. Therefore, the ethtool line is never run.

0

It seems that the final result, in order to have internet access automatically after reboot/shutdown/sleep with no more manual commands:

/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
iface eth0 inet dhcp
    pre-up ethtool -s eth0 autoneg off speed 100 duplex full

allow-hotplug eth0

/etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo 70 > /sys/class/backlight/intel_backlight/brightness
rfkill block bluetooth
rfkill block wifi
ethtool -s eth0 autoneg off speed 100 duplex full
ip link set eth0 up

exit 0

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.