问题场景为,使用平台镜像安装的系统内核版本为Linux 4.15.0-1052-azure,但是客户环境需要Linux 4.15.0-1045-azure.
1,请尝试以下操作(务必在操作前对虚拟机做备份或对磁盘做快照)安装Ubuntu 4.15.0-1045-azure内核:
#apt-get install -y linux-azure*-4.15.0-1045 #apt-get install -y linux-image-4.15.0-1045-azure #apt-get install -y linux-tools-4.15.0-1045-azure
2,然后使用命令查看,观察输出中是否有1045内核版本文件输出,如下方: root@leoubuntu1604b:~# grep menuentry /boot/grub/grub.cfg if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" menuentry_id_option="" export menuentry_id_option menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8716e09d-0f3d-47c5-a89a-666b9d0bd1bf' { submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-8716e09d-0f3d-47c5-a89a-666b9d0bd1bf' { menuentry 'Ubuntu, with Linux 4.15.0-1052-azure' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-1052-azure-advanced-8716e09d-0f3d-47c5-a89a-666b9d0bd1bf' { menuentry 'Ubuntu, with Linux 4.15.0-1052-azure (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-1052-azure-recovery-8716e09d-0f3d-47c5-a89a-666b9d0bd1bf' { menuentry 'Ubuntu, with Linux 4.15.0-1045-azure' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-1045-azure-advanced-8716e09d-0f3d-47c5-a89a-666b9d0bd1bf' { menuentry 'Ubuntu, with Linux 4.15.0-1045-azure (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-1045-azure-recovery-8716e09d-0f3d-47c5-a89a-666b9d0bd1bf' {
3,确认2中输出无误后,修改/etc/default/grub文件中的“GRUB_DEFAULT”项为如下内容: GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.15.0-1045-azure"
4,执行“update-grub”命令后,重启操作系统,观察虚拟机版本是否有更改。