PostgreSQL 10 Does Not Start Under Ubuntu 18.04












2















In my fresh Ubuntu 18.04 --



$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic


Installed PostgreSQL 10 --



$ apt list --installed | grep -i postgres
postgresql-client-10/bionic,now 10.3-1 amd64 [installed]
postgresql-client-common/bionic,bionic,now 190 all [installed,automatic]
postgresql-common/bionic,bionic,now 190 all [installed,automatic]
postgresql-server-dev-10/bionic,now 10.3-1 amd64 [installed]
postgresql-server-dev-all/bionic,bionic,now 190 all [installed]


Both service and systemctl return immediately with no message but didn't start any postgres process --



$ sudo service postgresql restart
$ sudo systemctl restart postgresql


I'm completely at dark as there's neither conf nor log --



$ ll /etc/postgresql
total 8
drwxr-xr-x 2 root root 4096 Feb 8 12:26 ./
drwxr-xr-x 95 root root 4096 May 6 04:11 ../

$ ll /var/log/postgresql/
total 8
drwxrwxr-t 2 root postgres 4096 Feb 8 12:26 ./
drwxrwxr-x 10 root syslog 4096 May 6 04:10 ../


What is going on there? Any pointer will be much appreciated.



Edit: to make things worse, PostgreSQL 10 is the only listed package in Ubuntu 18.04, there's no obvious "apt" way to install older version of PostgreSQL










share|improve this question

























  • Have you looked at the output from systemctl status postgresql?

    – dsstorefile1
    May 6 '18 at 6:50






  • 1





    $ sudo systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2018-05-06 06:19:47 UTC; 2h 13min ago Process: 15349 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 15349 (code=exited, status=0/SUCCESS) May 06 06:19:47 myapp systemd[1]: Starting PostgreSQL RDBMS... May 06 06:19:47 myapp systemd[1]: Started PostgreSQL RDBMS.

    – Jerry Ji
    May 6 '18 at 8:34








  • 1





    Who/Why downvoted this question?

    – Jerry Ji
    May 6 '18 at 8:38
















2















In my fresh Ubuntu 18.04 --



$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic


Installed PostgreSQL 10 --



$ apt list --installed | grep -i postgres
postgresql-client-10/bionic,now 10.3-1 amd64 [installed]
postgresql-client-common/bionic,bionic,now 190 all [installed,automatic]
postgresql-common/bionic,bionic,now 190 all [installed,automatic]
postgresql-server-dev-10/bionic,now 10.3-1 amd64 [installed]
postgresql-server-dev-all/bionic,bionic,now 190 all [installed]


Both service and systemctl return immediately with no message but didn't start any postgres process --



$ sudo service postgresql restart
$ sudo systemctl restart postgresql


I'm completely at dark as there's neither conf nor log --



$ ll /etc/postgresql
total 8
drwxr-xr-x 2 root root 4096 Feb 8 12:26 ./
drwxr-xr-x 95 root root 4096 May 6 04:11 ../

$ ll /var/log/postgresql/
total 8
drwxrwxr-t 2 root postgres 4096 Feb 8 12:26 ./
drwxrwxr-x 10 root syslog 4096 May 6 04:10 ../


What is going on there? Any pointer will be much appreciated.



Edit: to make things worse, PostgreSQL 10 is the only listed package in Ubuntu 18.04, there's no obvious "apt" way to install older version of PostgreSQL










share|improve this question

























  • Have you looked at the output from systemctl status postgresql?

    – dsstorefile1
    May 6 '18 at 6:50






  • 1





    $ sudo systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2018-05-06 06:19:47 UTC; 2h 13min ago Process: 15349 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 15349 (code=exited, status=0/SUCCESS) May 06 06:19:47 myapp systemd[1]: Starting PostgreSQL RDBMS... May 06 06:19:47 myapp systemd[1]: Started PostgreSQL RDBMS.

    – Jerry Ji
    May 6 '18 at 8:34








  • 1





    Who/Why downvoted this question?

    – Jerry Ji
    May 6 '18 at 8:38














2












2








2


3






In my fresh Ubuntu 18.04 --



$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic


Installed PostgreSQL 10 --



$ apt list --installed | grep -i postgres
postgresql-client-10/bionic,now 10.3-1 amd64 [installed]
postgresql-client-common/bionic,bionic,now 190 all [installed,automatic]
postgresql-common/bionic,bionic,now 190 all [installed,automatic]
postgresql-server-dev-10/bionic,now 10.3-1 amd64 [installed]
postgresql-server-dev-all/bionic,bionic,now 190 all [installed]


Both service and systemctl return immediately with no message but didn't start any postgres process --



$ sudo service postgresql restart
$ sudo systemctl restart postgresql


I'm completely at dark as there's neither conf nor log --



$ ll /etc/postgresql
total 8
drwxr-xr-x 2 root root 4096 Feb 8 12:26 ./
drwxr-xr-x 95 root root 4096 May 6 04:11 ../

$ ll /var/log/postgresql/
total 8
drwxrwxr-t 2 root postgres 4096 Feb 8 12:26 ./
drwxrwxr-x 10 root syslog 4096 May 6 04:10 ../


What is going on there? Any pointer will be much appreciated.



Edit: to make things worse, PostgreSQL 10 is the only listed package in Ubuntu 18.04, there's no obvious "apt" way to install older version of PostgreSQL










share|improve this question
















In my fresh Ubuntu 18.04 --



$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic


Installed PostgreSQL 10 --



$ apt list --installed | grep -i postgres
postgresql-client-10/bionic,now 10.3-1 amd64 [installed]
postgresql-client-common/bionic,bionic,now 190 all [installed,automatic]
postgresql-common/bionic,bionic,now 190 all [installed,automatic]
postgresql-server-dev-10/bionic,now 10.3-1 amd64 [installed]
postgresql-server-dev-all/bionic,bionic,now 190 all [installed]


Both service and systemctl return immediately with no message but didn't start any postgres process --



$ sudo service postgresql restart
$ sudo systemctl restart postgresql


I'm completely at dark as there's neither conf nor log --



$ ll /etc/postgresql
total 8
drwxr-xr-x 2 root root 4096 Feb 8 12:26 ./
drwxr-xr-x 95 root root 4096 May 6 04:11 ../

$ ll /var/log/postgresql/
total 8
drwxrwxr-t 2 root postgres 4096 Feb 8 12:26 ./
drwxrwxr-x 10 root syslog 4096 May 6 04:10 ../


What is going on there? Any pointer will be much appreciated.



Edit: to make things worse, PostgreSQL 10 is the only listed package in Ubuntu 18.04, there's no obvious "apt" way to install older version of PostgreSQL







postgresql ubuntu-18.04






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 6 '18 at 6:37







Jerry Ji

















asked May 6 '18 at 6:27









Jerry JiJerry Ji

1814




1814













  • Have you looked at the output from systemctl status postgresql?

    – dsstorefile1
    May 6 '18 at 6:50






  • 1





    $ sudo systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2018-05-06 06:19:47 UTC; 2h 13min ago Process: 15349 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 15349 (code=exited, status=0/SUCCESS) May 06 06:19:47 myapp systemd[1]: Starting PostgreSQL RDBMS... May 06 06:19:47 myapp systemd[1]: Started PostgreSQL RDBMS.

    – Jerry Ji
    May 6 '18 at 8:34








  • 1





    Who/Why downvoted this question?

    – Jerry Ji
    May 6 '18 at 8:38



















  • Have you looked at the output from systemctl status postgresql?

    – dsstorefile1
    May 6 '18 at 6:50






  • 1





    $ sudo systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2018-05-06 06:19:47 UTC; 2h 13min ago Process: 15349 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 15349 (code=exited, status=0/SUCCESS) May 06 06:19:47 myapp systemd[1]: Starting PostgreSQL RDBMS... May 06 06:19:47 myapp systemd[1]: Started PostgreSQL RDBMS.

    – Jerry Ji
    May 6 '18 at 8:34








  • 1





    Who/Why downvoted this question?

    – Jerry Ji
    May 6 '18 at 8:38

















Have you looked at the output from systemctl status postgresql?

– dsstorefile1
May 6 '18 at 6:50





Have you looked at the output from systemctl status postgresql?

– dsstorefile1
May 6 '18 at 6:50




1




1





$ sudo systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2018-05-06 06:19:47 UTC; 2h 13min ago Process: 15349 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 15349 (code=exited, status=0/SUCCESS) May 06 06:19:47 myapp systemd[1]: Starting PostgreSQL RDBMS... May 06 06:19:47 myapp systemd[1]: Started PostgreSQL RDBMS.

– Jerry Ji
May 6 '18 at 8:34







$ sudo systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2018-05-06 06:19:47 UTC; 2h 13min ago Process: 15349 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 15349 (code=exited, status=0/SUCCESS) May 06 06:19:47 myapp systemd[1]: Starting PostgreSQL RDBMS... May 06 06:19:47 myapp systemd[1]: Started PostgreSQL RDBMS.

– Jerry Ji
May 6 '18 at 8:34






1




1





Who/Why downvoted this question?

– Jerry Ji
May 6 '18 at 8:38





Who/Why downvoted this question?

– Jerry Ji
May 6 '18 at 8:38










5 Answers
5






active

oldest

votes


















3














From the result of apt list --installed you don't have a PostgreSQL 10 server actually installed.



The name of the package is exactly postgresql-10 :
https://packages.ubuntu.com/bionic/database/postgresql-10 . You should install that package.



The lack of error of systemctl and the fact that a postgresql service does exist are confusing: it's because postgresql is an "umbrella" service that launches every postgresql instance installed and configured. In your case you currently have zero such instance, but that's fine as far as the postgresql service is concerned. In the most general case, you may have several different versions of PostgreSQL running concurrently (from different packages postgresql-<version>), and several instances of the same version too (from the same package).



I'd suggest to check your PostgreSQL instances with pg_lsclusters rather than systemctl. See also pg_ctlcluster to control them.






share|improve this answer































    1














    05/13/2018



    DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions. PS: If you have been tampering with the language settings lately, please tell me, because there may be a connection with the postgres failure



    Yesterday I was having the exact same problem, and nobody on the entire internet could help me, so I went rogue... And it worked!



    First and foremost, if you have any database with data you are interested in keeping, I cant help you there; you will have to figure out a way to backup all your data.



    Now onto the actual steps (this is exactly what I did, the steps between [ ] you may skip):




    sudo apt remove --purge postgres*
    [ sudo apt remove --purge pg* ]

    sudo apt autoremove

    sudo apt autoclean

    sudo apt clean
    [ sudo find / -name "*postgres*" -type f -delete ] -> this may delete any backups




    Now make sure you have this line in /etc/apt/sources.list




    deb http://cz.archive.ubuntu.com/ubuntu bionic main




    If you don't, just add it... Lets continue:




    sudo apt update

    sudo apt upgrade

    sudo apt install -y postgresql-10 postgresql-contrib postgresql-client
    [ sudo apt install -y postgresql-server pgadmin3 ] -> this you may need for metasploit
    [ sudo reboot ]




    Now you have to check if the necessary directories were created:
    /etc/postgresql/10/main -> config files
    /usr/lib/postgresql/10/bin -> scripts & executables
    /var/run/postgresql -> temporary files
    /var/lib/postgresql/10/main -> folders



    If any of those don't exist, I cant help you. You also need to make sure the user postgres exists Lets continue:




    sudo chown root /usr/lib/postgresql -R

    sudo chgrp root /usr/lib/postgresql -R

    sudo chmod 755 /usr/lib/postgresql -R




    Now go edit /etc/environment and add this to the PATH: /usr/lib/postgresql/10/bin




    sudo chown postgres /etc/postgresql -R

    sudo chgrp postgres /etc/postgresql -R

    sudo chmod 700 /etc/postgresql -R



    sudo echo "" > /etc/postgresql/10/main/postgresql.log

    sudo chown postgresql /etc/postgresql/10/main/postgresql.log

    sudo chgrp postgresql /etc/postgresql/10/main/postgresql.log

    sudo chmod 700 /etc/postgresql/10/main/postgresql.log



    sudo mkdir /var/run/postgresql/10-main.pg_stat_tmp

    sudo chown postgres /var/run/postgresql/10-main.pg_stat_tmp -R

    sudo chgrp postgres /var/run/postgresql/10-main.pg_stat_tmp -R

    sudo chmod 700 /var/run/postgresql/10-main.pg_stat_tmp -R






    Create /var/lib/postgresql/.bashrc and write this to it



    shopt -s histappend
    HISTSIZE=1000
    HISTFILESIZE=2000
    shopt -s checkwinsize
    case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
    esac
    force_color_prompt=yes
    if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    color_prompt=yes
    else
    color_prompt=
    fi
    fi
    if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
    else
    PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
    fi
    unset color_prompt force_color_prompt
    if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
    fi
    alias ll='ls -alF'
    alias la='ls -A'
    alias l='ls -CF'
    if ! shopt -oq posix; then
    if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
    elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
    fi
    fi
    source /etc/environment


    And then:




    sudo chown postgresql /var/lib/postgresql/.bashrc

    sudo chgrp postgresql /var/lib/postgresql/.bashrc

    sudo chmod 664 /var/lib/postgresql/.bashrc
    [ sudo reboot ]






    And now for the final part:




    sudo su

    su postgresql




    To start postgresql:




    pg_ctl start -D /etc/postgresql/10/main -l /etc/postgresql/10/main/postgresql.log




    To end it:




    kill $(cat /var/run/postgresql/10-main.pid)




    Basic configuration (enter the postgresql interpreter):




    psql




    du+ -> list postgresql users
    l -> list postgresql databases
    createuser and dropuser -> self explanatory
    createdb and dropdb -> self explanatory





    EXTRA: METASPLOIT



    If anyone reading this needs postgresql for metasploit, you can follow this link (its for 16.04 but works fine in 18.04), there is a mistake however: At some point, you will need to run this:
    rvm --default use ruby-${RUBY_VERSION}@metasploit-framework gem pristine --all
    Instead of the suggested:
    rvm --default use ruby-${RUByVERSION}@metasploit-framework



    Furthermore, if you run into trouble with the ruby bundle install part, this command may save your life: gem pristine --all






    share|improve this answer


























    • sudo apt remove --purge pg*

      – Jerry Ji
      May 14 '18 at 10:06











    • did you try it?

      – Mr.Robot
      May 14 '18 at 12:29











    • Yes, and that's how I caught your typo. BTW, thanks for your detailed steps, I wish I had enough reputation to up vote your answer

      – Jerry Ji
      May 15 '18 at 13:04













    • FYI to verify the installation using psql: sudo -u postgres psql postgres

      – Daniel
      Jun 9 '18 at 6:50



















    0














    Had the same issue here. Removed everything postgres related (apt remove --purge), deleted all remaining directories from postgres 9 and reinstalled postgres 10 again. Then config files under /etc/postgresql/ appeared and database could be started. HTH.






    share|improve this answer































      0














      DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions.



      Follow the answer provided by Mr Robot except recognize:




      • The user and group are postgres, so the commands should use chown -R postgres:postgres ...

      • I'm not sure what's up with /lib/systemd/system/postgresql.service although somehow /lib/systemd/system/postgresql@.service manages a PostgreSQL cluster? Either way I guess it was already running by the time I followed the instructions, and after reboot (which should be unnecessary?) it came back online, so I guess it works.






      share|improve this answer

































        0














        Just use



        service postgresql@10-main start


        and it works. Don't know exactly why this happens in 18.04 only (I verified 17.10 and it doesn't happen there), but the 'umbrella' seems unable to enumerate the installed instances.



        HTH,






        share|improve this answer























          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1320145%2fpostgresql-10-does-not-start-under-ubuntu-18-04%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          From the result of apt list --installed you don't have a PostgreSQL 10 server actually installed.



          The name of the package is exactly postgresql-10 :
          https://packages.ubuntu.com/bionic/database/postgresql-10 . You should install that package.



          The lack of error of systemctl and the fact that a postgresql service does exist are confusing: it's because postgresql is an "umbrella" service that launches every postgresql instance installed and configured. In your case you currently have zero such instance, but that's fine as far as the postgresql service is concerned. In the most general case, you may have several different versions of PostgreSQL running concurrently (from different packages postgresql-<version>), and several instances of the same version too (from the same package).



          I'd suggest to check your PostgreSQL instances with pg_lsclusters rather than systemctl. See also pg_ctlcluster to control them.






          share|improve this answer




























            3














            From the result of apt list --installed you don't have a PostgreSQL 10 server actually installed.



            The name of the package is exactly postgresql-10 :
            https://packages.ubuntu.com/bionic/database/postgresql-10 . You should install that package.



            The lack of error of systemctl and the fact that a postgresql service does exist are confusing: it's because postgresql is an "umbrella" service that launches every postgresql instance installed and configured. In your case you currently have zero such instance, but that's fine as far as the postgresql service is concerned. In the most general case, you may have several different versions of PostgreSQL running concurrently (from different packages postgresql-<version>), and several instances of the same version too (from the same package).



            I'd suggest to check your PostgreSQL instances with pg_lsclusters rather than systemctl. See also pg_ctlcluster to control them.






            share|improve this answer


























              3












              3








              3







              From the result of apt list --installed you don't have a PostgreSQL 10 server actually installed.



              The name of the package is exactly postgresql-10 :
              https://packages.ubuntu.com/bionic/database/postgresql-10 . You should install that package.



              The lack of error of systemctl and the fact that a postgresql service does exist are confusing: it's because postgresql is an "umbrella" service that launches every postgresql instance installed and configured. In your case you currently have zero such instance, but that's fine as far as the postgresql service is concerned. In the most general case, you may have several different versions of PostgreSQL running concurrently (from different packages postgresql-<version>), and several instances of the same version too (from the same package).



              I'd suggest to check your PostgreSQL instances with pg_lsclusters rather than systemctl. See also pg_ctlcluster to control them.






              share|improve this answer













              From the result of apt list --installed you don't have a PostgreSQL 10 server actually installed.



              The name of the package is exactly postgresql-10 :
              https://packages.ubuntu.com/bionic/database/postgresql-10 . You should install that package.



              The lack of error of systemctl and the fact that a postgresql service does exist are confusing: it's because postgresql is an "umbrella" service that launches every postgresql instance installed and configured. In your case you currently have zero such instance, but that's fine as far as the postgresql service is concerned. In the most general case, you may have several different versions of PostgreSQL running concurrently (from different packages postgresql-<version>), and several instances of the same version too (from the same package).



              I'd suggest to check your PostgreSQL instances with pg_lsclusters rather than systemctl. See also pg_ctlcluster to control them.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered May 11 '18 at 12:49









              Daniel VéritéDaniel Vérité

              97849




              97849

























                  1














                  05/13/2018



                  DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions. PS: If you have been tampering with the language settings lately, please tell me, because there may be a connection with the postgres failure



                  Yesterday I was having the exact same problem, and nobody on the entire internet could help me, so I went rogue... And it worked!



                  First and foremost, if you have any database with data you are interested in keeping, I cant help you there; you will have to figure out a way to backup all your data.



                  Now onto the actual steps (this is exactly what I did, the steps between [ ] you may skip):




                  sudo apt remove --purge postgres*
                  [ sudo apt remove --purge pg* ]

                  sudo apt autoremove

                  sudo apt autoclean

                  sudo apt clean
                  [ sudo find / -name "*postgres*" -type f -delete ] -> this may delete any backups




                  Now make sure you have this line in /etc/apt/sources.list




                  deb http://cz.archive.ubuntu.com/ubuntu bionic main




                  If you don't, just add it... Lets continue:




                  sudo apt update

                  sudo apt upgrade

                  sudo apt install -y postgresql-10 postgresql-contrib postgresql-client
                  [ sudo apt install -y postgresql-server pgadmin3 ] -> this you may need for metasploit
                  [ sudo reboot ]




                  Now you have to check if the necessary directories were created:
                  /etc/postgresql/10/main -> config files
                  /usr/lib/postgresql/10/bin -> scripts & executables
                  /var/run/postgresql -> temporary files
                  /var/lib/postgresql/10/main -> folders



                  If any of those don't exist, I cant help you. You also need to make sure the user postgres exists Lets continue:




                  sudo chown root /usr/lib/postgresql -R

                  sudo chgrp root /usr/lib/postgresql -R

                  sudo chmod 755 /usr/lib/postgresql -R




                  Now go edit /etc/environment and add this to the PATH: /usr/lib/postgresql/10/bin




                  sudo chown postgres /etc/postgresql -R

                  sudo chgrp postgres /etc/postgresql -R

                  sudo chmod 700 /etc/postgresql -R



                  sudo echo "" > /etc/postgresql/10/main/postgresql.log

                  sudo chown postgresql /etc/postgresql/10/main/postgresql.log

                  sudo chgrp postgresql /etc/postgresql/10/main/postgresql.log

                  sudo chmod 700 /etc/postgresql/10/main/postgresql.log



                  sudo mkdir /var/run/postgresql/10-main.pg_stat_tmp

                  sudo chown postgres /var/run/postgresql/10-main.pg_stat_tmp -R

                  sudo chgrp postgres /var/run/postgresql/10-main.pg_stat_tmp -R

                  sudo chmod 700 /var/run/postgresql/10-main.pg_stat_tmp -R






                  Create /var/lib/postgresql/.bashrc and write this to it



                  shopt -s histappend
                  HISTSIZE=1000
                  HISTFILESIZE=2000
                  shopt -s checkwinsize
                  case "$TERM" in
                  xterm-color|*-256color) color_prompt=yes;;
                  esac
                  force_color_prompt=yes
                  if [ -n "$force_color_prompt" ]; then
                  if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
                  color_prompt=yes
                  else
                  color_prompt=
                  fi
                  fi
                  if [ "$color_prompt" = yes ]; then
                  PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
                  else
                  PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
                  fi
                  unset color_prompt force_color_prompt
                  if [ -x /usr/bin/dircolors ]; then
                  test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
                  alias ls='ls --color=auto'
                  alias grep='grep --color=auto'
                  alias fgrep='fgrep --color=auto'
                  alias egrep='egrep --color=auto'
                  fi
                  alias ll='ls -alF'
                  alias la='ls -A'
                  alias l='ls -CF'
                  if ! shopt -oq posix; then
                  if [ -f /usr/share/bash-completion/bash_completion ]; then
                  . /usr/share/bash-completion/bash_completion
                  elif [ -f /etc/bash_completion ]; then
                  . /etc/bash_completion
                  fi
                  fi
                  source /etc/environment


                  And then:




                  sudo chown postgresql /var/lib/postgresql/.bashrc

                  sudo chgrp postgresql /var/lib/postgresql/.bashrc

                  sudo chmod 664 /var/lib/postgresql/.bashrc
                  [ sudo reboot ]






                  And now for the final part:




                  sudo su

                  su postgresql




                  To start postgresql:




                  pg_ctl start -D /etc/postgresql/10/main -l /etc/postgresql/10/main/postgresql.log




                  To end it:




                  kill $(cat /var/run/postgresql/10-main.pid)




                  Basic configuration (enter the postgresql interpreter):




                  psql




                  du+ -> list postgresql users
                  l -> list postgresql databases
                  createuser and dropuser -> self explanatory
                  createdb and dropdb -> self explanatory





                  EXTRA: METASPLOIT



                  If anyone reading this needs postgresql for metasploit, you can follow this link (its for 16.04 but works fine in 18.04), there is a mistake however: At some point, you will need to run this:
                  rvm --default use ruby-${RUBY_VERSION}@metasploit-framework gem pristine --all
                  Instead of the suggested:
                  rvm --default use ruby-${RUByVERSION}@metasploit-framework



                  Furthermore, if you run into trouble with the ruby bundle install part, this command may save your life: gem pristine --all






                  share|improve this answer


























                  • sudo apt remove --purge pg*

                    – Jerry Ji
                    May 14 '18 at 10:06











                  • did you try it?

                    – Mr.Robot
                    May 14 '18 at 12:29











                  • Yes, and that's how I caught your typo. BTW, thanks for your detailed steps, I wish I had enough reputation to up vote your answer

                    – Jerry Ji
                    May 15 '18 at 13:04













                  • FYI to verify the installation using psql: sudo -u postgres psql postgres

                    – Daniel
                    Jun 9 '18 at 6:50
















                  1














                  05/13/2018



                  DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions. PS: If you have been tampering with the language settings lately, please tell me, because there may be a connection with the postgres failure



                  Yesterday I was having the exact same problem, and nobody on the entire internet could help me, so I went rogue... And it worked!



                  First and foremost, if you have any database with data you are interested in keeping, I cant help you there; you will have to figure out a way to backup all your data.



                  Now onto the actual steps (this is exactly what I did, the steps between [ ] you may skip):




                  sudo apt remove --purge postgres*
                  [ sudo apt remove --purge pg* ]

                  sudo apt autoremove

                  sudo apt autoclean

                  sudo apt clean
                  [ sudo find / -name "*postgres*" -type f -delete ] -> this may delete any backups




                  Now make sure you have this line in /etc/apt/sources.list




                  deb http://cz.archive.ubuntu.com/ubuntu bionic main




                  If you don't, just add it... Lets continue:




                  sudo apt update

                  sudo apt upgrade

                  sudo apt install -y postgresql-10 postgresql-contrib postgresql-client
                  [ sudo apt install -y postgresql-server pgadmin3 ] -> this you may need for metasploit
                  [ sudo reboot ]




                  Now you have to check if the necessary directories were created:
                  /etc/postgresql/10/main -> config files
                  /usr/lib/postgresql/10/bin -> scripts & executables
                  /var/run/postgresql -> temporary files
                  /var/lib/postgresql/10/main -> folders



                  If any of those don't exist, I cant help you. You also need to make sure the user postgres exists Lets continue:




                  sudo chown root /usr/lib/postgresql -R

                  sudo chgrp root /usr/lib/postgresql -R

                  sudo chmod 755 /usr/lib/postgresql -R




                  Now go edit /etc/environment and add this to the PATH: /usr/lib/postgresql/10/bin




                  sudo chown postgres /etc/postgresql -R

                  sudo chgrp postgres /etc/postgresql -R

                  sudo chmod 700 /etc/postgresql -R



                  sudo echo "" > /etc/postgresql/10/main/postgresql.log

                  sudo chown postgresql /etc/postgresql/10/main/postgresql.log

                  sudo chgrp postgresql /etc/postgresql/10/main/postgresql.log

                  sudo chmod 700 /etc/postgresql/10/main/postgresql.log



                  sudo mkdir /var/run/postgresql/10-main.pg_stat_tmp

                  sudo chown postgres /var/run/postgresql/10-main.pg_stat_tmp -R

                  sudo chgrp postgres /var/run/postgresql/10-main.pg_stat_tmp -R

                  sudo chmod 700 /var/run/postgresql/10-main.pg_stat_tmp -R






                  Create /var/lib/postgresql/.bashrc and write this to it



                  shopt -s histappend
                  HISTSIZE=1000
                  HISTFILESIZE=2000
                  shopt -s checkwinsize
                  case "$TERM" in
                  xterm-color|*-256color) color_prompt=yes;;
                  esac
                  force_color_prompt=yes
                  if [ -n "$force_color_prompt" ]; then
                  if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
                  color_prompt=yes
                  else
                  color_prompt=
                  fi
                  fi
                  if [ "$color_prompt" = yes ]; then
                  PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
                  else
                  PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
                  fi
                  unset color_prompt force_color_prompt
                  if [ -x /usr/bin/dircolors ]; then
                  test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
                  alias ls='ls --color=auto'
                  alias grep='grep --color=auto'
                  alias fgrep='fgrep --color=auto'
                  alias egrep='egrep --color=auto'
                  fi
                  alias ll='ls -alF'
                  alias la='ls -A'
                  alias l='ls -CF'
                  if ! shopt -oq posix; then
                  if [ -f /usr/share/bash-completion/bash_completion ]; then
                  . /usr/share/bash-completion/bash_completion
                  elif [ -f /etc/bash_completion ]; then
                  . /etc/bash_completion
                  fi
                  fi
                  source /etc/environment


                  And then:




                  sudo chown postgresql /var/lib/postgresql/.bashrc

                  sudo chgrp postgresql /var/lib/postgresql/.bashrc

                  sudo chmod 664 /var/lib/postgresql/.bashrc
                  [ sudo reboot ]






                  And now for the final part:




                  sudo su

                  su postgresql




                  To start postgresql:




                  pg_ctl start -D /etc/postgresql/10/main -l /etc/postgresql/10/main/postgresql.log




                  To end it:




                  kill $(cat /var/run/postgresql/10-main.pid)




                  Basic configuration (enter the postgresql interpreter):




                  psql




                  du+ -> list postgresql users
                  l -> list postgresql databases
                  createuser and dropuser -> self explanatory
                  createdb and dropdb -> self explanatory





                  EXTRA: METASPLOIT



                  If anyone reading this needs postgresql for metasploit, you can follow this link (its for 16.04 but works fine in 18.04), there is a mistake however: At some point, you will need to run this:
                  rvm --default use ruby-${RUBY_VERSION}@metasploit-framework gem pristine --all
                  Instead of the suggested:
                  rvm --default use ruby-${RUByVERSION}@metasploit-framework



                  Furthermore, if you run into trouble with the ruby bundle install part, this command may save your life: gem pristine --all






                  share|improve this answer


























                  • sudo apt remove --purge pg*

                    – Jerry Ji
                    May 14 '18 at 10:06











                  • did you try it?

                    – Mr.Robot
                    May 14 '18 at 12:29











                  • Yes, and that's how I caught your typo. BTW, thanks for your detailed steps, I wish I had enough reputation to up vote your answer

                    – Jerry Ji
                    May 15 '18 at 13:04













                  • FYI to verify the installation using psql: sudo -u postgres psql postgres

                    – Daniel
                    Jun 9 '18 at 6:50














                  1












                  1








                  1







                  05/13/2018



                  DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions. PS: If you have been tampering with the language settings lately, please tell me, because there may be a connection with the postgres failure



                  Yesterday I was having the exact same problem, and nobody on the entire internet could help me, so I went rogue... And it worked!



                  First and foremost, if you have any database with data you are interested in keeping, I cant help you there; you will have to figure out a way to backup all your data.



                  Now onto the actual steps (this is exactly what I did, the steps between [ ] you may skip):




                  sudo apt remove --purge postgres*
                  [ sudo apt remove --purge pg* ]

                  sudo apt autoremove

                  sudo apt autoclean

                  sudo apt clean
                  [ sudo find / -name "*postgres*" -type f -delete ] -> this may delete any backups




                  Now make sure you have this line in /etc/apt/sources.list




                  deb http://cz.archive.ubuntu.com/ubuntu bionic main




                  If you don't, just add it... Lets continue:




                  sudo apt update

                  sudo apt upgrade

                  sudo apt install -y postgresql-10 postgresql-contrib postgresql-client
                  [ sudo apt install -y postgresql-server pgadmin3 ] -> this you may need for metasploit
                  [ sudo reboot ]




                  Now you have to check if the necessary directories were created:
                  /etc/postgresql/10/main -> config files
                  /usr/lib/postgresql/10/bin -> scripts & executables
                  /var/run/postgresql -> temporary files
                  /var/lib/postgresql/10/main -> folders



                  If any of those don't exist, I cant help you. You also need to make sure the user postgres exists Lets continue:




                  sudo chown root /usr/lib/postgresql -R

                  sudo chgrp root /usr/lib/postgresql -R

                  sudo chmod 755 /usr/lib/postgresql -R




                  Now go edit /etc/environment and add this to the PATH: /usr/lib/postgresql/10/bin




                  sudo chown postgres /etc/postgresql -R

                  sudo chgrp postgres /etc/postgresql -R

                  sudo chmod 700 /etc/postgresql -R



                  sudo echo "" > /etc/postgresql/10/main/postgresql.log

                  sudo chown postgresql /etc/postgresql/10/main/postgresql.log

                  sudo chgrp postgresql /etc/postgresql/10/main/postgresql.log

                  sudo chmod 700 /etc/postgresql/10/main/postgresql.log



                  sudo mkdir /var/run/postgresql/10-main.pg_stat_tmp

                  sudo chown postgres /var/run/postgresql/10-main.pg_stat_tmp -R

                  sudo chgrp postgres /var/run/postgresql/10-main.pg_stat_tmp -R

                  sudo chmod 700 /var/run/postgresql/10-main.pg_stat_tmp -R






                  Create /var/lib/postgresql/.bashrc and write this to it



                  shopt -s histappend
                  HISTSIZE=1000
                  HISTFILESIZE=2000
                  shopt -s checkwinsize
                  case "$TERM" in
                  xterm-color|*-256color) color_prompt=yes;;
                  esac
                  force_color_prompt=yes
                  if [ -n "$force_color_prompt" ]; then
                  if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
                  color_prompt=yes
                  else
                  color_prompt=
                  fi
                  fi
                  if [ "$color_prompt" = yes ]; then
                  PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
                  else
                  PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
                  fi
                  unset color_prompt force_color_prompt
                  if [ -x /usr/bin/dircolors ]; then
                  test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
                  alias ls='ls --color=auto'
                  alias grep='grep --color=auto'
                  alias fgrep='fgrep --color=auto'
                  alias egrep='egrep --color=auto'
                  fi
                  alias ll='ls -alF'
                  alias la='ls -A'
                  alias l='ls -CF'
                  if ! shopt -oq posix; then
                  if [ -f /usr/share/bash-completion/bash_completion ]; then
                  . /usr/share/bash-completion/bash_completion
                  elif [ -f /etc/bash_completion ]; then
                  . /etc/bash_completion
                  fi
                  fi
                  source /etc/environment


                  And then:




                  sudo chown postgresql /var/lib/postgresql/.bashrc

                  sudo chgrp postgresql /var/lib/postgresql/.bashrc

                  sudo chmod 664 /var/lib/postgresql/.bashrc
                  [ sudo reboot ]






                  And now for the final part:




                  sudo su

                  su postgresql




                  To start postgresql:




                  pg_ctl start -D /etc/postgresql/10/main -l /etc/postgresql/10/main/postgresql.log




                  To end it:




                  kill $(cat /var/run/postgresql/10-main.pid)




                  Basic configuration (enter the postgresql interpreter):




                  psql




                  du+ -> list postgresql users
                  l -> list postgresql databases
                  createuser and dropuser -> self explanatory
                  createdb and dropdb -> self explanatory





                  EXTRA: METASPLOIT



                  If anyone reading this needs postgresql for metasploit, you can follow this link (its for 16.04 but works fine in 18.04), there is a mistake however: At some point, you will need to run this:
                  rvm --default use ruby-${RUBY_VERSION}@metasploit-framework gem pristine --all
                  Instead of the suggested:
                  rvm --default use ruby-${RUByVERSION}@metasploit-framework



                  Furthermore, if you run into trouble with the ruby bundle install part, this command may save your life: gem pristine --all






                  share|improve this answer















                  05/13/2018



                  DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions. PS: If you have been tampering with the language settings lately, please tell me, because there may be a connection with the postgres failure



                  Yesterday I was having the exact same problem, and nobody on the entire internet could help me, so I went rogue... And it worked!



                  First and foremost, if you have any database with data you are interested in keeping, I cant help you there; you will have to figure out a way to backup all your data.



                  Now onto the actual steps (this is exactly what I did, the steps between [ ] you may skip):




                  sudo apt remove --purge postgres*
                  [ sudo apt remove --purge pg* ]

                  sudo apt autoremove

                  sudo apt autoclean

                  sudo apt clean
                  [ sudo find / -name "*postgres*" -type f -delete ] -> this may delete any backups




                  Now make sure you have this line in /etc/apt/sources.list




                  deb http://cz.archive.ubuntu.com/ubuntu bionic main




                  If you don't, just add it... Lets continue:




                  sudo apt update

                  sudo apt upgrade

                  sudo apt install -y postgresql-10 postgresql-contrib postgresql-client
                  [ sudo apt install -y postgresql-server pgadmin3 ] -> this you may need for metasploit
                  [ sudo reboot ]




                  Now you have to check if the necessary directories were created:
                  /etc/postgresql/10/main -> config files
                  /usr/lib/postgresql/10/bin -> scripts & executables
                  /var/run/postgresql -> temporary files
                  /var/lib/postgresql/10/main -> folders



                  If any of those don't exist, I cant help you. You also need to make sure the user postgres exists Lets continue:




                  sudo chown root /usr/lib/postgresql -R

                  sudo chgrp root /usr/lib/postgresql -R

                  sudo chmod 755 /usr/lib/postgresql -R




                  Now go edit /etc/environment and add this to the PATH: /usr/lib/postgresql/10/bin




                  sudo chown postgres /etc/postgresql -R

                  sudo chgrp postgres /etc/postgresql -R

                  sudo chmod 700 /etc/postgresql -R



                  sudo echo "" > /etc/postgresql/10/main/postgresql.log

                  sudo chown postgresql /etc/postgresql/10/main/postgresql.log

                  sudo chgrp postgresql /etc/postgresql/10/main/postgresql.log

                  sudo chmod 700 /etc/postgresql/10/main/postgresql.log



                  sudo mkdir /var/run/postgresql/10-main.pg_stat_tmp

                  sudo chown postgres /var/run/postgresql/10-main.pg_stat_tmp -R

                  sudo chgrp postgres /var/run/postgresql/10-main.pg_stat_tmp -R

                  sudo chmod 700 /var/run/postgresql/10-main.pg_stat_tmp -R






                  Create /var/lib/postgresql/.bashrc and write this to it



                  shopt -s histappend
                  HISTSIZE=1000
                  HISTFILESIZE=2000
                  shopt -s checkwinsize
                  case "$TERM" in
                  xterm-color|*-256color) color_prompt=yes;;
                  esac
                  force_color_prompt=yes
                  if [ -n "$force_color_prompt" ]; then
                  if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
                  color_prompt=yes
                  else
                  color_prompt=
                  fi
                  fi
                  if [ "$color_prompt" = yes ]; then
                  PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
                  else
                  PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
                  fi
                  unset color_prompt force_color_prompt
                  if [ -x /usr/bin/dircolors ]; then
                  test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
                  alias ls='ls --color=auto'
                  alias grep='grep --color=auto'
                  alias fgrep='fgrep --color=auto'
                  alias egrep='egrep --color=auto'
                  fi
                  alias ll='ls -alF'
                  alias la='ls -A'
                  alias l='ls -CF'
                  if ! shopt -oq posix; then
                  if [ -f /usr/share/bash-completion/bash_completion ]; then
                  . /usr/share/bash-completion/bash_completion
                  elif [ -f /etc/bash_completion ]; then
                  . /etc/bash_completion
                  fi
                  fi
                  source /etc/environment


                  And then:




                  sudo chown postgresql /var/lib/postgresql/.bashrc

                  sudo chgrp postgresql /var/lib/postgresql/.bashrc

                  sudo chmod 664 /var/lib/postgresql/.bashrc
                  [ sudo reboot ]






                  And now for the final part:




                  sudo su

                  su postgresql




                  To start postgresql:




                  pg_ctl start -D /etc/postgresql/10/main -l /etc/postgresql/10/main/postgresql.log




                  To end it:




                  kill $(cat /var/run/postgresql/10-main.pid)




                  Basic configuration (enter the postgresql interpreter):




                  psql




                  du+ -> list postgresql users
                  l -> list postgresql databases
                  createuser and dropuser -> self explanatory
                  createdb and dropdb -> self explanatory





                  EXTRA: METASPLOIT



                  If anyone reading this needs postgresql for metasploit, you can follow this link (its for 16.04 but works fine in 18.04), there is a mistake however: At some point, you will need to run this:
                  rvm --default use ruby-${RUBY_VERSION}@metasploit-framework gem pristine --all
                  Instead of the suggested:
                  rvm --default use ruby-${RUByVERSION}@metasploit-framework



                  Furthermore, if you run into trouble with the ruby bundle install part, this command may save your life: gem pristine --all







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited May 14 '18 at 14:35

























                  answered May 13 '18 at 23:26









                  Mr.RobotMr.Robot

                  1217




                  1217













                  • sudo apt remove --purge pg*

                    – Jerry Ji
                    May 14 '18 at 10:06











                  • did you try it?

                    – Mr.Robot
                    May 14 '18 at 12:29











                  • Yes, and that's how I caught your typo. BTW, thanks for your detailed steps, I wish I had enough reputation to up vote your answer

                    – Jerry Ji
                    May 15 '18 at 13:04













                  • FYI to verify the installation using psql: sudo -u postgres psql postgres

                    – Daniel
                    Jun 9 '18 at 6:50



















                  • sudo apt remove --purge pg*

                    – Jerry Ji
                    May 14 '18 at 10:06











                  • did you try it?

                    – Mr.Robot
                    May 14 '18 at 12:29











                  • Yes, and that's how I caught your typo. BTW, thanks for your detailed steps, I wish I had enough reputation to up vote your answer

                    – Jerry Ji
                    May 15 '18 at 13:04













                  • FYI to verify the installation using psql: sudo -u postgres psql postgres

                    – Daniel
                    Jun 9 '18 at 6:50

















                  sudo apt remove --purge pg*

                  – Jerry Ji
                  May 14 '18 at 10:06





                  sudo apt remove --purge pg*

                  – Jerry Ji
                  May 14 '18 at 10:06













                  did you try it?

                  – Mr.Robot
                  May 14 '18 at 12:29





                  did you try it?

                  – Mr.Robot
                  May 14 '18 at 12:29













                  Yes, and that's how I caught your typo. BTW, thanks for your detailed steps, I wish I had enough reputation to up vote your answer

                  – Jerry Ji
                  May 15 '18 at 13:04







                  Yes, and that's how I caught your typo. BTW, thanks for your detailed steps, I wish I had enough reputation to up vote your answer

                  – Jerry Ji
                  May 15 '18 at 13:04















                  FYI to verify the installation using psql: sudo -u postgres psql postgres

                  – Daniel
                  Jun 9 '18 at 6:50





                  FYI to verify the installation using psql: sudo -u postgres psql postgres

                  – Daniel
                  Jun 9 '18 at 6:50











                  0














                  Had the same issue here. Removed everything postgres related (apt remove --purge), deleted all remaining directories from postgres 9 and reinstalled postgres 10 again. Then config files under /etc/postgresql/ appeared and database could be started. HTH.






                  share|improve this answer




























                    0














                    Had the same issue here. Removed everything postgres related (apt remove --purge), deleted all remaining directories from postgres 9 and reinstalled postgres 10 again. Then config files under /etc/postgresql/ appeared and database could be started. HTH.






                    share|improve this answer


























                      0












                      0








                      0







                      Had the same issue here. Removed everything postgres related (apt remove --purge), deleted all remaining directories from postgres 9 and reinstalled postgres 10 again. Then config files under /etc/postgresql/ appeared and database could be started. HTH.






                      share|improve this answer













                      Had the same issue here. Removed everything postgres related (apt remove --purge), deleted all remaining directories from postgres 9 and reinstalled postgres 10 again. Then config files under /etc/postgresql/ appeared and database could be started. HTH.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered May 7 '18 at 7:56









                      user902416user902416

                      1




                      1























                          0














                          DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions.



                          Follow the answer provided by Mr Robot except recognize:




                          • The user and group are postgres, so the commands should use chown -R postgres:postgres ...

                          • I'm not sure what's up with /lib/systemd/system/postgresql.service although somehow /lib/systemd/system/postgresql@.service manages a PostgreSQL cluster? Either way I guess it was already running by the time I followed the instructions, and after reboot (which should be unnecessary?) it came back online, so I guess it works.






                          share|improve this answer






























                            0














                            DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions.



                            Follow the answer provided by Mr Robot except recognize:




                            • The user and group are postgres, so the commands should use chown -R postgres:postgres ...

                            • I'm not sure what's up with /lib/systemd/system/postgresql.service although somehow /lib/systemd/system/postgresql@.service manages a PostgreSQL cluster? Either way I guess it was already running by the time I followed the instructions, and after reboot (which should be unnecessary?) it came back online, so I guess it works.






                            share|improve this answer




























                              0












                              0








                              0







                              DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions.



                              Follow the answer provided by Mr Robot except recognize:




                              • The user and group are postgres, so the commands should use chown -R postgres:postgres ...

                              • I'm not sure what's up with /lib/systemd/system/postgresql.service although somehow /lib/systemd/system/postgresql@.service manages a PostgreSQL cluster? Either way I guess it was already running by the time I followed the instructions, and after reboot (which should be unnecessary?) it came back online, so I guess it works.






                              share|improve this answer















                              DISCLAIMER: This is for postgresql 10 and ubuntu 18.04, and may or may not work for other versions.



                              Follow the answer provided by Mr Robot except recognize:




                              • The user and group are postgres, so the commands should use chown -R postgres:postgres ...

                              • I'm not sure what's up with /lib/systemd/system/postgresql.service although somehow /lib/systemd/system/postgresql@.service manages a PostgreSQL cluster? Either way I guess it was already running by the time I followed the instructions, and after reboot (which should be unnecessary?) it came back online, so I guess it works.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Jun 9 '18 at 7:08

























                              answered Jun 9 '18 at 6:57









                              DanielDaniel

                              1115




                              1115























                                  0














                                  Just use



                                  service postgresql@10-main start


                                  and it works. Don't know exactly why this happens in 18.04 only (I verified 17.10 and it doesn't happen there), but the 'umbrella' seems unable to enumerate the installed instances.



                                  HTH,






                                  share|improve this answer




























                                    0














                                    Just use



                                    service postgresql@10-main start


                                    and it works. Don't know exactly why this happens in 18.04 only (I verified 17.10 and it doesn't happen there), but the 'umbrella' seems unable to enumerate the installed instances.



                                    HTH,






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      Just use



                                      service postgresql@10-main start


                                      and it works. Don't know exactly why this happens in 18.04 only (I verified 17.10 and it doesn't happen there), but the 'umbrella' seems unable to enumerate the installed instances.



                                      HTH,






                                      share|improve this answer













                                      Just use



                                      service postgresql@10-main start


                                      and it works. Don't know exactly why this happens in 18.04 only (I verified 17.10 and it doesn't happen there), but the 'umbrella' seems unable to enumerate the installed instances.



                                      HTH,







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jun 12 '18 at 9:19









                                      Patric BechtelPatric Bechtel

                                      1




                                      1






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Super User!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1320145%2fpostgresql-10-does-not-start-under-ubuntu-18-04%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                          Alcedinidae

                                          RAC Tourist Trophy