我刚刚从 12.04 升级到 14.04,当我断开以太网电缆或暂停时,网络管理器会继续尝试连接 4-5 次,但都失败了,最后才成功。如果我重新启动,连接就正常了,但如果我再次断开连接,问题又会出现。
这是 dmesg 的输出:
[ 1234.523258] PM: Syncing filesystems ... done.
[ 1234.743865] PM: Preparing system for mem sleep
[ 1234.744109] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 1234.746257] Freezing remaining freezable tasks ... (elapsed 1.504 seconds) done.
[ 1236.250482] PM: Entering mem sleep
[ 1236.250514] Suspending console(s) (use no_console_suspend to debug)
[ 1236.251018] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 1236.251343] sd 0:0:0:0: [sda] Stopping disk
[ 1236.812155] PM: suspend of devices complete after 561.290 msecs
[ 1236.812530] PM: late suspend of devices complete after 0.371 msecs
[ 1236.828483] ehci-pci 0000:00:04.1: System wakeup enabled by ACPI
[ 1236.844052] ohci-pci 0000:00:04.0: System wakeup enabled by ACPI
[ 1236.860284] PM: noirq suspend of devices complete after 47.750 msecs
[ 1236.860415] ACPI: Preparing to enter system sleep state S3
[ 1236.861876] PM: Saving platform NVS memory
[ 1236.862162] Disabling non-boot CPUs ...
[ 1236.964057] smpboot: CPU 1 is now offline
[ 1236.964265] ACPI: Low-level resume complete
[ 1236.964265] PM: Restoring platform NVS memory
[ 1236.964265] Enabling non-boot CPUs ...
[ 1236.964265] x86: Booting SMP configuration:
[ 1236.964265] smpboot: Booting Node 0 Processor 1 APIC 0x1
[ 1236.863533] Initializing CPU#1
[ 1236.976181] CPU1 is up
[ 1236.977216] ACPI: Waking up from system sleep state S3
[ 1237.556134] ohci-pci 0000:00:04.0: System wakeup disabled by ACPI
[ 1237.572108] ehci-pci 0000:00:04.1: System wakeup disabled by ACPI
[ 1237.620274] PM: noirq resume of devices complete after 79.948 msecs
[ 1237.620451] PM: early resume of devices complete after 0.147 msecs
[ 1237.940033] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 1238.012503] ata2.00: configured for UDMA/100
[ 1239.452092] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 1239.456315] ata1.00: configured for UDMA/133
[ 1239.456825] sd 0:0:0:0: [sda] Starting disk
[ 1239.486112] PM: resume of devices complete after 1865.656 msecs
[ 1239.486478] PM: Finishing wakeup.
[ 1239.486481] Restarting tasks ... done.
[ 1239.503830] video LNXVIDEO:00: Restoring backlight state
[ 1239.691997] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[ 1239.692095] r8169 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[ 1239.692359] r8169 0000:03:00.0: irq 41 for MSI/MSI-X
[ 1239.735826] r8169 0000:03:00.0 eth0: RTL8168b/8111b at 0xf842a000, e0:cb:4e:2f:c4:f7, XID 18000000 IRQ 41
[ 1239.735831] r8169 0000:03:00.0 eth0: jumbo features [frames: 4080 bytes, tx checksumming: ko]
[ 1241.841344] r8169 0000:03:00.0 eth0: link down
[ 1241.841364] r8169 0000:03:00.0 eth0: link down
[ 1241.841639] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 1243.636825] r8169 0000:03:00.0 eth0: link up
[ 1243.636843] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 1244.281364] r8169 0000:03:00.0 eth0: link down
[ 1244.281395] r8169 0000:03:00.0 eth0: link down
[ 1244.281616] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 1244.561344] r8169 0000:03:00.0 eth0: link down
[ 1244.561442] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 1246.377956] r8169 0000:03:00.0 eth0: link up
[ 1246.377971] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 1251.433358] r8169 0000:03:00.0 eth0: link down
[ 1251.433411] r8169 0000:03:00.0 eth0: link down
[ 1251.433481] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 1253.072957] r8169 0000:03:00.0 eth0: link up
[ 1253.072974] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 3498.716445] r8169 0000:03:00.0 eth0: link down
[ 3501.273340] r8169 0000:03:00.0 eth0: link down
[ 3501.273452] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 3501.673354] r8169 0000:03:00.0 eth0: link down
[ 3501.673419] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 3503.203193] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 3523.370577] r8169 0000:03:00.0 eth0: link up
[ 3523.370595] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
答案1
我在 ubuntu 14.04 下遇到了类似的问题,Realtek 以太网卡从睡眠状态恢复后无法恢复,重新启动网络管理器帮我修复了它。
尝试一次:
$ sudo service network-manager restart
(重新加载
r8169
模块也有效)为了使其永久存在,请创建一个脚本
/etc/pm/sleep.d
并使其可执行:$ sudo cat > /etc/pm/sleep.d/90_restart_network_manager #!/bin/sh case "${1}" in resume|thaw) service network-manager restart;; esac $ sudo chmod 755 /etc/pm/sleep.d/90_restart_network_manager
作为参考,该卡是RTL8105e
:
$ dmesg | grep 'r8169.*RTL'
r8169 0000:01:00.0 eth0: RTL8105e at 0xf845c000, ...
答案2
从:http://www.techytalk.info/ubuntu-fix-network-stopped-working-after-resume-from-sleep/
我有一个 realtek r8169 NIC,ubuntu 14.04 不喜欢挂起/恢复过程。
sudo gedit /etc/pm/config.d/unload_modules
(如果不存在则创建)然后添加:
SUSPEND_MODULES="$SUSPEND_MODULES r8169"
重新启动机器。
从下次启动开始,当您暂停然后返回会话时,只需在右上角的下拉菜单中选择要从网络小程序中激活的连接。
干杯!
毫米
顺便提一句,串行通信说我有这个
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10)
在我的 Dell Inspiron 7559 (7000 系列) 上......
答案3
阿门,lemonsqueeze。我仅在 14.04 版的 /etc/pm/sleep.d 中创建了一个类似的可执行 Bourne shell 脚本。它在 Upstart 下运行良好。随后,我将这台机器升级到 16.04 (Systemd)。新局面:
- 创建可执行的 Bourne shell 脚本 /usr/local/bin/resume_r8169.sh:
MYNAME=`基本名称` echo $MYNAME 开始 modprobe-v-r r8169 modprobe-v r8169 回显 $MYNAME 结束
确保该脚本可执行(chmod -x)。
- 在目录 /etc/systemd/system 中,创建一个 resume_r8169.service 文件,如下所示:
[单元] 描述=解决 r8169 暂停后无法恢复服务的问题 之后=suspend.target [服务] 用户=root 类型=oneshot ExecStart=/bin/sh -c /usr/local/bin/resume_r8169.sh 超时时间=0 标准输出=系统日志 [安装] WantedBy=suspend.target
- 然后,通过执行以下命令将服务安装到 Systemd:
sudo systemctl 启用 /etc/systemd/system/resume_r8169.service