使用 autoinstall.yaml 安装 Ubuntu 后 Windows 11 无法启动

使用 autoinstall.yaml 安装 Ubuntu 后 Windows 11 无法启动

大家好,Stack Overflow 社区,我遇到了一个反复出现的问题,即使用自定义 autoinstall.yaml 文件安装 Ubuntu 后,Windows 11 无法启动。尽管我进行了仔细的配置以保留 Windows 分区,但每次执行安装时,问题仍然存在。

事情是这样的:Ubuntu 安装完成后,我尝试启动 Windows 11。系统并没有成功启动,而是无限期地挂起,Windows 加载循环。似乎启动过程启动了,但从未完成,这表明引导加载程序或 EFI 分区可能存在损坏或配置错误。

我检查了分区完整性和配置,一切似乎都正常,没有分区被意外删除或格式化。这是我用于 Ubuntu 安装的 autoinstall.yaml 文件的内容:

#cloud-config
autoinstall:
  version: 1
  locale: en_US
  storage:
    grub:
      reorder_uefi: False
    config:
      - type: disk                   # Always install OS on our largest SSD disk
        match:
          size: largest              # Select the largest available SSD
          ssd: true
        id: os-drive
        ptable: gpt
        preserve: true
        name: ''
        grub_device: false
      - type: partition              # Preserve an EFI partition /boot/efi
        number: 1
        id: efi-partition
        device: os-drive
        size: 100M
        flag: boot
        grub_device: true            # This is the primary boot device
        preserve: true
      - type: format                 # Format the EFI partition with FAT32
        id: efi-format
        volume: efi-partition
        fstype: fat32
        label: ESP
        preserve: true
      - path: /boot/efi              # Mount the EFI partition
        device: efi-format
        type: mount
        id: mount-efi
      - type: partition              # Preserve the existing Microsoft Reserved Partition
        number: 2                     # Partition number for MSR (assuming it's the second partition)
        id: msr-partition
        device: os-drive
        flag: msftres                # Flag to indicate it's a Microsoft Reserved Partition
        preserve: true
        size: 16M
      - type: partition              # NTFS
        number: 3
        id: part1
        device: os-drive
        size: 319325M
        grub_device: false
        preserve: true
      - type: partition              # Create a BOOT partition /boot
        number: 4
        id: boot-partition
        device: os-drive
        size: 1G
        grub_device: false
        preserve: false
      - type: format                 # Format the BOOT partition with ext4
        id: boot-format
        volume: boot-partition
        fstype: ext4
        label: BOOT
        preserve: false
      - path: /boot                  # Mount the BOOT partition
        device: boot-format
        type: mount
        id: mount-boot
      - type: partition              # Create an LVM partition (PV)
        number: 5
        id: lvm-partition
        device: os-drive
        size: -1                     # Use all remaining space for LVM
        grub_device: false
        preserve: false
      - type: dm_crypt
        preserve: false
        volume: lvm-partition
        id: dm_crypt-0
        key: "key"
        dm_name: crypto
      - type: lvm_volgroup
        preserve: false
        id: lvm_volgroup-0
        devices:
          - dm_crypt-0
        name: system
      - name: root                   # Create LVM Logical Volume (root)
        preserve: false
        volgroup: lvm_volgroup-0
        size: 16G
        wipe: superblock
        type: lvm_partition
        id: lvm_partition-root
      - fstype: xfs 
        preserve: false
        volume: lvm_partition-root
        type: format
        id: format-root
      - path: /                      # Mount the root LV
        device: format-root
        type: mount
        id: mount-root
      - name: home                   # Create LVM Logical Volume (home)
        volgroup: lvm_volgroup-0     # Using the same volume group as the root
        size: -1                     # Use all remaining space in the volume group
        wipe: superblock             # Ensure the volume is clean before use
        preserve: false
        type: lvm_partition
        id: lvm_partition-home
      - fstype: xfs
        volume: lvm_partition-home
        preserve: false
        type: format
        id: format-home
      - path: /home                  # Mount the home LV
        device: format-home
        type: mount
        id: mount-home
    swap:
      swap: 4G                        # Allocate 4 GB for swap space

  # Installs the default ubuntu-desktop packages.
  # You can add additional packages if required.
  packages:
    - ubuntu-desktop

  # Sets up SSH server and authorizes a key for remote access.
  ssh:
    install-server: true
    authorized-keys: 
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIXzBWhyNmrpXT9yN+RgAyS1mQ6tapm3G80Znp2Q9I6oAVNrKOB5BVazb7X3e7atNMXQgm6QQYsMZzoii+DSHgrmgHQ160vihtsvwmFFRxHb8fsmo0+9cH/lMoDhxWIk+Q9bLe+bqcGxAywD3EO1qgytUcmTOPjFIDyuU+cngb9TWvhJosZaZ0J8CwfzlJAYyItD0IP7fTqlUl079UU3lkU19DC3ocX+nx0q0glofnhCeSTll12H+BuPTMcPW9AKezkk8rgHlT0F8awGXmUfDj2tBFcCPrS1uyAJILU5iLKTc1oeELsIZFeUuSDNu2px+L8EKbhcnGWnbu3j5BSbHX [email protected]

  # User setup
  identity:
    username: nox
    password: $6$Jd6zyTUa/TGBXgtd$cOJ8pWsZxaKDU1SAo6qX32AMtH3WRIBTqIEbBvAmJGcQ7i.kmr5IkMUuuclWjpNVw9jmkUJfaLhe0j3m1TNeE/
    hostname: nox-home-laptop

  late-commands:
    # Configures GRUB for a quiet splash screen on boot.
    - curtin in-target -- sed -i /etc/default/grub -e 's/GRUB_CMDLINE_LINUX_DEFAULT=".*/GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"/'
    - curtin in-target -- update-grub
    

我想知道是否有其他人遇到过这个问题以及您是如何解决的。具体来说,我需要知道:

Any common mistakes in the configuration that might affect the Windows boot loader.
Tips for ensuring that the GRUB and Windows Boot Manager can coexist without issues.

非常感谢您的任何建议或指导!

此外,这里是 lsblk 的输出,显示了我系统上的当前分区布局:

ox@nox-home-laptop:~$ lsblk -f
NAME              FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
loop0             squashfs    4.0                                                         0   100% /snap/bare/5
loop1             squashfs    4.0                                                         0   100% /snap/core22/1380
loop2             squashfs    4.0                                                         0   100% /snap/firefox/4173
loop3             squashfs    4.0                                                         0   100% /snap/firmware-updater/127
loop4             squashfs    4.0                                                         0   100% /snap/gnome-42-2204/176
loop5             squashfs    4.0                                                         0   100% /snap/snap-store/1124
loop6             squashfs    4.0                                                         0   100% /snap/gtk-common-themes/1535
loop7             squashfs    4.0                                                         0   100% /snap/snapd/21465
loop8             squashfs    4.0                                                         0   100% /snap/snapd-desktop-integration/157
nvme0n1                                                                                            
├─nvme0n1p1       vfat        FAT32          2C42-63E8                                63.6M    34% /boot/efi
├─nvme0n1p2       ext4        1.0      BOOT  fc32e31d-d5f7-4274-b042-d5c43cb2ffa4                  
├─nvme0n1p3       ntfs                       E0822C78822C5576                                      
├─nvme0n1p4       ext4        1.0      BOOT  f45bcb02-c9a5-4702-ba9e-b78afe7a80b9    805.4M    10% /boot
└─nvme0n1p5       crypto_LUKS 2              0c1c84b3-3d41-49d2-b60f-ac06d0802ab6                  
  └─crypto        LVM2_member LVM2 001       QHzgdx-09hy-C1bz-QXwh-FJ5k-oHKX-u1zNxq                
    ├─system-root xfs                        9c32585f-fc83-44f3-88ab-bb61dd613006     10.2G    36% /var/snap/firefox/common/host-hunspell
    │                                                                                              /
    └─system-home xfs                        4f1b56b2-6b44-4592-8b00-3996f3d7abbc    612.5G     2% /home
nox@nox-home-laptop:~$ 

相关内容