Ubuntu – PostgreSQL 9.4 hangs during installation at “Removing obsolete dictionary files:”

aptpostgresql

Good day.

I am trying to install PostgreSQL on an Ubuntu server (15.04) 64 bit. I checked/updated the sources.list and ran:

# apt-get update

followed by:

# apt-get install postgresql

The installation started until it came to "Removing obsolete dictionary files:" where it hangs:

# apt-get install postgresql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libpq5 postgresql-9.4 postgresql-client-9.4 postgresql-client-common postgresql-common ssl-cert
Suggested packages:
  postgresql-doc oidentd ident-server locales-all postgresql-doc-9.4 openssl-blacklist
The following NEW packages will be installed:
  libpq5 postgresql postgresql-9.4 postgresql-client-9.4 postgresql-client-common postgresql-common ssl-cert
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,934 kB of archives.
After this operation, 16.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://mirror.hetzner.de/ubuntu/packages/ vivid-updates/main libpq5 amd64 9.4.2-0ubuntu0.15.04 [77.5 kB]
Get:2 http://mirror.hetzner.de/ubuntu/packages/ vivid/main postgresql-client-common all 166bzr2 [26.9 kB]
Get:3 http://mirror.hetzner.de/ubuntu/packages/ vivid-updates/main postgresql-client-9.4 amd64 9.4.2-0ubuntu0.15.04 [817 kB]
Get:4 http://mirror.hetzner.de/ubuntu/packages/ vivid/main ssl-cert all 1.0.35 [17.4 kB]
Get:5 http://mirror.hetzner.de/ubuntu/packages/ vivid/main postgresql-common all 166bzr2 [151 kB]
Get:6 http://mirror.hetzner.de/ubuntu/packages/ vivid-updates/main postgresql-9.4 amd64 9.4.2-0ubuntu0.15.04 [2,839 kB]
Get:7 http://mirror.hetzner.de/ubuntu/packages/ vivid/main postgresql all 9.4+166bzr2 [5,104 B]
Fetched 3,934 kB in 0s (14.4 MB/s)     
Preconfiguring packages ...
Selecting previously unselected package libpq5:amd64.
(Reading database ... 57554 files and directories currently installed.)
Preparing to unpack .../libpq5_9.4.2-0ubuntu0.15.04_amd64.deb ...
Unpacking libpq5:amd64 (9.4.2-0ubuntu0.15.04) ...
Selecting previously unselected package postgresql-client-common.
Preparing to unpack .../postgresql-client-common_166bzr2_all.deb ...
Unpacking postgresql-client-common (166bzr2) ...
Selecting previously unselected package postgresql-client-9.4.
Preparing to unpack .../postgresql-client-9.4_9.4.2-0ubuntu0.15.04_amd64.deb ...
Unpacking postgresql-client-9.4 (9.4.2-0ubuntu0.15.04) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../ssl-cert_1.0.35_all.deb ...
Unpacking ssl-cert (1.0.35) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack .../postgresql-common_166bzr2_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (166bzr2) ...
Selecting previously unselected package postgresql-9.4.
Preparing to unpack .../postgresql-9.4_9.4.2-0ubuntu0.15.04_amd64.deb ...
Unpacking postgresql-9.4 (9.4.2-0ubuntu0.15.04) ...
Selecting previously unselected package postgresql.
Preparing to unpack .../postgresql_9.4+166bzr2_all.deb ...
Unpacking postgresql (9.4+166bzr2) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (219-7ubuntu5) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up libpq5:amd64 (9.4.2-0ubuntu0.15.04) ...
Setting up postgresql-client-common (166bzr2) ...
Setting up postgresql-client-9.4 (9.4.2-0ubuntu0.15.04) ...
update-alternatives: using /usr/share/postgresql/9.4/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up ssl-cert (1.0.35) ...
Setting up postgresql-common (166bzr2) ...
Adding user postgres to group ssl-cert

Creating config file /etc/postgresql-common/createcluster.conf with new version

Creating config file /etc/logrotate.d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:

I left it, but quit after a while. After getting rid of the locks, I tried running:

# dpkg --configure -a

which continued and got stuck at exactly the same place ("Removing obsolete…).

It seems to be something to do with "aspell", but I have no idea what exactly. Any help would be appreciated.

EDIT:

I tried changing the locale and got this:

# locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
# LANG=POSIX
# apt-get install postgresql
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. 
# dpkg --configure -a
Setting up postgresql-common (166bzr2) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
  en_gb
Removing obsolete dictionary files:

Best Answer

I tried to install it on a docker container and everything works fine. Maybe this is caused by your locale. You can check it with the command: locale. You can try to change it temporarily typing: LANG=POSIX and then retry to install postgresql in the same terminal.