How to give postgres snap access to my data?

I installed the postgres10.4 snap and I want to start it with a certain data directory where the database is located. But I fail to do that.

postgresql10.postgres -D ~/db/data
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
postgres: could not access directory "/home/tk/db/data": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.

I tried several ways and I seem to not understand some concepts here. Also no documentation on the snaps webpage.

I tried to be smart by letting it create a db itself and search for it, but this also failed.

postgresql10.initdb -D test_pg
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
The files belonging to this database system will be owned by user ā€œtkā€.
This user must also own the server process.

fd test_pg /

fd found nothing

Ok, I found /home/tk/snap/postgresql10/current and indeed, if I create a folder there, I can try to start the DB from that.

But I can not copy my DB into that folder as it is too big and on another partition.

I tried a symbolic link, but seems like snap just ignored itā€¦ So still no solution.

Why donā€™t you install postgresql 13.4-1 from the normal Manjaro repo?

I found a solution. Apparently snap only allows access to paritions that are mounted under /home/
So I mounted the partition there and then the symbolic links mentioned above did work.

But then I got other issues, the locale was not set and the db still didnā€™t start up, so I ended up compiling the source myself, which luckily was staight forward.

Download & extract src
./configure
make
make install
useradd -m postgres

1 Like

I need that version

Then simply remove the SNAP version, and install the ā€˜regularā€™ one.

I did not find 10.4 in the repos other than as snap. Even with the downgrade tool I could only go as low as 11

Oh, I see, you meant ā€œThe reason I dont use the repo package is because I need a different versionā€, not ā€œyes, I need the version in the repositoriesā€

ā€¦ soā€¦ why do you need an outdated version ?

Itā€™s a weird fetish of mine. Ever since Ubuntu 10.4 Iā€™m drawn to that version number :heart_eyes:

Joke aside. I need to do some upgrade tests on an existing serverā€™s database that runs on that version.

Then it would make more sense to use docker instead of snap. Or does your server also run the snap version of postgres?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.