Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm creating KVM guest with following virt-install options and preseed.cfg, and always user creation dialog "[!!] Set up users and passwords" is shown.

How do I automate that section with preseeding?

Of course, I checked my preseed.cfg was right with debconf-set-selections -c preseed.cfg.

[install.sh]

#!/bin/bash
sudo virt-install \
--name=test \
--connect=qemu:///system \
--ram=2048 \
--vcpus=2 \
--os-variant=ubuntuprecise \
--hvm \
--virt-type=kvm \
--network=bridge:br0 \
--location=http://mirrors.usc.edu/pub/linux/distributions/ubuntu/dists/precise/main/installer-amd64/ \
--file=test.img \
--graphics vnc,port=5901,password=test,listen=0.0.0.0,keymap=ja \
--extra-args="auto=true priority=critical initrd=/install/initrd.gz preseed/file=preseed.cfg"

[preseed.cfg]

d-i debian-installer/locale string ja_JP
d-i console-keymaps-at/keymap select ja

d-i netcfg/get_nameservers string 8.8.8.8
d-i netcfg/get_ipaddress string 192.168.1.50
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 192.168.1.1
d-i netcfg/choose_interface select eth0
d-i netcfg/disable_dhcp boolean true
d-i netcfg/dhcp_options select Configure network manually
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string test
d-i netcfg/get_hostname seen false
d-i netcfg/get_domain string ymotongpoo.local

d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string

d-i clock-setup/utc boolean true
d-i time/zone string Asia/Tokyo
d-i clock-setup/ntp boolean true

d-i partman-auto/disk string /dev/vda
d-i partman-lvm/devide_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true

d-i partman-auto/method string regular
d-i partman-lvm/confirm boolean true

d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic

d-i partman/default_filesystem string ext4

d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

d-i passwd/user-fullname string Ubuntu User
d-i passwd/username string ubuntu
d-i passwd/user-password password spameggham
d-i passwd/user-password-again password spameggham
d-i user-setup/allow-password-weak boolean true

tasksel tasksel/first multiselect standard
d-i pkgsel/include string openssh-server vim puppet
d-i pkgsel/upgrade select safe-upgrade
d-i pkgsel/language-packs multiselect en, ja
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean false

popularity-contest popularity-contest/participate boolean false

d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note
share|improve this question
add comment

1 Answer

Try using a hashed password like this:

$ mkpasswd -m sha-512
Password: 
$6$ONf5M3F1u$bpljc9f1SPy1w4J2br5BWbE38lPlbBGgjbkJ6MnrvQK2kUfFyT/r0p.R22FFPMAc61B9BD/UWcXoui4qXInx01

And then in your preseed file:

# User account
d-i passwd/root-login boolean false
d-i passwd/user-fullname string My Full Name Here
d-i passwd/username string myusername
d-i passwd/user-password-crypted password $6$ONf5M3F1u$bpljc9f1SPy1w4J2br5BWbE38lPlbBGgjbkJ6MnrvQK2kUfFyT/r0p.R22FFPMAc61B9BD/UWcXoui4qXInx01

This works for me.

As a bonus, you don't have plain passwords in your preseed file anymore.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.