Hello Lemmy,

Im trying to troubleshoot a connection issue to my laptop which is connect using the buildin ethernet port. The connection drops sometimes for a few minutes and then im able to connect again.

This is the port being used:

k3s-alpine-lap-6:~# lspci -nn | grep -i ethernet
0000:01:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 16)

Some information about the drivers being used:

k3s-alpine-lap-6:~# ethtool -i eth0
driver: r8169
version: 6.12.76-0-lts
firmware-version: rtl8168h-2_0.0.2 02/26/15
expansion-rom-version:
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no

Some information i found using dmesg:

[   10.535868] Bridge firewalling registered
[   29.478495] usb 3-1: USB disconnect, device number 2
[   30.635978] atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).
[   30.635990] atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.
[   30.645244] atkbd serio0: Unknown key released (translated set 2, code 0xd8 on isa0060/serio0).
[   30.645256] atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.
[   55.836493] EXT4-fs (sda): mounted filesystem f9742482-7e09-4460-a10d-81c5f5abaf23 r/w with ordered data mode. Quota mode: none.
[  347.743005] Initializing XFRM netlink socket
[  354.759146] eth0: renamed from tmp5fca0
[  354.898482] eth0: renamed from tmp375a5
[  354.930148] eth0: renamed from tmpaf7f3
[  354.970131] eth0: renamed from tmpc035d
[  356.883835] eth0: renamed from tmp68492
[  518.679868] Key type trusted registered
[  518.745372] Key type encrypted registered
[  518.750554] device-mapper: uevent: version 1.0.3
[  518.750614] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: dm-devel@lists.linux.dev
[  599.682490] hrtimer: interrupt took 24965 ns
[  832.545952] r8169 0000:01:00.0 eth0: Link is Down
[  845.527825] r8169 0000:01:00.0 eth0: Link is Up - 100Mbps/Full - flow control off
[  846.467804] r8169 0000:01:00.0 eth0: Link is Down
[  848.089514] r8169 0000:01:00.0 eth0: Link is Up - 100Mbps/Full - flow control off
[ 2407.857541] r8169 0000:01:00.0 eth0: Link is Down
[ 2420.398450] r8169 0000:01:00.0 eth0: Link is Up - 100Mbps/Full - flow control off

Im not knowledgeable about this types of issues so im not even sure the driver is the issue.

Does someone have a simular experience or knows what could cause this issue i would love to hear it! Have a great day!

(Im sorry my post isn’t very specific about the issue but im not sure how i could better start troubleshooting this)

  • FauxLiving@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    8 hours ago

    This isn’t uncommon. There’s a few things you can try:

    https://www.baeldung.com/linux/realtek-ethernet-persistent-connection-issue

    The other thing that is unusual is that you said when you connected a known good device it connected at 1Gbps but in your dmesg output it is only connecting at 100Mbps. Is it being plugged directly into your router/could you power cycle that device to see if maybe it is responsible for the link drop (also the cable could have some insulation damage and is picking up intermittent EMI).

    • just_another_person@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      17 hours ago

      It could be related to power saving settings and/or your power profile.

      Some Q’s:

      1. Is your computer awake and in use when this happens?
      2. Are any of your USB devices disconnecting at the same time?
      3. I see your connection is 100Full and not 1Gb, is that because whatever it’s patched to is only 10/100?

      I saw you tried to set power for the interface itself, but if this is a power issue, you probably want to disable power savings on your PCIe interfaces. Easiest way to do this is probably installing powertop, and navigating over to the ‘tunables’ menu, and disabling power management for those interfaces, just to test and see if it fixes it.

      • Hercules@lemmy.worldOP
        link
        fedilink
        arrow-up
        1
        ·
        17 hours ago
        1. Im not 100% certain but I assume yes. Im trying to set it up as a nas. I just did setup-alpine, rebooted it and placed it in my basement. It should have services consistently running on it like sshd, k3s, … which become unavailable/available every few minutes.
        2. Except for a keyboard that i used for troubleshooting no usb devices are connected. Should i attach an usb to see if it gets unmounted?
        3. I notices this aswell which i quite strange since it is connected using a cat 5.e cable which should be able to do 1G. The cable is connected to a gigabit switch so that also shouldn’t be the problem. Asfar as cabling and switching is concerned everything should be able to do 1G

        If you need additional information let me know!

        • Hercules@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          ·
          17 hours ago

          As additional troubleshooting step i connected a know working device to the cable and was able to get 1GB

          • Hercules@lemmy.worldOP
            link
            fedilink
            arrow-up
            1
            ·
            17 hours ago

            Oh i just did ethtool -I eth0 and now it does show up as being able to do 1G.

            k3s-alpine-lap-6:~# ethtool -I eth0
            Settings for eth0:
            	Supported ports: [ TP	 MII ]
            	Supported link modes:   10baseT/Half 10baseT/Full
            	                        100baseT/Half 100baseT/Full
            	                        1000baseT/Full
            	Supported pause frame use: Symmetric Receive-only
            	Supports auto-negotiation: Yes
            	Supported FEC modes: Not reported
            	Advertised link modes:  10baseT/Half 10baseT/Full
            	                        100baseT/Half 100baseT/Full
            	                        1000baseT/Full
            	Advertised pause frame use: Symmetric Receive-only
            	Advertised auto-negotiation: Yes
            	Advertised FEC modes: Not reported
            	Link partner advertised link modes:  10baseT/Half 10baseT/Full
            	                                     100baseT/Half 100baseT/Full
            	                                     1000baseT/Full
            	Link partner advertised pause frame use: No
            	Link partner advertised auto-negotiation: Yes
            	Link partner advertised FEC modes: Not reported
            	Speed: 1000Mb/s
            	Duplex: Full
            	Auto-negotiation: on
            	master-slave cfg: preferred slave
            	master-slave status: slave
            	Port: Twisted Pair
            	PHYAD: 0
            	Transceiver: external
            	MDI-X: Unknown
            	Supports Wake-on: pumbg
            	Wake-on: d
            	Link detected: yes
            	Link Down Events: 2
            
            • just_another_person@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              16 hours ago

              I’m not sure your rationale for picking Alipine for this use-case, but you might want to consider a more fleshed out distro for a NAS. Alpine is the BARE MINIMUM of an OS, meaning a lot of helpers that exist on other distros are not there for things like setting your power settings and link negotiations in certain cases. Sure the NIC driver is there, but all the nice tweaks for that specific module that exist in, say, Fedora Server aren’t going to be there, leading to this issue.

              I’d honestly just throw FreeNAS, TrueNAS, or Unraid on this box and be done with it. They’ll have all the power settings and tweaks meant for a NAS in place, and then you won’t need to spend time hunting stuff like this down.

              • Hercules@lemmy.worldOP
                link
                fedilink
                arrow-up
                1
                ·
                16 hours ago

                Very valid point.

                Im actually running k3s on it so im not looking for any NAS specific OS. But if i picked a more general OS like fedora this issue might not have appeared. The reason i picked Alpine is since everything is running in containers i don’t need any fancy OS i just need to install k3s. But apperently Alpline can cause some issues :D

                • eldavi@lemmy.ml
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  15 hours ago

                  try running off a fedora usb stick long enough for this issue to have been triggered in alpine to confirm if this is the case without wiping out your installation.

                • just_another_person@lemmy.world
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  16 hours ago

                  Alpine is very specific in its use-case. Unless you know the exact package set you need to work with, it’s not suitable for general purpose use. It doesn’t even include glibc, for example 🤣 It’s meant to BARE as possible with a small footprint.

    • Hercules@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      18 hours ago

      Thanks for your reply! This is a path i wanna look into. Just to confirm that im understanding correct running /sbin/modprobe -i r8169 && sleep 1 && /usr/sbin/ethtool --set-eee eth0 eee off and then rebooting is what i should try right?

  • Hercules@lemmy.worldOP
    link
    fedilink
    arrow-up
    1
    ·
    18 hours ago

    Additional information im on Alpine 3.22.3. If this is an Alpine specific issue im able to switch distros but i prefer not to if it isn’t needed.