我正在尝试在不使用图形的情况下在 CentOS 主机上安装 FreeBSD 10(仅使用串行控制台)。我试过:
# virt-install -n freebsd-a -r 512 --vcpus=1 --os-variant=freebsd10.0 --graphics none -v --disk path=/home/freebsd/freebsd-a.qcow2,size=10 --cdrom /home/freebsd/FreeBSD-10.1-RELEASE-amd64-disc1.iso --network bridge=br0 --network bridge=br11 --autostart
WARNING CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location. See the man page for examples of using --location with CDROM media
Starting install...
Creating domain... | 0 B 00:00
Connected to domain freebsd-a
Escape character is ^]
确实,控制台未连接。当我尝试使用时--location
,安装未启动:
# virt-install -n freebsd-a -r 512 --vcpus=1 --os-type=freebsd --os-variant=freebsd10.0 --graphics none -v --disk path=/home/freebsd/freebsd-a.qcow2,size=10 --location /home/freebsd/FreeBSD-10.1-RELEASE-amd64-disc1.iso --network bridge=br0 --network bridge=br11 --autostart
WARNING No 'console' seen in --extra-args, a 'console=ttyS0' kernel argument is likely required to see text install output from the guest.
Starting install...
ERROR Could not find an installable distribution at '/home/freebsd/FreeBSD-10.1-RELEASE-amd64-disc1.iso'
The location must be the root directory of an install tree.
See virt-install man page for various distro examples.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start freebsd-a
otherwise, please restart your installation.
# mount -o loop /home/freebsd/FreeBSD-10.1-RELEASE-amd64-disc1.iso /mnt/
# virt-install -n freebsd-a -r 512 --vcpus=1 --os-type=freebsd --os-variant=freebsd10.0 --graphics none -v --disk path=/home/freebsd/freebsd-a.qcow2,size=10 --location /mnt/ --network bridge=br0 --network bridge=br11 --autostart
ERROR Error validating install location: Could not find an installable distribution at '/mnt/'
The location must be the root directory of an install tree.
See virt-install man page for various distro examples.
我究竟做错了什么?
答案1
8年后我在这里回答这个问题。
默认的 FreeBSD ISO/etc 默认不启用串行端口(据我所知)。
我通过构建自定义 ISO 解决了这个问题。
1) Install FreeBSD using virt-manager GUI. You need at least 20G disk.
2) Make sure you've installed sources by selecting "src" option during GUI installation.
3) cd /usr/src
1. vim stand/defaults/loader.conf
2. In "Basic configuration options" section change kernel_options="" to
kernel_options="-h"
3. In "Loader settings" section uncomment and change "console" setting to
console="comconsole,vidconsole"
4. In "Loader settings" section uncomment and change "comconsole_speed" to
comconsole_speed="155200"
5. In "Kernel settings" section uncomment and change "boot_serial" to
boot_serial="-h"
6. Save changes and exit the file.
7. vim sbin/init/ttys
8. Go to the "Serial terminals" section and change ttyu0 line to
'ttyu0 "/usr/libexec/getty std.155200" vt100 on secure'
9. Save changes and exit the file.
4) make -j8 buildworld buildkernel
5) cd release
6) make release
7) make install DESTDIR=/home/username/custom_iso
8) Done. Now in a "/home/username/custom_iso" dir you have kvm-ready custom iso
with a serial port enabled.
virt-install example config:
virt-install \
--name freebsd_13_2_serial \
--description "Freebsd 13.2 with a serial port" \
--os-variant=freebsd13.1 \
--ram=2048 \
--vcpus=2 \
--disk path=/var/lib/libvirt/images/freebsd_13_2_serial.img,bus=virtio,size=10 \
--graphics none \
--console pty,target_type=serial \
--cdrom /home/username/freebsd_13_2_serial.iso \
--network default,model='virtio'