Has anyone managed to run Postgresql?


I installed the postgresql and devpkg-postgresql through swupd but that didn’t actually create any postgres user nor ran any service. I tried to create both manually, but it wouldn’t launch (unknown error), so I’m guessing it did not install the required files (I have the required dependencies, including dev tools, openssl, i even installed database-basic to be sure).


I tried to follow the documentation on the postgres website for manual install from source but that did not work either (i did the short and long version of chapter 16 / installation). I managed to run make install and it did what it had to, but it did not create the user, and still no service running.

I tried to add the user manually through useradd (since their command lists adduser), and that did not return me a valid user either. I tried to start the service manually through systemctl but that returned an unknown error.

I sank a couple hours into this searching the deep internet for answer but couldn’t find any, has anyone managed to run postgres, tell me what I’m doing wrong please kind OG people of the linux community :slight_smile: (p.s. sorry about all my recent noobish inquiries on this forum, you are all too smart and kind!).

Even after : useradd postgres and passwd postgres I cannot su - postgres it says This account is currently not available. There is no postgres user in my /etc/passwd either. When i try to run useradd postgres again it tells me the user already exists. I tried to manualy add the user in my passwd file with the information copied from my ubuntu install of postgres but that didn’t work either.

I managed to su - postgres into my user after manually creating it in my passwd file and setting the password manually, but that did not solve any problem obviously.

My /var/lib/postgresql folder was also empty, manually creating it did not solve the problem either.


I’ll take a look into this… this certainly should be a lot smoother to get working.

If you start postgres (systemctl start postgres) it should create the db (if you look at the service you see it creating the datadir in /var/lib/pgsql/data by default). From there you should be able to modify the pg_hba.conf to enable login.

The postgres user (id: 30) is already present before the postgresql bundle is installed.

It’s not working - the initdb script isn’t ever reached.

Ugh badness X(. In the meantime @Logarithm you can systemctl start postgresql-install and then systemctl start postgresql. Sorry for the trouble =(.

1 Like

Thanks to @william.douglas’s keen eyes we found out that postgresql-install.service wasn’t properly getting ran. We’re fixing this so that in the future this won’t happen.

For your system, I recommend doing this (if you haven’t created any tables/databases yet, obviously):

# rm -rf /var/lib/pgsql
# systemctl start postgresql-install.service

BTW, the postgres user is always present on clearlinux, it is part of the OS default uid mapping, and therefore it won’t be dynamically added after a bundle-add.

1 Like

Thanks for the update guys, so I will delete the user I manually added in my passwd file.

Is there a place where we can request an update to PostgreSQL 11? 9.6 is missing some features. I’ve been running PostgreSQL in containers to get 11.

You can always open a ticket on our github issue tracker: https://github.com/clearlinux/distribution/issues/new/choose

I’m planning to build my own custom GIS stack bundle - there are some missing pieces in maker-gis and I need header files for the R packages I install. As I’ve noted elsewhere, user-installed R packages often require headers or libraries that may or may not be bundled in Clear Linux.

Updating postgresql is a little bit tricky because of db migrations. At this point my goal is to add postgres 11 in a way that can sit side by side with postgres 9.

That was my plan as well - it would be postgresql11 in my GIS stack to avoid conflicts. I’m tied up on some non-Clear projects till June 9, but once I get started on the bundle there’ll be a GitHub repo. See https://github.com/clearlinux/distribution/issues/765 for the motivating issue.

@ahkok I managed to setup the conf file correctly and now postgres is running, and my rust/rocket/diesel setup is working! Thank you!

I was wondering, since the user postgres is enabled by default, is there a way I can su - postgres? Right now I get error: This account is currently not available.

Thank you!

The account is a system account and those are by default not something you can log in to. There are some ways around it, most of them involve using sudo … For instance you can just do sudo -u postgres bash. However, I would recommend not using this method for normal maintenance - you should use the postgresql client instead.