I had found the way to implement the automatic guest installation of default archiso image, controlling only host machine, however it's somewhat cumbersome. You need to combine VBox native functionality with exposed serial port over ssh.
Enable virtual serial port support for VBox:
VBoxManage modifyvm "$VNM" --uart1 0x3F8 4 --uartmode1 server "$SERIAL"
VBoxManage startvm "$VNM"
# Wait for boot menu. WARNING: May be affected by problem with timing!
Send commands into guest to enable serial port on kernel's boot:
# Press <Tab> to edit boot string, add 'console=ttyS0', then <Enter>
VBoxManage controlvm "$VNM" keyboardputscancode 0f 8f 39 b9 # <Tab><Space>
VBoxManage controlvm "$VNM" keyboardputscancode 2e ae 18 98 31 b1 1f 9f 18 98 26 a6 12 92 # 'console'
VBoxManage controlvm "$VNM" keyboardputscancode 0d 8d 14 94 14 94 15 95 36 1f 9f b6 0b 8b # '=ttyS0'
VBoxManage controlvm "$VNM" keyboardputscancode 1c 9c # Enter
Login into shell by serial pipe. I used
netcat, but either will work. Next commands show how to work with socket locally (but you can redirect to ssh):
printf "root\n" | nc -q 2 -U "$SERIAL"
Send installation script as heredoc over socket. It was simpler than my primary approach with
scp. Hovewer you can execute
scp over serial too.
printf "\n"'cat - <<-'"'EOFARCHSETUP' > ~/arch-setup\n" | nc -U "$SERIAL"
cat "$SCRIPT_DIR/arch-setup" | nc -U "$SERIAL" # Send text content of setup file
printf "\nEOFARCHSETUP\n" | nc -U "$SERIAL" # End of heredoc file
printf "\nchmod u+x ~/arch-setup\n" | nc -U "$SERIAL" # Make executable
printf "\ncd ~ && ./arch-setup --new\n" | nc -U "$SERIAL" # Start install
Non-interactive monitoring of installation (safe with Ctrl-C to interrupt monitoring only w/o affecting the installation):
nc -d -U "$SERIAL"
If there are some unclear moments left, you can see full scripts at Github