双系统

 Thu, 26-Mar-2026 08:56:54

This article will talk about install double OS in  PC.

The system already be installed is Ubuntu-24.04,now we are going to install one more OS, windows 10.

insert udisk

lsblk

for example, /dev/sdc is udisk,

install ventoy to udisk by following steps 
sudo ./Ventoy2Disk.sh
sudo ./Ventoy2Disk.sh -I /dev/sdc

mount the udisk,


cp ../Win10_22H2_Chinese_Simplified_x64v1.iso /media/chenmin/Ventoy/
sync

U Disk for installing OS is ready.

sudo dd if=ubuntu-24.04.4-desktop-amd64.iso of=/dev/sdc bs=4M status=progress && sync

制作usb ubuntu,分出部分空间。

 

制作 Live USB后
从 Live USB 启动ubuntu

进入 parted 交互模式

启动 parted 并选择 /dev/sda 磁盘。

sudo parted /dev/sda

 

在 parted 提示符下,使用 resizepart 命令调整分区大小。

 
(parted) resizepart 2 1400GB

 

系统会提示输入分区的起始和结束位置。输入 1400GB 作为新的结束位置,起始位置会自动保留不变。

退出 parted‌
完成调整后,输入 quit 退出 parted。(parted) quit
刷新分区表‌
使用 partprobe 命令刷新内核中的分区表信息。


sudo partprobe /dev/sda


验证调整结果‌
使用 parted 或 fdisk 检查分区是否已成功调整。

 

硬盘gpt,但是BIOS仍然是把 Legacy/CSM ,目前改成UEFI,步骤如下:
1️⃣ 准备:创建 EFI 系统分区(ESP)
打开终端:
bash
运行
sudo gdisk /dev/sda
输入 n 新建分区:
分区号:默认(比如 4)
起始扇区:默认
结束扇区:+200M
类型代码:ef00(EFI 系统分区)
输入 w 保存,输入 Y 确认
格式化 ESP 分区(假设是 /dev/sda4):
bash
运行
sudo mkfs.fat -F32 /dev/sda4

2️⃣ 修复 Ubuntu UEFI 引导
用 Ubuntu Live U 盘(UEFI 模式) 启动(开机 F12,选带 UEFI 字样的 U 盘)
打开终端,依次执行:
bash
运行
# 1. 挂载 Ubuntu 根分区(/dev/sda2)
sudo mount /dev/sda2 /mnt

# 2. 挂载 ESP 分区(/dev/sda4,替换成你的实际 ESP 分区)
sudo mount /dev/sda4 /mnt/boot/efi

# 3. 绑定系统目录
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys

# 4. 进入 Ubuntu 系统环境
sudo chroot /mnt

# 5. 安装 grub-efi 并生成引导
apt update
如果出现dns问题,
在etc/resolv.conf添加
nameserver 223.5.5.5
nameserver 223.6.6.6
nameserver 8.8.8.8
apt install -y grub-efi-amd64
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu
update-grub

# 6. 退出并卸载
exit
sudo umount -R /mnt
3️⃣ BIOS 切换为 UEFI 模式
重启电脑,按 Del/F2/F10 进入 BIOS
找到 Boot Mode / Boot List:
把 Legacy/CSM 改成 UEFI Only
关闭 Secure Boot(Security → Secure Boot → Disabled)
保存并重启,此时电脑会用 UEFI 模式启动 Ubuntu
4️⃣ 用 UEFI 模式安装 Windows 10
用 Win10 安装 U 盘(UEFI 模式) 启动(开机 F12,选带 UEFI 字样的 U 盘)
到 “你想将 Windows 安装在哪里?” 界面:
选择你之前准备好的 466G NTFS 分区(分区 3)
直接点击「下一步」,不再报 GPT 错误 ✅
完成 Windows 安装,重启后会自动进入 GRUB 菜单(如果没出现,下一步修复)
5️⃣ 修复 GRUB 识别 Windows(可选)
如果重启后 GRUB 没显示 Windows 选项:
进入 Ubuntu
打开终端:
bash
运行
sudo update-grub
重启后,GRUB 菜单会出现 Ubuntu 和 Windows Boot Manager 选项

 

chenmin@chenmin-ThinkPad-T440:~$ sudo parted /dev/sda print
[sudo] password for chenmin: 
Model: ATA ST2000LM015-2E81 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  2097kB  1049kB                                     bios_grub
 2      2097kB  1500GB  1500GB  ext4
 3      1500GB  1500GB  210MB   fat32        EFI system partition  boot, esp

 

安装windows之后进不了BIOS

方法 1:Shift + 重启(最稳)

 
  1. 开始 → 电源
  2. 按住 Shift 不放 → 点 重启
  3. 保持 Shift 直到出现蓝色界面
  4. 选:疑难解答 → 高级选项 → UEFI 固件设置 → 重启
     
    → 直接进 BIOS
 

方法 2:命令行一键进 BIOS

 
  1. 以管理员打开 命令提示符 / Windows 终端
  2. 运行:
shutdown /r /fw /t 0

第二个方法亲测有效。

进入BIOS之后,将Windows Boot Manager启动优先级别降低。

 

如果启动看不到grub,修改

sudo vi /etc/default/grub

GRUB_TIMEOUT_STYLE=menu #hidden change to menu
GRUB_TIMEOUT=10
#GRUB_HIDDEN_TIMEOUT=0  #comment out this line

sudo update-grub

 

查看,grub启动项,

sudo cat /boot/grub/grub.cfg

如果没有windows,搜索
sudo os-prober

 

如果 os-prober 找不到 Windows,可以在这里手写菜单项
 
plaintext
 
 
 
 
 
/etc/grub.d/40_custom
 
 
示例(UEFI 模式):
 
plaintext
 
 
 
 
 
menuentry "Windows 10" {
    insmod part_gpt
    insmod fat
    insmod chain
    search --no-floppy --fs-uuid --set=root 你的EFI分区UUID
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
 
 
改完同样:
 
bash
 
运行
 
 
 
 

sudo update-grub

 

增加ubuntu拼音输入法

setting->system->Regios &Languages->manage installed languages->Install / remove languages

then

seting->keyboard->Input sources

安装kde

sudo apt install kde-plasma-desktop -y

启动顺序

sudo efibootmgr
[sudo] password for chenmin: 
BootCurrent: 0009
Timeout: 0 seconds
BootOrder: 000C,0000,0001,0002,0003,0008,0009,0007,000A,000D,000B,0013,0012
Boot0000  Setup    FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot0001  Boot Menu    FvFile(126a762d-5758-4fca-8531-201a7f57f850)
Boot0002  Diagnostic Splash Screen    FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380)
Boot0003  Lenovo Diagnostics    FvFile(3f7e615b-0d45-4f80-88dc-26b234958560)
Boot0004  Startup Interrupt Menu    FvFile(f46ee6f4-4785-43a3-923d-7f786c3c8479)
Boot0005  Rescue and Recovery    FvFile(665d3f60-ad3e-4cad-8e26-db46eee9f1b5)
Boot0006  MEBx Hot Key    FvFile(ac6fd56a-3d41-4efd-a1b9-870293811a28)
Boot0007* USB CD    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)
Boot0008* USB FDD    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
Boot0009* ATA HDD0    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f600)
Boot000A* ATA HDD1    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f601)
Boot000B* ATA HDD2    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f602)
Boot000C* USB HDD    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
Boot000D  PCI LAN    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot000E* IDER BOOT CDROM    PciRoot(0x0)/Pci(0x16,0x2)/Ata(0,1,0)
Boot000F* IDER BOOT Floppy    PciRoot(0x0)/Pci(0x16,0x2)/Ata(0,0,0)
Boot0010* ATA HDD    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f6)
Boot0011* ATAPI CD    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354)
Boot0012* PCI LAN    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot0013* Windows Boot Manager    HD(3,GPT,5a90a3a1-827d-4c90-84ba-6e5964234dd8,0xae9f8000,0x64000)/File(EFIMicrosoftBootootmgfw.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000061000100000010000000040000007fff0400

 

 

chenmin@chenmin-ThinkPad-T440:~$ sudo os-prober
/dev/sda3@/efi/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
chenmin@chenmin-ThinkPad-T440:~$ 

 

 sudo update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.17.0-19-generic
Found initrd image: /boot/initrd.img-6.17.0-19-generic
Found linux image: /boot/vmlinuz-6.14.0-37-generic
Found initrd image: /boot/initrd.img-6.14.0-37-generic
Found linux image: /boot/vmlinuz-6.11.0-29-generic
Found initrd image: /boot/initrd.img-6.11.0-29-generic
Found linux image: /boot/vmlinuz-6.8.0-52-generic
Found initrd image: /boot/initrd.img-6.8.0-52-generic
Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

 

由于/etc/default/grub没有GRUB_DISABLE_OS_PROBER=false,所以window没有被添加到grub menu

加上后

sudo update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.17.0-19-generic
Found initrd image: /boot/initrd.img-6.17.0-19-generic
Found linux image: /boot/vmlinuz-6.14.0-37-generic
Found initrd image: /boot/initrd.img-6.14.0-37-generic
Found linux image: /boot/vmlinuz-6.11.0-29-generic
Found initrd image: /boot/initrd.img-6.11.0-29-generic
Found linux image: /boot/vmlinuz-6.8.0-52-generic
Found initrd image: /boot/initrd.img-6.8.0-52-generic
Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi
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/sda3@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

注意CSM设为ON才会出现grub菜单。