自动安装 curtin 失败:删除以前的带有 RAID1 的存储设备

自动安装 curtin 失败:删除以前的带有 RAID1 的存储设备

我创建了一个具有自动安装功能的 ISO,该 ISO 必须是通用的。它应该可以在虚拟机、具有旧版 BIOS 的物理机、EFI BIOS 以及有或没有 RAID 的物理机上运行。

在我的里面autoinstall.yml,没有任何与存储相关的东西(因为我希望它对所有平台尽可能通用):

#cloud-config
autoinstall:
  version: 1
  identity:
    hostname: fooapp
    username: foouser
    password: "XXXXXXX"
  network:
    ethernets: {}
    version: 2
  source:
    id: ubuntu-server-minimal
  early-commands:
  - cat /cdrom/casper/install-sources.yaml | awk 'NR>1 && /^-/{exit};1' > /run/my-sources.yaml
  - mount -o ro,bind /run/my-sources.yaml /cdrom/casper/install-sources.yaml
  late-commands:
    - cp -r /cdrom/copy_to_iso/ /target/opt/
user-data:
    runcmd:
      - |
        echo -e "\033[32mDuring installation, please don't touch until the installation will be finished....\033[0m"
        mkdir -vp /opt/INIT/ >> /root/application_installation.log 2>&1
        mv -v /opt/copy_to_iso/upgrade_or_install_packages/ /opt/ >> /root/application_installation.log 2>&1
        mv -v /opt/copy_to_iso/foo_installation/* /opt/INIT/  >> /root/application_installation.log 2>&1
        mv -v /opt/copy_to_iso/application_scripts /opt/application_scripts >> /root/application_installation.log 2>&1
        rm -rvf /opt/copy_to_iso >> /root/application_installation.log 2>&1
        bash -x /opt/application_scripts/copy_system_files.sh >> /root/application_installation.log 2>&1
        bash -x /opt/application_scripts/setup_system_config.sh install_mode >> /root/application_installation.log 2>&1
        echo -e "\033[32mInstallation was completed...\033[0m"

ISO 在所有平台上均已成功安装,除了具有 RAID1 的 EFI bios(UEFI 选项 ROM 控制 > CPU 上的虚拟 RAID)。注意 - 没有 RAID,相同平台,它可以工作。

ISO 安装期间,出现cmd-install/stage-partitioning/builtin/cmd-block-meta/clear-holders以下错误:

        mdadm: stop failed, retrying in 0.2 seconds
        mdadm: stop on /dev/md127 attempt 58
        /sys/class/block/md127/md/sync_action/sync_max = 
        mdadm: setting array sync_action=idle
        mdadm: (non-fatal) write to /sys/class/block/md127/md/sync_action failed [Errno 13] Permission denied: '/sys/class/block/md127/md/sync_action'
        /sys/class/block/md127/md/sync_max/sync_max = 
        mdadm: setting array sync_{min,max}=0
        mdadm: (non-fatal) write to /sys/class/block/md127/md/sync_max failed [Errno 13] Permission denied: '/sys/class/block/md127/md/sync_max'
        Running command ['mdadm', '--manage', '--stop', '/dev/md127'] with allowed return codes [0] (capture=True)
        mdadm stop failed, retrying 
        /proc/mdstat:
        Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
        md126 : active raid1 nvme0n1[1] nvme1n1[0]
              3711654912 blocks super external:/md127/0 [2/2] [UU]
              [>....................]  resync =  0.0% (3059008/3711654912) finish=286.7min speed=215522K/sec
              
        md127 : inactive nvme1n1[1](S) nvme0n1[0](S)
              10402 blocks super external:imsm
               
        unused devices: <none>
        
        mdadm: stop failed, retrying in 0.2 seconds
        mdadm: stop on /dev/md127 attempt 59
        /sys/class/block/md127/md/sync_action/sync_max = 
        mdadm: setting array sync_action=idle
        mdadm: (non-fatal) write to /sys/class/block/md127/md/sync_action failed [Errno 13] Permission denied: '/sys/class/block/md127/md/sync_action'
        /sys/class/block/md127/md/sync_max/sync_max = 
        mdadm: setting array sync_{min,max}=0
        mdadm: (non-fatal) write to /sys/class/block/md127/md/sync_max failed [Errno 13] Permission denied: '/sys/class/block/md127/md/sync_max'
        Running command ['mdadm', '--manage', '--stop', '/dev/md127'] with allowed return codes [0] (capture=True)
        mdadm stop failed, retrying 
        /proc/mdstat:
        Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
        md126 : active raid1 nvme0n1[1] nvme1n1[0]
              3711654912 blocks super external:/md127/0 [2/2] [UU]
              [>....................]  resync =  0.0% (3059008/3711654912) finish=286.7min speed=215522K/sec
              
        md127 : inactive nvme1n1[1](S) nvme0n1[0](S)
              10402 blocks super external:imsm
               
        unused devices: <none>
        
        mdadm: stop failed, retrying in 0.2 seconds
        finish: cmd-install/stage-partitioning/builtin/cmd-block-meta/clear-holders: FAIL: removing previous storage devices
        TIMED BLOCK_META: 15.083
        finish: cmd-install/stage-partitioning/builtin/cmd-block-meta: FAIL: curtin command block-meta
        Traceback (most recent call last):
          File "/snap/subiquity/3698/lib/python3.8/site-packages/curtin/commands/main.py", line 202, in main
            ret = args.func(args)
          File "/snap/subiquity/3698/lib/python3.8/site-packages/curtin/log.py", line 97, in wrapper
            return log_time("TIMED %s: " % msg, func, *args, **kwargs)
          File "/snap/subiquity/3698/lib/python3.8/site-packages/curtin/log.py", line 79, in log_time
            return func(*args, **kwargs)
          File "/snap/subiquity/3698/lib/python3.8/site-packages/curtin/commands/block_meta.py", line 108, in block_meta
            meta_clear(devices, state.get('report_stack_prefix', ''))
          File "/snap/subiquity/3698/lib/python3.8/site-packages/curtin/commands/block_meta.py", line 1984, in meta_clear
            clear_holders.clear_holders(devices)
          File "/snap/subiquity/3698/lib/python3.8/site-packages/curtin/block/clear_holders.py", line 638, in clear_holders
            shutdown_function(dev_info['device'])
          File "/snap/subiquity/3698/lib/python3.8/site-packages/curtin/block/clear_holders.py", line 205, in shutdown_mdadm
            mdadm.mdadm_stop(blockdev)
          File "/snap/subiquity/3698/lib/python3.8/site-packages/curtin/block/mdadm.py", line 353, in mdadm_stop
            raise OSError('Failed to stop mdadm device %s', devpath)
        OSError: [Errno Failed to stop mdadm device %s] /dev/md127
        [Errno Failed to stop mdadm device %s] /dev/md127

你有什么建议吗?我尝试添加early-commands:以下内容 -

- mdadm --manage --stop /dev/md126
- mdadm --manage --stop /dev/md127

它没有帮助;同样的错误。

相关内容