任务描述(ubuntu 22.04):
1、禁止内核自动升级的方式(Linux 5.15.0-76-generic)
2、禁止驱动自动升级的方式(GeForce RTX 3060 525.125.06)
查看相关组件版本
- 查看ubuntu版本
cat /etc/os-release
lsb_release -a
hostnamectl
cat /etc/issue
- 查看内核版本
uname -a
cat /proc/version
hostnamectl
- 查看GPU显卡驱动版本
cat /proc/driver/nvidia/version
lspci |grep -i vga
nvidia-smi
APT命令标记并锁定内核版本
- 查看内核依赖包版本
dpkg -l |grep 5.15.0-76-generic
- 通过以下命令锁定内核版本,阻止自动升级
apt-mark hold linux-image-generic-5.15.0-76-generic linux-headers-generic-5.15.0-76-generic linux-modules-5.15.0-76-generic linux-modules-extra-5.15.0-76-generic
GRUB启动引导程序配置设置
- 查看当前启动项
cat /boot/grub/grub.cfg | grep Ubuntu |grep Linux
- 编辑配置文件(标红项):vim /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
#指定了默认启动的菜单条目
#GRUB_DEFAULT=0
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-76-generic"
#设置了引导菜单的显示方式
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
#显示的发行版信息
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#使得启动过程更加静默,并显示一个图形化的启动画面
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
#设置了传递给Linux内核的额外命令行参数
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#禁用恢复模式选项,使用户无法通过GRUB菜单进入恢复模式
GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
-
保存并关闭文件:
:wq
-
更新配置
sudo update-grub
APT命令标记并锁定显卡版本
- 查看GPU驱动的版本(nvidia)
cat /proc/driver/nvidia/version
- 查看GPU驱动
dpkg -l | grep -i nvidia-driver | grep 525.125.06
dpkg -l | grep -i nvidia-utils | grep 525.125.06
- 通过以下命令锁定现GPU驱动版本,阻止自动升级
apt-mark hold nvidia-driver-525-server nvidia-utils-525-server
- 重启系统测试
reboot