需求:给物理机器升级内存。系统centos7,内核3.10.xx(默认版本),需要升级到内核 5.xx.xx 版本。
上传内核rpm包文件和gcc文件
[root@localhost ~]# ls
kernel-lt-5.4.264-1.el7.elrepo.x86_64.rpm
kernel-lt-devel-5.4.264-1.el7.elrepo.x86_64.rpm
gcc-12.2.0.tar.gz openresty
下载地址
http://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz
内核包 这里没有连接了,官网访问404了
Index of /linux/kernel/el7/x86_64/RPMS
安装gcc-c++编译环境,要不然后面make gcc 12.2.0会报错
~]# yum -y install gcc-c++
~]# tar -zxf gcc-12.2.0.tar.gz
~]# yum -y install bzip2
~]# cd gcc-12.2.0
gcc-12.2.0]# ./contrib/download_prerequisites
查看网卡详细信息
lspci -v
这里网卡是 RTL8111/8168/8411 识别到了 r8169
Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 16)
Subsystem: Gigabyte Technology Co., Ltd Onboard Ethernet
Flags: bus master, fast devsel, latency 0, IRQ 19
I/O ports at e000 [size=256]
Memory at f7004000 (64-bit, non-prefetchable) [size=4K]
Memory at f7000000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [70] Express Endpoint, MSI 01
Capabilities: [b0] MSI-X: Enable+ Count=4 Masked-
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Capabilities: [160] Device Serial Number d4-bd-6b-99-2e-b4-00-00
Capabilities: [170] Latency Tolerance Reporting
Capabilities: [178] L1 PM Substates
Kernel driver in use: r8169
Kernel modules: r8169
从这里可以看出网卡的型号是RTL8111/8168/8411,但是centos7 3.10内核识别为8169,所以导致升级完内核后会丢失网卡,所以我们要下载网卡驱动,然后上传到centos7。
上传网卡驱动到上面
升级内核重启后,网卡无法显示,报错信息如下
28 localhost.localdomain systemd[1]: network.service failed.
[root@localhost ~]# cat 0821.log
-- Logs begin at Wed 2024-08-21 09:48:35 CST, end at Wed 2024-08-21 09:54:28 CST. --
Aug 21 09:48:37 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking...
Aug 21 09:48:38 localhost.localdomain network[915]: Bringing up loopback interface: [ OK ]
Aug 21 09:48:38 localhost.localdomain network[915]: Bringing up interface enp4s0: Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged).
Aug 21 09:48:38 localhost.localdomain network[915]: [FAILED]
Aug 21 09:48:38 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Aug 21 09:48:38 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
Aug 21 09:48:38 localhost.localdomain systemd[1]: Unit network.service entered failed state.
Aug 21 09:48:38 localhost.localdomain systemd[1]: network.service failed.
Aug 21 09:54:28 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking...
Aug 21 09:54:28 localhost.localdomain network[1661]: Bringing up loopback interface: [ OK ]
Aug 21 09:54:28 localhost.localdomain network[1661]: Bringing up interface enp4s0: Error: Connection activation failed: No suitable device found for this connection (device virbr0 not available because profile is not compatible with device (mismatching interface name)).
Aug 21 09:54:28 localhost.localdomain network[1661]: [FAILED]
Aug 21 09:54:28 localhost.localdomain network[1661]: RTNETLINK answers: File exists
Aug 21 09:54:28 localhost.localdomain network[1661]: RTNETLINK answers: File exists