Ubuntu 20.04.3 和自动安装无法启动

Ubuntu 20.04.3 和自动安装无法启动

我的自动安装功能可以正常工作。但是 - 我尝试在非 EFI 机器(本例中为 VM)上执行此操作,但无法正常工作 - 我只看到语言选择屏幕。

我的引导行是:

root=/dev/ram0 ramdisk_size=1500000 nouveau.modeset=0 fsck.mode=skip autoinstall ‘ds=nocloud-net;s=http://MyIP/autoinstall/’ ip=dhcp url=http://MyIp/autoinstall/ubuntu-20.04.3-live-server-amd64.iso cloud-config-url=http://MyIp/autoinstall/meta-data — splash nouveau.modeset=0

元数据文件为空。用户数据文件为:

#cloud-config
autoinstall:
version: 1
early-commands:
- systemctl stop ssh # otherwise packer tries to connect and exceed max attempts
network:
network:
version: 2
ethernets:
eth0:
dhcp4: yes
dhcp-identifier: mac
edns0:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
eno1:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
eno2:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
eno3:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
ens1:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
ens2:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
ens3:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
ens33:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
enp1s0:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
enp2s0:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
enp3s0:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
enp4s11:
dhcp4: yes
dhcp6: no
dhcp-identifier: mac
apt:
preserve_sources_list: false
primary:
- arches: [amd64]
uri: “http://archive.ubuntu.com/ubuntu/”
ssh:
install-server: yes
allow-pw: no
identity:
hostname: VMImage
username: silentm
password: $1$xyz$V5reF9l3SpYlSCJ7ebtij0
locale: en_US
packages:
- build-essential
- gdb
- nfs-common
- network-manager
- net-tools
user-data:
timezone: America/New_York
disable_root: false

refresh-installer:
update: yes

此存储取自手动安装,在将 CentOS7 转换为 NON-EFI 的 Ubuntu 20.04 时可以正确启动。

storage:
config:
- {ptable: msdos, wipe: superblock-recursive, preserve: false, name: ‘’, grub_device: true, type: disk, id: disk-0, match: {size: largest}}
- {device: disk-0, size: -1, wipe: superblock, flag: ‘’, number: 1, preserve: false, grub_device: false, type: partition, id: partition-1}
- {fstype: ext4, volume: partition-1, preserve: false, type: format, id: format-1}
- {device: format-1, path: /, type: mount, id: mount-1}
version: 1
late-commands:

cloud-init.log(或其部分)是:

2021-07-30 18:02:41,403 - util.py[DEBUG]: Cloud-init v. 20.4.1-0ubuntu1~20.04.1 running ‘init-local’ at Fri, 30 Jul 2021 18:02:41 +0000. Up 25.53 seconds.
2021-07-30 18:02:41,403 - main.py[DEBUG]: retrieving url ‘http://MyIP/autoinstall/meta-data’ failed: HTTPConnectionPool(host=‘MyIP’, port=80): Max retries exceeded with url: /autoinstall/meta-data (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x7fef44fa6790>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution’))
2021-07-30 18:02:41,403 - main.py[DEBUG]: Closing stdin.
2021-07-30 18:02:41,405 - util.py[DEBUG]: Writing to /var/log/cloud-init.log - ab: [644] 0 bytes
2021-07-30 18:02:41,405 - util.py[DEBUG]: Changing the ownership of /var/log/cloud-init.log to 104:4
2021-07-30 18:02:41,405 - util.py[DEBUG]: Attempting to remove /var/lib/cloud/instance/boot-finished
2021-07-30 18:02:41,405 - util.py[DEBUG]: Attempting to remove /var/lib/cloud/data/no-net
2021-07-30 18:02:41,405 - handlers.py[DEBUG]: start: init-local/check-cache: attempting to read from cache [check]
2021-07-30 18:02:41,405 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2021-07-30 18:02:41,405 - stages.py[DEBUG]: no cache found
2021-07-30 18:02:41,406 - handlers.py[DEBUG]: finish: init-local/check-cache: SUCCESS: no cache found
2021-07-30 18:02:41,406 - util.py[DEBUG]: Attempting to remove /var/lib/cloud/instance
2021-07-30 18:02:41,410 - stages.py[DEBUG]: Using distro class <class ‘cloudinit.distros.ubuntu.Distro’>
2021-07-30 18:02:41,410 - init.py[DEBUG]: Looking for data source in: [‘NoCloud’, ‘None’], via packages [’’, ‘cloudinit.sources’] that matches dependencies [‘FILESYSTEM’]
2021-07-30 18:02:41,414 - init.py[DEBUG]: Searching for local data source in: [‘DataSourceNoCloud’]
2021-07-30 18:02:41,414 - handlers.py[DEBUG]: start: init-local/search-NoCloud: searching for local data from DataSourceNoCloud
2021-07-30 18:02:41,414 - init.py[DEBUG]: Seeing if we can get any data from <class ‘cloudinit.sources.DataSourceNoCloud.DataSourceNoCloud’>
2021-07-30 18:02:41,414 - init.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2021-07-30 18:02:41,414 - dmi.py[DEBUG]: querying dmi data /sys/class/dmi/id/product_serial
2021-07-30 18:02:41,414 - util.py[DEBUG]: Reading from /var/lib/cloud/seed/nocloud/user-data (quiet=False)
2021-07-30 18:02:41,414 - util.py[DEBUG]: Read 0 bytes from /var/lib/cloud/seed/nocloud/user-data
2021-07-30 18:02:41,414 - util.py[DEBUG]: Reading from /var/lib/cloud/seed/nocloud/meta-data (quiet=False)
2021-07-30 18:02:41,414 - util.py[DEBUG]: Read 0 bytes from /var/lib/cloud/seed/nocloud/meta-data
2021-07-30 18:02:41,414 - util.py[DEBUG]: Reading from /var/lib/cloud/seed/nocloud/vendor-data (quiet=False)
2021-07-30 18:02:41,414 - util.py[DEBUG]: Reading from /var/lib/cloud/seed/nocloud/network-config (quiet=False)
2021-07-30 18:02:41,415 - DataSourceNoCloud.py[DEBUG]: Using seeded data from /var/lib/cloud/seed/nocloud
2021-07-30 18:02:41,415 - util.py[DEBUG]: Attempting to load yaml from string of length 0 with allowed root types (<class ‘dict’>,)
2021-07-30 18:02:41,415 - util.py[DEBUG]: loaded blob returned None, returning default.
2021-07-30 18:02:41,415 - subp.py[DEBUG]: Running command [‘blkid’, ‘-tTYPE=vfat’, ‘-odevice’] with allowed return codes [0, 2] (shell=False, capture=True)
2021-07-30 18:02:41,436 - subp.py[DEBUG]: Running command [‘blkid’, ‘-tTYPE=iso9660’, ‘-odevice’] with allowed return codes [0, 2] (shell=False, capture=True)
2021-07-30 18:02:41,440 - subp.py[DEBUG]: Running command [‘blkid’, ‘-tLABEL=CIDATA’, ‘-odevice’] with allowed return codes [0, 2] (shell=False, capture=True)
2021-07-30 18:02:41,443 - subp.py[DEBUG]: Running command [‘blkid’, ‘-tLABEL=cidata’, ‘-odevice’] with allowed return codes [0, 2] (shell=False, capture=True)
2021-07-30 18:02:41,445 - subp.py[DEBUG]: Running command [‘blkid’, ‘-tLABEL_FATBOOT=cidata’, ‘-odevice’] with allowed return codes [0, 2] (shell=False, capture=True)
2021-07-30 18:02:41,448 - util.py[DEBUG]: Reading from /etc/hosts (quiet=False)
2021-07-30 18:02:41,448 - util.py[DEBUG]: Read 250 bytes from /etc/hosts
2021-07-30 18:02:41,449 - atomic_helper.py[DEBUG]: Atomically writing to file /run/cloud-init/instance-data-sensitive.json (via temporary file /run/cloud-init/tmpq7d8y2dd) - w: [600] 5038 bytes/chars
2021-07-30 18:02:41,449 - atomic_helper.py[DEBUG]: Atomically writing to file /run/cloud-init/instance-data.json (via temporary file /run/cloud-init/tmpzpt15_bg) - w: [644] 1400 bytes/chars
2021-07-30 18:02:41,450 - handlers.py[DEBUG]: finish: init-local/search-NoCloud: SUCCESS: found local data from DataSourceNoCloud
2021-07-30 18:02:41,450 - stages.py[INFO]: Loaded datasource DataSourceNoCloud - DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud][dsmode=net]
2021-07-30 18:02:41,450 - util.py[DEBUG]: Reading from /etc/cloud/cloud.cfg (quiet=False)
2021-07-30 18:02:41,450 - util.py[DEBUG]: Read 4017 bytes from /etc/cloud/cloud.cfg
2021-07-30 18:02:41,450 - util.py[DEBUG]: Attempting to load yaml from string of length 4017 with allowed root types (<class ‘dict’>,)
2021-07-30 18:02:41,458 - util.py[DEBUG]: Reading from /etc/cloud/cloud.cfg.d/ens3.cfg (quiet=False)
2021-07-30 18:02:41,458 - util.py[DEBUG]: Read 167 bytes from /etc/cloud/cloud.cfg.d/ens3.cfg
2021-07-30 18:02:41,458 - util.py[DEBUG]: Attempting to load yaml from string of length 167 with allowed root types (<class ‘dict’>,)
2021-07-30 18:02:41,459 - util.py[DEBUG]: Reading from /etc/cloud/cloud.cfg.d/90_dpkg.cfg (quiet=False)
2021-07-30 18:02:41,459 - util.py[DEBUG]: Read 285 bytes from /etc/cloud/cloud.cfg.d/90_dpkg.cfg
2021-07-30 18:02:41,459 - util.py[DEBUG]: Attempting to load yaml from string of length 285 with allowed root types (<class ‘dict’>,)
2021-07-30 18:02:41,460 - util.py[DEBUG]: Reading from /etc/cloud/cloud.cfg.d/05_logging.cfg (quiet=False)
2021-07-30 18:02:41,460 - util.py[DEBUG]: Read 2070 bytes from /etc/cloud/cloud.cfg.d/05_logging.cfg
2021-07-30 18:02:41,460 - util.py[DEBUG]: Attempting to load yaml from string of length 2070 with allowed root types (<class ‘dict’>,)
2021-07-30 18:02:41,462 - util.py[DEBUG]: Reading from /run/cloud-init/cloud.cfg (quiet=False)
2021-07-30 18:02:41,462 - util.py[DEBUG]: Read 35 bytes from /run/cloud-init/cloud.cfg
2021-07-30 18:02:41,462 - util.py[DEBUG]: Attempting to load yaml from string of length 35 with allowed root types (<class ‘dict’>,)
2021-07-30 18:02:41,463 - util.py[DEBUG]: Attempting to load yaml from string of length 0 with allowed root types (<class ‘dict’>,)
2021-07-30 18:02:41,463 - util.py[DEBUG]: loaded blob returned None, returning default.
2021-07-30 18:02:41,463 - util.py[DEBUG]: Attempting to remove /var/lib/cloud/instance
2021-07-30 18:02:41,463 - util.py[DEBUG]: Creating symbolic link from ‘/var/lib/cloud/instance’ => ‘/var/lib/cloud/instances/nocloud’
2021-07-30 18:02:41,464 - util.py[DEBUG]: Reading from /var/lib/cloud/instances/nocloud/datasource (quiet=False)
2021-07-30 18:02:41,464 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/nocloud/datasource - wb: [644] 84 bytes
2021-07-30 18:02:41,464 - util.py[DEBUG]: Writing to /var/lib/cloud/data/previous-datasource - wb: [644] 84 bytes
2021-07-30 18:02:41,464 - util.py[DEBUG]: Reading from /var/lib/cloud/data/instance-id (quiet=False)
2021-07-30 18:02:41,464 - stages.py[DEBUG]: previous iid found to be NO_PREVIOUS_INSTANCE_ID

它从不要求用户数据文件???

我做错了什么,导致自动安装启动?

答案1

我认为这行

cloud-config-url=http://MyIp/autoinstall/meta-data

应该:

cloud-config-url=http://MyIp/autoinstall/user-data

正如您所说,您的元数据为空,而用户数据包含云配置。至少这解决了我设置中的类似问题。希望这能有所帮助 :)

答案2

我在使用 20.04.3 时遇到了其他问题,但是我发现您的启动行中有一个拼写错误:

‘ds=nocloud-net;s=http://MyIP/autoinstall/’应该ds=nocloud-net;s=http://MyIP/autoinstall/

相关内容