1.首先找到内核名称。

grep menuentry /boot/grub/grub.cfg

例如我的最后显示如下,复制所要的内核名称(例如我需要的Ubuntu,Linux 4.15.0-29-generic)。

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-3a45027c-15ed-4cec-a233-7c3927e74d11' {
submenu 'Ubuntu 高级选项' $menuentry_id_option 'gnulinux-advanced-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu,Linux 4.15.0-43-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-43-generic-advanced-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu, with Linux 4.15.0-43-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-43-generic-init-upstart-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu, with Linux 4.15.0-43-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-43-generic-recovery-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu,Linux 4.15.0-33-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-33-generic-advanced-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu, with Linux 4.15.0-33-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-33-generic-init-upstart-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu, with Linux 4.15.0-33-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-33-generic-recovery-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu,Linux 4.15.0-29-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-29-generic-advanced-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu, with Linux 4.15.0-29-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-29-generic-init-upstart-3a45027c-15ed-4cec-a233-7c3927e74d11' {
	menuentry 'Ubuntu, with Linux 4.15.0-29-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-29-generic-recovery-3a45027c-15ed-4cec-a233-7c3927e74d11' {
menuentry 'Memory test (memtest86+)' {
menuentry 'Memory test (memtest86+, serial console 115200)' {
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-246AF2746AF241DA' {

2.然后修改grub文件中的GRUB_DEFAULT="Ubuntu,Linux 4.15.0-29-generic".

sudo gedit /etc/default/grub

3.sudo update-grub,这时候会有WARNING提示修改GRUB_DEFAULT的名称,例如我的WARNING提示我将GRUB_DEFAULT修改为GRUB_DEFAULT="gnulinux-advanced-3a45027c-15ed-4cec-a233-7c3927e74d11>gnulinux-4.15.0-29-generic-advanced-3a45027c-15ed-4cec-a233-7c3927e74d11"。将该名字复制重新进行步骤二,然后再sudo update-grub。

sudo update-grub

4.重启。

sudo reboot

有些时候,会出现以下情况。

可能第一次重启仍需要进入Ubuntu高级选项选择系统内核,此时选择步骤2中选择的版本的内核,然后进入系统后输入sudo apt-get update,重复步骤4重启,即可切换系统默认启动内核。

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐