Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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= \
--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= \
--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/ http://my.bootstrap/bootstrap;\nchmod +x /root/;\n  /root/ > /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


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

Browse other questions tagged or ask your own question.