I can reproduce this problem with Ubuntu 14.04 as guest and Fedora 22 as host.
The problem occurs 100% of the time with the script below.
The relevant error is:
INFO: apt-get -yf install
Reading package lists...
Building dependency tree...
Reading state information...
Correcting dependencies... Done
The following extra packages will be installed:
libpam-systemd
The following packages will be upgraded:
libpam-systemd
1 upgraded, 0 newly installed, 0 to remove and 55 not upgraded.
82 not fully installed or removed.
Need to get 0 B/25.5 kB of archives.
After this operation, 1024 B of additional disk space will be used.
(Reading database ... 54203 files and directories currently installed.)
Preparing to unpack .../libpam-systemd_204-5ubuntu20.13_amd64.deb ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
invoke-rc.d: unknown initscript, /etc/init.d/systemd-logind not found.
dpkg: warning: subprocess old pre-removal script returned error exit status 100
dpkg: trying script from the new package instead ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
invoke-rc.d: unknown initscript, /etc/init.d/systemd-logind not found.
dpkg: error processing archive /var/cache/apt/archives/libpam-systemd_204-5ubuntu20.13_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 100
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
invoke-rc.d: unknown initscript, /etc/init.d/systemd-logind not found.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
/var/cache/apt/archives/libpam-systemd_204-5ubuntu20.13_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I can reproduce this problem with Ubuntu 14.04 as guest and Fedora 22 as host.
The problem occurs 100% of the time with the script below.
The relevant error is: systemd_ 204-5ubuntu20. 13_amd64. deb ... upstart: Connection refused d/systemd- logind not found. upstart: Connection refused d/systemd- logind not found. apt/archives/ libpam- systemd_ 204-5ubuntu20. 13_amd64. deb (--unpack): upstart: Connection refused d/systemd- logind not found. apt/archives/ libpam- systemd_ 204-5ubuntu20. 13_amd64. deb
INFO: apt-get -yf install
Reading package lists...
Building dependency tree...
Reading state information...
Correcting dependencies... Done
The following extra packages will be installed:
libpam-systemd
The following packages will be upgraded:
libpam-systemd
1 upgraded, 0 newly installed, 0 to remove and 55 not upgraded.
82 not fully installed or removed.
Need to get 0 B/25.5 kB of archives.
After this operation, 1024 B of additional disk space will be used.
(Reading database ... 54203 files and directories currently installed.)
Preparing to unpack .../libpam-
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/
invoke-rc.d: unknown initscript, /etc/init.
dpkg: warning: subprocess old pre-removal script returned error exit status 100
dpkg: trying script from the new package instead ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/
invoke-rc.d: unknown initscript, /etc/init.
dpkg: error processing archive /var/cache/
subprocess new pre-removal script returned error exit status 100
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/
invoke-rc.d: unknown initscript, /etc/init.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
/var/cache/
E: Sub-process /usr/bin/dpkg returned an error code (1)
Script:
cat > script.sh <<EOF
#!/bin/bash
echo "root:root" | chpasswd
export DEBIAN_ FRONTEND= noninteractive
echo "INFO: apt-get update"
apt-get update
echo "INFO: apt-get -yf upgrade"
apt-get -yf upgrade
echo "INFO: apt-get -yf install"
apt-get -yf install
echo "INFO: apt-get -y install gcc"
apt-get -y install gcc
echo "INFO: apt-get -yf install"
apt-get -yf install
echo "INFO: apt-get -y install gcc"
apt-get -y install gcc
echo "INFO: end of script (also returncode 0)"
EOF
virt-builder -x -v ubuntu-14.04 --arch x86_64 \
-o ubuntu.img \
--format qcow2 \
--run script.sh 2>&1 | tee output.txt
virt-cat -a ubuntu.img /tmp/builder.log > builder.log