Thread: PostgreSQL binaries under /usr/lib, why?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello Why are many postgres binaries in ubuntu under /usr/lib/postgresql? According to FHS-2.3, /usr/lib includes object files, libraries, and internal binaries that are not intended to be executed directly by users or shell scripts. Almost all postgres binaries used directly by users are under /usr/lib/postgresql I am just wondering because is not the first time we have to help ubuntu users having problems locating the postgres binaries. (Including myself the first time I installed postgres in a ubuntu machine) Is the future apt.postgresql.org service also going to use this directory for postgres binaries? Thanks in advance. regards, - -- Rafael Martinez Guerrero Center for Information Technology University of Oslo, Norway PGP Public Key: http://folk.uio.no/rafael/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAlEnPTUACgkQBhuKQurGihTTWQCdFu7A0mVY/pSPqo87+psGKl4D AQ0AnA/R5Gi9JSZyxdcUjT1Dk7Q9sk5q =3dJR -----END PGP SIGNATURE-----
On 22/02/2013 09:41, Rafael Martinez wrote: > Hello > > Why are many postgres binaries in ubuntu under > /usr/lib/postgresql? > > According to FHS-2.3, /usr/lib includes object files, libraries, > and internal binaries that are not intended to be executed directly > by users or shell scripts. > > Almost all postgres binaries used directly by users are under > /usr/lib/postgresql I think that's because the Debian/Ubuntu packages use pg_wrapper - for example, on my Debian machine, /usr/bin/psql is actually a symlink to /usr/share/postgresql-common/pg_wrapper, which then calls /usr/lib/postgresql/9.1/bin/psql. This mechanism allows you to have multiple versions of PG, as well as multiple instances of the same version, installed side-by-side, and you specify the one you want with the --cluster option, which pg_wrapper understands - psql --cluster 9.1/main [....] - and in my (limited) experience it works really well. > I am just wondering because is not the first time we have to help > ubuntu users having problems locating the postgres binaries. > (Including myself the first time I installed postgres in a ubuntu > machine) > > Is the future apt.postgresql.org service also going to use this > directory for postgres binaries? It does already - my installation comes from apt.postgresql.org. HTH, Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/22/2013 12:40 PM, Stuart Bishop wrote: > On Fri, Feb 22, 2013 at 4:41 PM, Rafael Martinez > <r.m.guerrero@usit.uio.no> wrote: >> According to FHS-2.3, /usr/lib includes object files, libraries, >> and internal binaries that are not intended to be executed >> directly by users or shell scripts. > > Right. This is why wrappers are installed in /usr/bin that invoke > the correct version of the executable when it is known (and a > default version when it isn't, such as when you are connecting to a > remote server). You shouldn't need to invoke anything from /usr/lib > directly, unless you are doing something particularly low level. > Thanks for the information. The confusion occurs because not all binaries installed by postgres packages are available via /usr/bin and wrappers. i.e. pgbench, pg_archivecleanup, pg_upgrade, initdb and several others are not available via /usr/bin and they should not be defined as low level. Having *all* binaries installed by a postgres package accessible via /usr/bin and wrappers would make live easier for many users. regards, - -- Rafael Martinez Guerrero Center for Information Technology University of Oslo, Norway PGP Public Key: http://folk.uio.no/rafael/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAlEnXrUACgkQBhuKQurGihRk/ACfZdx4LkqDx5oMMJB6zvyNsY1w 3IsAn3Wkq2+1cpTTQCni4aN7sMJMc03n =jXN7 -----END PGP SIGNATURE-----
On Fri, Feb 22, 2013 at 4:41 PM, Rafael Martinez <r.m.guerrero@usit.uio.no> wrote: > Why are many postgres binaries in ubuntu under /usr/lib/postgresql? They are under /usr/lib/postgresql/${VERSION}/bin. This allows multiple PostgreSQL versions to coexist on the same Debian or Ubuntu server. > According to FHS-2.3, /usr/lib includes object files, libraries, and > internal binaries that are not intended to be executed directly by > users or shell scripts. Right. This is why wrappers are installed in /usr/bin that invoke the correct version of the executable when it is known (and a default version when it isn't, such as when you are connecting to a remote server). You shouldn't need to invoke anything from /usr/lib directly, unless you are doing something particularly low level. -- Stuart Bishop <stuart@stuartbishop.net> http://www.stuartbishop.net/
* Rafael Martinez (r.m.guerrero@usit.uio.no) wrote: > i.e. pgbench, pg_archivecleanup, pg_upgrade, initdb and several others > are not available via /usr/bin and they should not be defined as low > level. initdb is wrapped through pg_createcluster and friends. pg_archivecleanup probably isn't something you want to have changing under your existing installation, assuming you install it as archive_cleanup_command for a given PG version. pgbench is a bit of an oddball and I suppose it could go either way on that one. > Having *all* binaries installed by a postgres package accessible via > /usr/bin and wrappers would make live easier for many users. pg_ctl, initdb, etc, are handled through pg_createcluster and friends and using them independently will very likely cause a lot of grief for new users. In short, I'm pretty happy with the choices that Martin's made wrt what to wrap and how, though I do understand that it can be a bit jarring for advanced users who are coming from other distributions that don't have the same level of infrastructure that Ubuntu/Debian have, or for users who have been compiling from source. Thanks, Stephen