Cannot install Synapse

Hello,

I am trying to install Synapse but it doesn’t work.
Everything is up to date on my server.

yunohost 3.2.2 (stable)
yunohost-admin 3.2.1 (stable)
moulinette 3.2.0 (stable)
ssowat 3.2.0 (stable)

Logs:

2018-11-07 19:06:47,238: WARNING - debconf: unable to initialize frontend: Dialog
2018-11-07 19:06:47,242: WARNING - debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
2018-11-07 19:06:47,244: WARNING - debconf: falling back to frontend: Readline
2018-11-07 19:06:47,246: WARNING - debconf: unable to initialize frontend: Readline
2018-11-07 19:06:47,248: WARNING - debconf: (This frontend requires a controlling tty.)
2018-11-07 19:06:47,250: WARNING - debconf: falling back to frontend: Teletype
2018-11-07 19:06:47,352: WARNING - dpkg-preconfigure: unable to re-open stdin:
2018-11-07 19:07:20,060: WARNING - bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
2018-11-07 19:07:20,061: WARNING - perl: warning: Setting locale failed.
2018-11-07 19:07:20,063: WARNING - perl: warning: Please check that your locale settings:
2018-11-07 19:07:20,065: WARNING - 	LANGUAGE = (unset),
2018-11-07 19:07:20,066: WARNING - 	LC_ALL = "en_US.UTF-8",
2018-11-07 19:07:20,068: WARNING - 	LANG = "en_GB.UTF-8"
2018-11-07 19:07:20,070: WARNING -     are supported and installed on your system.
2018-11-07 19:07:20,072: WARNING - perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
2018-11-07 19:07:20,174: WARNING - /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
2018-11-07 19:07:20,176: WARNING - psql: could not connect to server: No such file or directory
2018-11-07 19:07:20,178: WARNING - 	Is the server running locally and accepting
2018-11-07 19:07:20,180: WARNING - 	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
2018-11-07 19:07:20,183: WARNING - !!
2018-11-07 19:07:20,185: WARNING -   synapse's script has encountered an error. Its execution was cancelled.
2018-11-07 19:07:20,188: WARNING - !!
2018-11-07 19:07:20,190: WARNING - 

Does anyone know how to solve this issue?
Thanks!

Hello,

It look like it’s postgresql which don’t work. Did you do something with postgresql.

Mybe you can try to install postgresql manually and after check if postgresql work before to install synapse.

For that just install by this command : sudo apt install postgresql

Thanks Josue for your reply.
Unfortunately it didn’t work.
I don’t remember having did anything with postgresql but when I tried your solution, it gave the following:

root@thibaut:~# sudo apt install postgresql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  postgresql-doc
The following NEW packages will be installed:
  postgresql
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/55.8 kB of archives.
After this operation, 61.4 kB of additional disk space will be used.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LC_COLLATE = "C",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LC_COLLATE = "C",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package postgresql.
(Reading database ... 59199 files and directories currently installed.)
Preparing to unpack .../postgresql_9.6+181+deb9u2_all.deb ...
Unpacking postgresql (9.6+181+deb9u2) ...
Setting up postgresql (9.6+181+deb9u2) ...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

In case, I tried again to install Synapse afterward but same problem.

Ok, but I know that it don’t solve the problem. Now you should check that postgresql is running by the command : systemctl status postgresql.

And after you could try to connect to the database by : sudo -u postgres psql.

root@thibaut:~# systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor
   Active: active (exited) since Wed 2018-11-07 19:17:03 UTC; 2h 16min ago
 Main PID: 281 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/postgresql.service

Nov 07 19:17:02 thibaut.fr.to systemd[1]: Starting PostgreSQL RDBMS...
Nov 07 19:17:03 thibaut.fr.to systemd[1]: Started PostgreSQL RDBMS.
lines 1-8/8 (END)

.

root@thibaut:~# sudo -u postgres psql
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = "en_US.UTF-8",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
could not change directory to "/root": Permission denied
psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Can you type : ls -la /var/run/postgresql/

Hi Josue,

root@thibaut:~# ls -la /var/run/postgresql/
total 0
drwxrwsr-x  2 postgres postgres   40 Nov  9 20:17 .
drwxr-xr-x 38 root     root     1160 Nov 10 12:51 ..

It look like that postgresql don’t run correctly. Can you restart by systemctl restart postgresql. After retry to connect to postgresql.

Did you touch anything in the postgresql config ?

You can also see in the log of postgresql in /var/log/postgresql to see what happen.

Sorry, how can I see the log of postgresql?

with tail or cat

root@thibaut:~# cat /var/log/postgresql
cat: /var/log/postgresql: Is a directory

root@thibaut:~# tail /var/log/postgresql
tail: error reading ‘/var/log/postgresql’: Is a directory

If it’s a directory you need to see what is in this directory (with ls by example) and after “cat” or “tail” is able to read a file not a directory.

So what is the result of : tail -n 100 /var/log/postgresql/postgresql-9.6-main.log

root@thibaut:~# tail -n 100 /var/log/postgresql/postgresql-9.6-main.log
tail: cannot open ‘/var/log/postgresql/postgresql-9.6-main.log’ for reading: No such file or directory

It looks like /var/log/postgresql/ is empty.
When I am inside, ls doesn’t find me anything.

What is the result of ls /var/log/postgresql ?

[thibaut@antergos ~]$ ls /var/log/postgresql
ls: impossible d’accéder à ‘/var/log/postgresql’: Aucun fichier ou dossier de ce type

(it’s written "impossible to access to xxx no file of folder of this type)

I think if postgresql don’t contain any information you should purge postgresql. To do that I found this information : https://prograide.com/pregunta/10156/comment-bien-purger-et-reinstaller-postgresql-sur-ubuntu

apt-get --purge remove postgresql\*
rm -r /etc/postgresql/
rm -r /etc/postgresql-common/
rm -r /var/lib/postgresql/
userdel -r postgres
groupdel postgres

After try a new time to install synapse

Hi Josue,

Sorry for the delay of my answer, I was abroad without my PC.
I tried this solution but the problem remains the same.

One point, I got this which is quite odd (I guess):

root@thibaut:~# rm -r /etc/postgresql/
rm: cannot remove '/etc/postgresql/': No such file or directory
root@thibaut:~# rm -r /etc/postgresql-common/
rm: cannot remove '/etc/postgresql-common/': No such file or directory
root@thibaut:~# rm -r /var/lib/postgresql/
rm: cannot remove '/var/lib/postgresql/': No such file or directory
root@thibaut:~# userdel -r postgres
userdel: postgres mail spool (/var/mail/postgres) not found
userdel: postgres home directory (/var/lib/postgresql) not found
root@thibaut:~# groupdel postgres
groupdel: group 'postgres' does not exist

Do you have any log. With just that I can do nothing for you.

I don’t have any log of postgresql.
The ones I tried preivously show the same thing as what I copied above in this post.
Is there anything else than /var/log/postgresql that I can inspect?

In this case can you a new time purge postgresql and after install postgresql manually by this command :

apt install postgresql

After try sudo -u postgres psql