我正在运行 Ubuntu Server 19.10,其中包含最新更新等。我的问题是,我使用的主板非常旧,没有 GBit LAN,所以我买了一个外部 GBit LAN“适配器”。不幸的是,它不起作用。
当我插入电源时,它会亮起大约 6 秒钟,然后灯会熄灭。当我这样做时lsusb
,它显示它仍插入电源并被识别。
ifconfig -a
如下所示:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether (*macadress*) txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.178.45 netmask 255.255.255.0 broadcast 192.168.178.255
inet6 fe80::225:22ff:fe5c:776a prefixlen 64 scopeid 0x20<link>
inet6 2003:c0:ff32:fe00:225:22ff:fe5c:776a prefixlen 64 scopeid 0x0<global>
ether (*macadress*) txqueuelen 1000 (Ethernet)
RX packets 1908 bytes 169364 (169.3 KB)
RX errors 0 dropped 894 overruns 0 frame 0
TX packets 700 bytes 72274 (72.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enx000ec65d0eff: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether (*macadress*) txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1260 bytes 89772 (89.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1260 bytes 89772 (89.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
其中“enx000ec65d0eff”是外部 GBit 适配器。顺便说一下,该适配器是“UGREEN USB 3.0 以太网适配器”。
我尝试重新安装内核、内核模块,甚至尝试自己构建该驱动程序,即使它已内置于内核(5.3.0-40),但它没有完成并退出并显示错误代码 2(已安装“build-essential”和“linux-headers-generic”):
make -C /lib/modules/5.3.0-40-generic/build SUBDIRS=/home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE modules
make[1]: Entering directory '/usr/src/linux-headers-5.3.0-40-generic'
Makefile:227: ================= WARNING ================
Makefile:228: 'SUBDIRS' will be removed after Linux 5.3
Makefile:229:
Makefile:230: If you are building an individual subdirectory
Makefile:231: in the kernel tree, you can do like this:
Makefile:232: $ make path/to/dir/you/want/to/build/
Makefile:233: (Do not forget the trailing slash)
Makefile:234:
Makefile:235: If you are building an external module,
Makefile:236: Please use 'M=' or 'KBUILD_EXTMOD' instead
Makefile:237: ==========================================
CC [M] /home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.o
/home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.c:816:3: error: ‘struct ethtool_ops’ has no member named ‘get_settings’; did you mean ‘get_strings’?
816 | .get_settings = ax88179_get_settings,
| ^~~~~~~~~~~~
| get_strings
/home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.c:816:19: error: initialization of ‘int (*)(struct net_device *, struct ethtool_eeprom *, u8 *)’ {aka ‘int (*)(struct net_device *, struct ethtool_eeprom *, unsigned char *)’} from incompatible pointer type ‘int (*)(struct net_device *, struct ethtool_cmd *)’ [-Werror=incompatible-pointer-types]
816 | .get_settings = ax88179_get_settings,
| ^~~~~~~~~~~~~~~~~~~~
/home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.c:816:19: note: (near initialization for ‘ax88179_ethtool_ops.set_eeprom’)
/home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.c:817:3: error: ‘struct ethtool_ops’ has no member named ‘set_settings’; did you mean ‘get_strings’?
817 | .set_settings = ax88179_set_settings,
| ^~~~~~~~~~~~
| get_strings
/home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.c:817:19: error: initialization of ‘int (*)(struct net_device *, struct ethtool_coalesce *)’ from incompatible pointer type ‘int (*)(struct net_device *, struct ethtool_cmd *)’ [-Werror=incompatible-pointer-types]
817 | .set_settings = ax88179_set_settings,
| ^~~~~~~~~~~~~~~~~~~~
/home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.c:817:19: note: (near initialization for ‘ax88179_ethtool_ops.get_coalesce’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:290: /home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.o] Error 1
make[1]: *** [Makefile:1655: _module_/home/julius/Downloads/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.3.0-40-generic'
make: *** [Makefile:30: default] Error 2
真正奇怪的是,我用 Ubuntu 桌面实时检查了适配器,并让它运行,没有采取进一步的措施。所以我认为这是驱动程序问题。切换到 Ubuntu 桌面对我来说不是一个选择,因为我只有 2GB RAM,Ubuntu Server 在空闲时使用约 400MB,而 Ubuntu 桌面使用超过 1.3GB。
cat /etc/netplan/*.yaml
结果
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp1s0:
dhcp4: true
version: 2