Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am creating a new virtual machine using libvirt's virt-install command. The command pulls a local preseed file from the hypervisor using initrd-inject:

virt-install \
--autostart \
--name vm1 \
--ram 4096 \
--location=http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/ \
--initrd-inject=/var/lib/libvirt/preseeds/vms/preseed.cfg \
--extra-args="locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=us hostname=virtual domain=unassigned-domain interface=auto" \
--vcpu=4 \
--vnc \
--vnclisten=0.0.0.0 \
--noautoconsole \
--os-type=linux \
--os-variant=ubuntukarmic \
-w bridge=br0 \
-w bridge=br1 \
-w network=default \
 --disk format=qcow2,size=20,bus=virtio,path=/export/vm/vm1.qcow2

Everything works fine until the late_command portion of the preseed which dynamically prints an upstart script to file with the following line;

d-i preseed/late_command string printf "description \"the run-once bootstrap\"\n\nstart on net-device-up\nstop on runlevel [!2345]\n\npre-start script\n wget -O /root/bootstrap.sh http://my.bootstrap/bootstrap;\nchmod +x /root/bootstrap.sh;\n  /root/bootstrap.sh > /var/log/bootstrap.log 2>&1\nend script" > /target/etc/init/run_bootstrap.conf

The Ubuntu 12.04 installer for the vm stops and I see the following information in the installer debug logs:

Feb 21 19:44:54 preseed: running preseed command preseed/late_command: printf "description \"the run-once bootstrap\"
Feb 21 19:44:54 log-output: sh: syntax error: unterminated quoted string
Feb 21 19:44:54 finish-install: /bin/preseed_command: return: line 23: Illegal number: start
Feb 21 19:44:54 finish-install: warning: /usr/lib/finish-install.d/07preseed returned error code 2

The syntax for the preseed if fine, because it runs properly over http in the extra-args line instead of through initrd-inject. Also the double quotes get escaped properly, because the problem still exists if they are removed.

My hypervisor is on debian-squeeze with virtinst=0.600.3-3 cherry-picked from sid.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.