自动安装与自定义用户数据完美运行,但安装完成后不会自动重启。
我在https://ubuntu.com/server/docs/install/autoinstall-reference中找不到有关重新启动的文档
我还在这里找到一篇文章http://junyelee.blogspot.com/2021/05/subiquity.html
# use interactive-sections to avoid an automatic reboot
这是我的用户数据
#cloud-config
autoinstall:
### config storage and network manually
interactive-sections:
- storage
# Swapfile on root volume
swap:
swap: 16GB
late-commands:
- curtin in-target --target=/target -- apt-get --purge -y --quiet=2 remove byobu
- curtin in-target --target=/target -- apt-get install -y git wget curl rsync net-tools ssh ubuntu-desktop plymouth-theme-ubuntu-logo grub-gfxpayload-lists mailutils
- curtin in-target --target=/target -- hostnamectl set-hostname ubuntu-jammy.abc.com
# Write a script that can take care of some post install setup "late-commands" cannot be interactive unfortunately"
- |
cat <<EOF | sudo tee /target/etc/finish-install-setup.sh
#!/usr/bin/env bash
echo *************************
echo **** Finish Setup ****
echo *************************
echo 'Enter the hostname for this system: '
read NEW_HOSTNAME
hostnamectl set-hostname \${NEW_HOSTNAME}
echo
echo 'Enter the timezone for this system: '
echo 'Asia/Taipei'
read NEW_TIMEZONE
timedatectl set-timezone \${NEW_TIMEZONE}
echo *************************
echo
echo *************************
echo 'Restarting to finish ...'
shutdown -r 3
EOF
- curtin in-target --target /target chmod 744 /etc/finish-install-setup.sh
apt:
disable_components: []
geoip: true
preserve_sources_list: false
primary:
- arches:
- amd64
- i386
uri: http://free.nchc.org.tw/ubuntu
- arches:
- default
uri: http://ports.ubuntu.com/ubuntu-ports
drivers:
install: false
identity:
hostname: ubuntu-jammy
password: somesupersecretpasswordhere
realname: administrator
username: administrator
kernel:
package: linux-generic
keyboard:
layout: us
toggle: null
variant: ''
locale: en_US.UTF-8
network:
ethernets:
ens18:
dhcp4: true
version: 2
ssh:
allow-pw: true
authorized-keys: []
install-server: true
### user-data , commands run during first boot
user-data:
runcmd:
- rm -rf /usr/bin/python
- ln -s /usr/bin/python3.10 usr/bin/python
- wget https://download.nomachine.com/download/7.8/Linux/nomachine_7.8.2_1_amd64.deb -O /opt/nomachine.deb
- dpkg -i /opt/nomachine.deb
#- /etc/finish-install-setup.sh
version: 1
我必须在最后按回车键重新启动机器,我认为这不是一个好的“自动化”。
但是我需要手动配置存储布局,有没有安装完成后强制重启的解决方案?