$ sudo lxc-create -t ubuntu -n precise -f /etc/lxc/local.conf -- -r precise -a i686 -b gary
$ sudo lxc-start -n precise
[log in as root]
root@precise:~# apt-get install postgresql-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
openssl postgresql-client-common ssl-cert
Suggested packages:
ca-certificates openssl-blacklist
The following NEW packages will be installed:
openssl postgresql-client-common postgresql-common ssl-cert
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 643 kB of archives.
After this operation, 1618 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://archive.ubuntu.com/ubuntu/ precise/main openssl i386 1.0.0e-3ubuntu1 [510 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main postgresql-client-common all 128 [25.6 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main ssl-cert all 1.0.28 [12.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ precise/main postgresql-common all 128 [94.9 kB]
Fetched 643 kB in 1s (482 kB/s)
Preconfiguring packages ...
Selecting previously unselected package openssl.
(Reading database ... 12500 files and directories currently installed.)
Unpacking openssl (from .../openssl_1.0.0e-3ubuntu1_i386.deb) ...
Selecting previously unselected package postgresql-client-common.
Unpacking postgresql-client-common (from .../postgresql-client-common_128_all.deb) ...
Selecting previously unselected package ssl-cert.
Unpacking ssl-cert (from .../ssl-cert_1.0.28_all.deb) ...
Selecting previously unselected package postgresql-common.
Unpacking postgresql-common (from .../postgresql-common_128_all.deb) ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
dpkg: unrecoverable fatal error, aborting:
failed to fstat previous diversions file: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (2)
Repro:
$ sudo lxc-create -t ubuntu -n precise -f /etc/lxc/local.conf -- -r precise -a i686 -b gary client- common ssl-cert client- common postgresql-common ssl-cert archive. ubuntu. com/ubuntu/ precise/main openssl i386 1.0.0e-3ubuntu1 [510 kB] archive. ubuntu. com/ubuntu/ precise/main postgresql- client- common all 128 [25.6 kB] archive. ubuntu. com/ubuntu/ precise/main ssl-cert all 1.0.28 [12.2 kB] archive. ubuntu. com/ubuntu/ precise/main postgresql-common all 128 [94.9 kB] 1.0.0e- 3ubuntu1_ i386.deb) ... client- common. client- common (from .../postgresql- client- common_ 128_all. deb) ... cert_1. 0.28_all. deb) ... common_ 128_all. deb) ... pg_config. libpq-dev by postgresql-common'
$ sudo lxc-start -n precise
[log in as root]
root@precise:~# apt-get install postgresql-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
openssl postgresql-
Suggested packages:
ca-certificates openssl-blacklist
The following NEW packages will be installed:
openssl postgresql-
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 643 kB of archives.
After this operation, 1618 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://
Get:2 http://
Get:3 http://
Get:4 http://
Fetched 643 kB in 1s (482 kB/s)
Preconfiguring packages ...
Selecting previously unselected package openssl.
(Reading database ... 12500 files and directories currently installed.)
Unpacking openssl (from .../openssl_
Selecting previously unselected package postgresql-
Unpacking postgresql-
Selecting previously unselected package ssl-cert.
Unpacking ssl-cert (from .../ssl-
Selecting previously unselected package postgresql-common.
Unpacking postgresql-common (from .../postgresql-
Adding 'diversion of /usr/bin/pg_config to /usr/bin/
dpkg: unrecoverable fatal error, aborting:
failed to fstat previous diversions file: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (2)
Workaround (thanks to wgrant): d/usr.bin. lxc-start /etc/apparmor. d/disable/ d/usr.bin. lxc-start
sudo ln -s /etc/apparmor.
sudo apparmor_parser -R /etc/apparmor.
Then it should work.
Ideally we'd be able to keep apparmor involved.