# Delay in connection to internet after boot

## hariskar

After boot it takes 30-45sec to be able to open a webpage in my browser. There was no problem some time ago. It started without any apparent reason to me. Any help? Here are my files:

/etc/conf.d/net

```
config_enp5s0="192.168.1.2 netmask 255.255.255.0 brd 192.168.1.255"

routes_enp5s0="default via 192.168.1.1"

dns_servers_enp5s0="192.168.1.1"
```

/etc/resolv.conf

```
# Generated by net-scripts for interface enp5s0

nameserver 192.168.1.1
```

~ $ emerge --info

```
Portage 2.3.66 (python 3.6.8-final-0, default/linux/amd64/17.0/desktop, gcc-8.3.0, glibc-2.29-r2, 5.1.0-gentoo x86_64)

=================================================================

System uname: Linux-5.1.0-gentoo-x86_64-Intel-R-_Core-TM-_i3-4330_CPU_@_3.50GHz-with-gentoo-2.6

KiB Mem:     8091160 total,   6313852 free

KiB Swap:    5857276 total,   5857276 free

Timestamp of repository gentoo: Tue, 14 May 2019 12:00:01 +0000

Head commit of repository gentoo: c6cb34a6adac70f695b09a169a5eeda43f0fc9ef

sh bash 5.0_p7

ld GNU ld (Gentoo 2.32 p2) 2.32.0

app-shells/bash:          5.0_p7::gentoo

dev-java/java-config:     2.2.0-r4::gentoo

dev-lang/perl:            5.28.2-r1::gentoo

dev-lang/python:          2.7.16::gentoo, 3.6.8::gentoo

dev-util/cmake:           3.14.3::gentoo

dev-util/pkgconfig:       0.29.2::gentoo

sys-apps/baselayout:      2.6-r1::gentoo

sys-apps/openrc:          0.41.2::gentoo

sys-apps/sandbox:         2.17::gentoo

sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo

sys-devel/automake:       1.16.1-r1::gentoo

sys-devel/binutils:       2.32-r1::gentoo

sys-devel/gcc:            8.3.0-r1::gentoo, 9.1.0::gentoo

sys-devel/gcc-config:     2.0::gentoo

sys-devel/libtool:        2.4.6-r5::gentoo

sys-devel/make:           4.2.1-r4::gentoo

sys-kernel/linux-headers: 5.0-r1::gentoo (virtual/os-headers)

sys-libs/glibc:           2.29-r2::gentoo

Repositories:

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

    sync-rsync-verify-jobs: 1

    sync-rsync-verify-max-age: 24

    sync-rsync-extra-opts: 

    sync-rsync-verify-metamanifest: yes

localrepo

    location: /usr/local/portage

    masters: gentoo

crossdev

    location: /usr/local/portage-crossdev

    masters: gentoo

    priority: 10

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=haswell -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=haswell -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://ftp.ntua.gr/pub/linux/gentoo/ ftp://ftp.ntua.gr/pub/linux/gentoo/"

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j4"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"

PORTAGE_TMPDIR="/var/tmp"

USE="X a52 aac acl acpi alsa amd64 berkdb branding bzip2 cairo cdda cdr cli consolekit crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam flac fortran gdbm gif glamor gpm gtk iconv jpeg lcms ldap libnotify libtirpc mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds readline sdl seccomp spell ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
```

----------

## krinn

I see 3 possibles reasons to that:

* dns issue

you can just "ping -c1 google.com", it should answer fast, and http://ip_from_the_ping_test in the browser to check out

* firmware issue

you can look in dmesg about firmware error related to your network card

* bad mtu settings

you can see the card mtu with ifconfig, should be 1500

for the router mtu, its wan should propably be 1492 (classic for ppoe), and its lan interface 1500

if your issue happen once, it's certainly firmware issue

----------

## hariskar

It happens every time gentoo boots. Some time ago I didn't have this problem.

I removed 

```
brd 192.168.1.255
```

 from /etc/conf.d/net  and will check if there is any difference.

I will also check your suggestions.

Thank you!

----------

## krinn

if it happen every time you boot, but once (you have the delay the first time you boot, but after, all is ok ; in real it should happen each time you load the module for the network card, but as many users do that only once per boot...), really, check firmware trouble.

----------

## hariskar

Yes, that is the case, once in every boot and then OK. I will check the firmware, thank you!

----------

## hariskar

The last days I have also a delay in opening the graphical environment. I see in end of booting, user logs in and it stops there. With cntr+c graphical environment is visible.

In dmesg at the end I see:

```
r8169 0000:05:00.0 enp5s0: Link is Down
```

Is that the cause of delay? What can I do?

----------

## krinn

 *hariskar wrote:*   

> The last days I have also a delay in opening the graphical environment. I see in end of booting, user logs in and it stops there. With cntr+c graphical environment is visible.
> 
> In dmesg at the end I see:
> 
> ```
> ...

 

It's certainly that, many UI use DNS resolution and internet for, well, whatever bloat they like.

The 2nd question will be harder to answer  :Smile: 

as a start, you could check the cable is fine (if you have another to try)

----------

## hariskar

I don;t think it is the cable, after these small delays at boot, I have a normal internet connection.

Thank you!

----------

## mike155

 *Quote:*   

> What can I do?

 

To which switch is your machine connected? If your machine is connected to a datacenter or enterprise switch., link auto-negociation and STP loop detection can take up to 30 seconds.Last edited by mike155 on Wed May 29, 2019 1:38 am; edited 1 time in total

----------

## hariskar

My PC is directly connected to the router.

----------

## hariskar

Here is that part of dmesg:

```
[    4.797471] r8169 0000:05:00.0 enp5s0: Link is Down

[    5.137632] xauth[2864]: segfault at 1 ip 00007f5c07182dfe sp 00007ffef3157c78 error 4 in libc-2.29.so[7f5c07039000+159000]

[    5.137636] Code: fd d7 c9 0f bc d1 c5 fe 7f 27 c5 fe 7f 6f 20 c5 fe 7f 77 40 c5 fe 7f 7f 60 49 83 c0 1f 49 29 d0 48 8d 7c 17 61 e9 c2 04 00 00 <c5> fe 6f 1e c5 fe 6f 56 20 c5 fd

74 cb c5 fd d7 d1 49 83 f8 21 0f

[   10.220542] r8169 0000:05:00.0 enp5s0: Link is Up - 100Mbps/Full - flow control off
```

----------

## alamahant

Which kernel are you using...

This r8169 driver for the Realtek nics SUCKS..

It behaves erratically and you have to pray for it to work...

You are using ethernet.

Do you have the same problem with wifi also?

I had exactly the same problem in many distros with this disgusting driver.

SOLUTION:

Buy one of these usb eternet adaptors(pick a good one)and you will never have a problem again..

They use a different driver:r8152 usbnet or something....

 :Very Happy: 

----------

