• 28.开机默认启动系统-ubuntu和win10


    在win10下安装了Ubuntu20.04系统,默认情况下,启动的是Ubuntu系统

    要将默认启动系统设置成win10,方法如下:

    1、进入ubuntu系统,按住Ctrl+Alt+T键,打开终端。

    2、输入命令:

    sudo gedit /etc/default/grub 
    
    • 1

    将第6行GRUB_DEFAULT=0修改为想要默认启动的系统序号,设置完后保存;

    # 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_TIMEOUT_STYLE=hidden
    GRUB_TIMEOUT=10
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    GRUB_CMDLINE_LINUX=""
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    系统序号即为启动时电脑屏幕上显示的菜单顺序。
    Ubuntu默认为第一个,序号为0,win10系统一般在第3个,序号为2,所以设置GRUB_DEFAULT=2。

    # 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=2
    GRUB_TIMEOUT_STYLE=hidden
    GRUB_TIMEOUT=10
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    GRUB_CMDLINE_LINUX=""
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    3.输入 (sudo) update-grub 命令更新grub文件

    root@a512-3060:/home/lyq# update-grub
    Sourcing file `/etc/default/grub'
    Sourcing file `/etc/default/grub.d/init-select.cfg'
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-5.15.0-53-generic
    Found initrd image: /boot/initrd.img-5.15.0-53-generic
    Found linux image: /boot/vmlinuz-5.15.0-52-generic
    Found initrd image: /boot/initrd.img-5.15.0-52-generic
    Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
    Warning: os-prober will be executed to detect other bootable partitions.
    Its output will be used to detect bootable binaries on them and create new boot entries.
    Found Windows Boot Manager on /dev/nvme0n1p4@/efi/Microsoft/Boot/bootmgfw.efi
    Adding boot menu entry for UEFI Firmware Settings ...
    done
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    4、重启系统即可默认进入Windows系统。

    注意:
    修改的是 /etc/default/grub 这个路径下的文件,然后 update-grub ,从而去自动更新的 /boot/grub/grub.cfg 这个文件。
    不能直接去修改 /boot/grub/grub.cfg 。
    如果直接修改这里 /boot/grub/grub.cfg,系统会起不来。
    而且文件里说了,不能修改这个文件。告诉了正确的方法。
    在这里插入图片描述

  • 相关阅读:
    Flink 物理执行图
    NOA「破局」规模化
    java基于ssm+vue的水果果蔬购物商城
    2023-10-22 LeetCode每日一题(做菜顺序)
    Lua中文语言编程源码-第一节,更改llex.c词法分析器模块, 使Lua支持中文关键词。
    OpenCV之cv::undistort
    分布式id(1)
    一本通1053;最大数输出
    CleanMyMac X2024讲解及如何下载?
    具有容错功能的键值对存储服务
  • 原文地址:https://blog.csdn.net/u014217137/article/details/128064424