0

While troubleshooting another issue I noticed that in my Ubuntu 14.04 system there are two postgresql directories containing a postgresql.conf file:

  • /usr/share/postgresql
  • /etc/postgresql/9.3/main/

With the following directory structure:

$ tree -d /usr/share/postgresql
/usr/share/postgresql
├── 9.3
│   ├── extension
│   ├── man
│   │   ├── man1
│   │   └── man7
│   ├── timezonesets
│   └── tsearch_data
└── 9.4
    └── man
        ├── man1
        └── man7

... and:

$ tree -d /etc/postgresql/9.3/main/
/etc/postgresql/9.3/main/

With the postgresql.conf files residing in the following locations:

  • /usr/share/postgresql/9.3/postgresql.conf
  • /etc/postgresql/9.3/main/postgresql.conf

By using SHOW config_file; I have verified which configuration file my server is using:

postgres=# SHOW config_file;
               config_file                
------------------------------------------
/etc/postgresql/9.3/main/postgresql.conf
(1 row)

My question is why do I find the postgresql.conf file in two locations and is the above an indication of some unused installation or other unused artifacts I ought to purge?

2

Files below /usr/share/postgresql/ are supposed to be data files that are not meant to be edited. They are not live configuration files.

The FHS spec at https://wiki.debian.org/FilesystemHierarchyStandard defines /usr as:

/usr/

Secondary hierarchy for shareable, read-only data (formerly from UNIX source repository, now from UNIX system resources)
(files that are not-required to boot or rescue the system)

[...]

/usr/share/ : Architecture-independent (shared) data

[...]

On the other hand, files under /etc/postgresql/X.Y/main are the live configuration files for a PostgreSQL cluster named main with version X.Y, such as created by the command pg_createcluster. Each cluster (=each postgres instance) has its own postgresql.conf that is generated with it, as the other writable configuration and data files of that cluster.

Personally, on my Ubuntu 14.04, I don't find a postgresql.conf under /usr. There is however a template file at /usr/share/postgresql/9.3/postgresql.conf.sample, but note the .sample suffix.

That file belongs to the postgresql-9.3 package, as revealed by dpkg -S:

$ dpkg -S /usr/share/postgresql/9.3/postgresql.conf.sample
postgresql-9.3: /usr/share/postgresql/9.3/postgresql.conf.sample

It's also consistent with http://packages.ubuntu.com/trusty/amd64/postgresql-9.3/filelist

You may try dpkg -S postgresql.conf on your system and check if /usr/share/postgresql/9.3/postgresql.conf is part of the results, and if yes, to what package it belongs, and then what is the origin of that package. Maybe for some reason it's the same as the sample postgresql.conf, except it doesn't have the .sample suffix.

  • It's quite likely that I copied the postgresql.conf.sample file as postgresq.conf myself in the same directory (/usr/share/postgresql) erroneously thinking that I was meant to edit that file with my specific configurations. – Marcus Junius Brutus Dec 30 '15 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.