Result:
Job for postgresql.service failed because the control process exited with error code. See “systemctl status postgresql.service” and “journalctl -xe” for details.
sudo systemctl status postgresql
Result:
[sudo] password for root:
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2018-03-07 16:57:37 +08; 20min ago
Process: 24052 ExecStart=/usr/lib/postgresql-init start (code=exited, status=1/FAILURE)
Mar 07 16:57:37 r3 systemd[1]: Starting PostgreSQL database server…
Mar 07 16:57:37 r3 systemd[1]: postgresql.service: Control process exited, …=1
Mar 07 16:57:37 r3 systemd[1]: Failed to start PostgreSQL database server.
Mar 07 16:57:37 r3 systemd[1]: postgresql.service: Unit entered failed state.
Mar 07 16:57:37 r3 systemd[1]: postgresql.service: Failed with result ‘exit…’.
Mar 07 16:58:16 r3 systemd[1]: postgresql.service: Unit cannot be reloaded …e.
Hint: Some lines were ellipsized, use -l to show in full.
postgres@r3:~>
Since it is a new database, I am open to:
a) Fixing from above
b) deleting the old install and reinstalling again (actually this is what I tried and I ended with the above)
First,
The recommendation to install PostgreSQL from the special database repository is probably very old and unnecessary today… You should be able to find PostgreSQL in the OSS. Also, the SDB describes installing from teh Tumbleweed repo (A likely big no-no).
So, my recommendation is to remove the repository, refresh your repositories and then do a “force re-install” of your PostgreSQL packages. The following compound command will do all that for you
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2018-03-08 10:17:05 +08; 5min ago
Process: 9061 ExecStart=/usr/lib/postgresql-init start (code=exited, status=1/FAILURE)
Mar 08 10:17:05 r3 systemd[1]: Starting PostgreSQL database server…
Mar 08 10:17:05 r3 systemd[1]: postgresql.service: Control process exited, code=exited status=1
Mar 08 10:17:05 r3 systemd[1]: Failed to start PostgreSQL database server.
Mar 08 10:17:05 r3 systemd[1]: postgresql.service: Unit entered failed state.
Mar 08 10:17:05 r3 systemd[1]: postgresql.service: Failed with result ‘exit-code’.
For more details see su(1).
r3:~ # psql
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”?
The following 12 packages are going to be REMOVED:
postgresql postgresql-contrib postgresql-init postgresql-plpython
postgresql-server postgresql94 postgresql94-contrib postgresql94-server
postgresql96 postgresql96-contrib postgresql96-plpython postgresql96-server
12 packages to remove.
After the operation, 48.4 MiB will be freed.
Continue? [y/n/…? shows all options] (y): y
( 1/12) Removing postgresql-9.6-1.1.noarch …[done]
( 2/12) Removing postgresql-contrib-9.6-1.1.noarch …[done]
( 3/12) Removing postgresql-plpython-9.6-1.1.noarch …[done]
( 4/12) Removing postgresql-server-9.6-1.1.noarch …[done]
( 5/12) Removing postgresql94-contrib-9.4.15-15.1.x86_64 …[done]
( 6/12) Removing postgresql96-contrib-9.6.7-12.1.x86_64 …[done]
( 7/12) Removing postgresql96-plpython-9.6.7-12.1.x86_64 …[done]
( 8/12) Removing postgresql94-server-9.4.15-15.1.x86_64 …[done]
( 9/12) Removing postgresql96-server-9.6.7-12.1.x86_64 …[done]
Additional rpm output:
warning: directory /var/lib/pgsql: remove failed: Device or resource busy
Is what you just posted from somewhere else on the Internet or on your system?
Apt-get is not a command which should be executed on an openSUSE system.
If you are running apt-get somehow on your system, then I don’t know what to say and don’t know what you did on your system.
If you’d like to remove all psotgresql remnants from your system completely, this is my procedure…
Remove all your postgresql packages
zypper rm "postgre*"
install mlocate to be able to use the locate command
zypper in mlocate
To run locate, you first need to update its index/database of files on your system (It updates automatically every 24 hrs, but we’re not going to wait 24 hrs for first use)
updatedb
Search for all files on your system with “postgr” in the name. Remove any of the results you wish.
locate postgr
Your system should now be completely cleaned of any postresql related files you want removed, and can re-install <from the OSS>
First: You must have installed apt-get manually since ‘zypper’ is the preferred packagemanager.
Second: Do not treat your openSUSE system as if it is a Debian / *buntu system, take your time and learn about zypper.
Third: I have been using PostgreSQL as a database for the Kontact suite, both on Leap 42.3 and TW, without any of these issues
Fourth: Question: did you add extra repos? I’ve been horrified lately by the mess people can make of their packagecollection on *buntu when using the PPAs. Please show output of
zypper lr -d
And #5: Why don’t you use the stock PostgreSQL packages? Any reason for that?
I didn’t copy the output for other log files like /var/lib/pgsql/data/pg_log/postgresql-2018-03-05_130554.log and other anaconda files to keep the message shorter.
zypper lr -d
Output:
Repository priorities are without effect. All enabled repositories share the same priority.
| Alias | Name | Enabled | GPG Check | Refresh | Priority | Type | URI | Service
There is the package zypper-aptitude, which contains an “apt-get” as a wrapper for zypper.
I do have it installed here without remembering to install it manually…
It’s just a shell script that runs zypper with appropriate arguments though.
@wolfi
Thx. I’ve seen that apt-get zypper package but didn’t explore what it did or didn’t do.
Assume that if it’s “only a shell script” that everything is still managed by libzipp so the system is still OK.
@by79
First, if supported apt-get commands are only shell scripts for zypper/rpm commands, be aware that there will be subtle differences between apt-get on a debian based system and what you’ll find on an openSUSE system… The package management systems are very different.
From your output, it looks like you have Anaconda installed, so if you remove all postgresql related files, you may have to re-install your apps from Anaconda to restore those files.
It also looks like the “remove” command I gave you may not have worked, it looks like you may still have 3 postgresql versions on your system.
Run the following to verify if any postgresql packaes are still installed on your system…
zypper se -i postgres
If the above returns any results, then “zypper rm” them… and then run the “update” and “locate” commands again as before to doublecheck what still exists on your system.
The idea is that you should be able to remove files from your system faster and easier by removing packages, and then you can remove anything else manually. You should also know that removing packages generally does not remove configuration files, so if your problems are due to some kind of mis-configuration, removing packages and re-installing will not remove the problem.
Result
r3:~ # zypper se -i postgres
Retrieving repository ‘packman’ metadata …[done]
Building repository ‘packman’ cache …[done]
Retrieving repository ‘Packman Repository’ metadata …[done]
Building repository ‘Packman Repository’ cache …[done]
Retrieving repository ‘openSUSE-Leap-42.3-Update’ metadata …[done]
Building repository ‘openSUSE-Leap-42.3-Update’ cache …[done]
Loading repository data…
Reading installed packages…
No matching items found.
r3:~ # update
If ‘update’ is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf update
r3:~ # locate
locate: no pattern to search for specified
r3:~ #
so if your problems are due to some kind of mis-configuration,
Ordinarily,
When you remove or re-install an app, the configuration files are preserved.
That is the reason I suggested additional steps beyond uninstalling to use the locate utility to find and remaining folders that might contain those configuration files. Once you remove those files, only then an app re-install will install new, default configuration files as well.
But then again, these files reside in no more than a couple of folders, where no other data, programs, libraries live, other than postgresql’s, f.e. the anaconda folders ( that should never ever have been in /root ) and the pgsql folders. Do remove the contents of /root, the basics will be regenerated on reboot.
Nope,.It will not remove config files, logs, data. And this is by design. You wouldn’t want to loose your databases because they live in a folder the package created,
Re-reading the thread I see some things that bother me:
A Trash folder in /root/.local . This means that you have used desktop software as root for deleting files from root’s home folder which is /root. If you tried to run the desktop as root, don’t do that. Mainly for security reasons.
Why not execute something like the following one-liner ( copy and paste in a terminal window ) ? The remains of your postgresql install will be gone. Are you sure a postgresql db is what you need / want? If so, invest some time and energy to learn about the underlying OS, command line usage, before actually starting with a database. It will save time in the future and give you a better understanding of what you are doing,
A Trash folder in /root/.local . This means that you have used desktop software as root for deleting files from root’s home folder which is /root. If you tried to run the desktop as root, don’t do that. Mainly for security reasons.
Noted…learned about this during the anaconda installation
The remains of your postgresql install will be gone.
From the above, does it mean it is gone now?:\
Are you sure a postgresql db is what you need / want?
Not too sure but I realise that there will be things that will not be clear…and I build a simple computer to learn the ropes, and in case catastrophes occur…I can remove the anacondas if necessary…
sudo zypper in postgresql
Do I run this from root or one of the created account?