You are not logged in.
I would like to automate Arch Linux install via `virt-install` as suggested here in plain QEMU.
https://fadeevab.com/how-to-setup-qemu- … ll-script/
The first step is booting the ISO and redirecting the guest input/output to the host's terminal.
With a CentOS ISO I could redirect the guest input/output like so:
virt-install -n arch --memory=2048 --location=/home/test/CentOS-7-x86_64-Minimal-1908.iso \
--disk ~/arch.img,size=2 --nographics \
--extra-args='console=tty0 console=ttyS0,115200n8 serial'However:
virt-install -n arch --memory=2048 --location=/home/test/archlinux-2019.06.01-x86_64.iso \
--disk ~/arch.img,size=2 --nographics \
--extra-args='console=tty0 console=ttyS0,115200n8 serial'gives:
ERROR Error validating install location: Could not find an installable distribution at
'/home/test/archlinux-2019.06.01-x86_64.iso'
The location must be the root directory of an install tree.
See virt-install man page for various distro examples.
Based on `man virt-install`, for non-supported ISOs, one could locate the kernel with:
--location my-unknown.iso,kernel=kernel/fookernel,initrd=kernel/fooinitrdHowever replacing:
--location /home/test/archlinux-2019.06.01-x86_64.iso,kernel=/arch/boot/x86_64/vmlinuz,initrd=/arch/boot/x86_64/archiso.img gives:
ERROR Command '['isoinfo', '-J', '-i', '/home/test/archlinux-2019.06.01-x86_64.iso', '-f']' returned non-zero exit status 1.In fact the Arch ISO does not support Joliet:
isoinfo -J -i /home/test/archlinux-2019.06.01-x86_64.iso -f
Setting input-charset to 'UTF-8' from locale.
Unable to find Joliet SVDIt should also be noted that `--location` requires `isoinfo` from cdrtoos, which is not listed in `virt-install` package dependences.
There are other arguments with with `kernel_args` sub-options, such as `--install` and `--boot`. But they still require locating the kernel.
Using:
virt-install -n arch --memory=2048 -c /home/test/archlinux-2019.06.01-x86_64.iso \
--disk ~/arch.img,size=2 --nographics \
--console pty,target_type=serialGives just a very limited initial output.
I tried to mount the ISO
sudo mount /home/test/archlinux-2019.06.01-x86_64.iso /mntand use the mounted path:
virt-install -n arch --memory=2048 \
--location /mnt,kernel=/mnt/arch/boot/x86_64/vmlinuz,initrd=/mnt/arch/boot/x86_64/archiso.img \
--disk ~/arch.img,size=2 --nographics \
--install kernel_args='console=tty0 console=ttyS0,115200n8 serial'The console worked, but the bootstrap image looks for the Arch disk to mount by label (`ARCH_201906` in my case):
:: Mounting '/dev/disk/by-label/' to '/run/archiso/bootmnt'
ERROR: '/dev/disk/by-label/' device did not show up after 30 seconds...
Falling back to interactive promptIf you have any idea to redirect the console, the second step would be to redirect it through a named pipe, such as
mkfifo /tmp/guest.in /tmp/guest.outLast edited by antonio (2019-11-16 22:38:48)
Offline
This doesn't really answer your questions, but I've always just used pacstrap directly to create any Arch VM's that I need. I don't bother with libvirt at all I just use...
https://wiki.archlinux.org/index.php/QE … es_on_boot
Offline
This may help: Bootparams
Knowing others is wisdom, knowing yourself is enlightenment. ~Lao Tse
Offline
@Tarqi
I tried to fiddle with kernel boot parameters, such as `archisodevice`, but Arch boot sequence requires '/run/archiso/bootmnt' to be mapped to a device and `virt-install --location` provides a path.
Offline
@Slithery
I converted the virt-install command (without network) in plain qemu via `domxml-to-native`. There are so many optimisations which make virt-install worth trying.
That is (code hard wrapped for readeability):
/usr/bin/qemu-system-x86_64 -name guest=arch,debug-threads=on -object
secret,id=masterKey0,format=raw,file=/home/test/.config/libvirt/qemu/lib/domain--1-arch/master-key.aes
-machine pc-q35-4.1,accel=kvm,usb=off,dump-guest-core=off -cpu
Skylake-Client-IBRS,ss=on,hypervisor=on,tsc-adjust=on,clflushopt=on,umip=on,md-clear=on,stibp=on,ssbd=on,xsaves=on,pdpe1gb=on,skip-l1dfl-vmentry=on
-m 2048 -overcommit mem-lock=off -smp 1,sockets=1,cores=1,threads=1
-uuid e569ff76-a614-433c-b459-6efde9207ff5 -display none
-no-user-config -nodefaults -chardev
socket,id=charmonitor,path=/home/test/.config/libvirt/qemu/lib/domain--1-arch/monitor.sock,server,nowait
-mon chardev=charmonitor,id=monitor,mode=control -rtc
base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet
-no-shutdown -global ICH9-LPC.disable_s3=1 -global
ICH9-LPC.disable_s4=1 -boot strict=on -device
pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x1
-device
pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1
-device
pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2
-device
pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3
-device
pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4
-device
pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5
-device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.1,addr=0x0 -device
virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x0 -drive
file=/home/test/arch.img,format=qcow2,if=none,id=drive-virtio-disk0
-device
virtio-blk-pci,scsi=off,bus=pci.3,addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
-chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -chardev
socket,id=charchannel0,path=/home/test/.config/libvirt/qemu/channel/target/domain--1-arch/org.qemu.guest_agent.0,server,nowait
-device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
-device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0 -object
rng-random,id=objrng0,filename=/dev/urandom -device
virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.5,addr=0x0 -sandbox
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny
-msg timestamp=onLast edited by antonio (2019-11-16 15:40:04)
Offline
The Joliet support might be just a bug, since isoinfo works and can manually extract the kernel/initrd.
From my understanting of Arch bootparams they want a boot device, not a path (unless it is a remote path)
So my solution is to extract the vmlinuz/archiso.img to run them via `virt-install --location` and attach the ISO for the sake of passing the `archisodevice` kernel param.
tdir=$(mktemp -d)
iso=~/archlinux-2019.06.01-x86_64.iso
isoinfo -i$iso -x'/ARCH/BOOT/X86_64/VMLINUZ.;1' >${tdir}/vmlinuz
isoinfo -i$iso -x'/ARCH/BOOT/X86_64/ARCHISO.IMG;1' >${tdir}/archiso.img
virt-install -n arch --memory=2048 \
--location ${tdir},kernel=${tdir}/vmlinuz,initrd=${tdir}/archiso.img \
--disk $iso,device=cdrom --disk ~/arch.img,size=2 --nographics \
--install kernel_args='console=tty0 console=ttyS0,115200n8 serial archisodevice=/dev/sr0' Last edited by antonio (2019-12-21 18:52:21)
Offline
Following your example, I attempted to add support for UEFI booting. So I added:
--boot uefi
Secondly I also installed ovmf:
sudo pacman -S ovmf
Next, I edited /etc/libvirt/qemu.conf to specify the nvram to the ovmf files:
sudo vim /etc/libvirt/qemu.conf
nvram = [
"/usr/share/ovmf/OVMF_CODE.fd:/usr/share/ovmf/OVMF_VARS.fd"
]
Finally, I restarted libvirtd:
systemctl restart libvirtd
However, it fails to fully boot with an unusual error about /dev/sr0:
:: running early hook [udev]
Starting version 245.3-2-arch
:: running early hook [archiso_pxe_nbd]
:: running hook [udev]
:: Triggering uevents...
:: running hook [memdisk]
:: running hook [archiso]
:: running hook [archiso_loop_mnt]
:: running hook [archiso_pxe_common]
:: running hook [archiso_pxe_nbd]
:: running hook [archiso_pxe_http]
:: running hook [archiso_pxe_nfs]
:: Mounting '/dev/sr0' to '/run/archiso/bootmnt'
Waiting 30 seconds for device /dev/sr0 ...
ERROR: '/dev/sr0' device did not show up after 30 seconds...
Falling back to interactive prompt
You can try to fix the problem manually, log out when you are finished
sh: can't access tty; job control turned off
This doesn't happen if I remove --boot uefi
Any ideas what's going on?
Thanks,
Sean
Offline
I figured it out.
The nvram setting is deprecated, instead do this:
sudo mkdir -p /etc/qemu
sudo cp /usr/share/qemu/firmware/60-edk2-ovmf-x86_64.json /etc/qemu
sudo systemctl restart libvirtd.service
Offline