Thread: changing user id

changing user id

From
Russell Davie
Date:
Hi
I'm a bit of a noob with PostgreSQL and I hope this is the right list to ask this question...

When postgresql loads there is and error message:

postgres@XXXXX:~$ /etc/init.d/postgresql-7.4 start
chmod: changing permissions of `/var/run/postgresql': Operation not permitted
 * Starting PostgreSQL 7.4 database server:main
Error: Could not change user id                                     [fail]

The error message in start-up script /usr/share/postgresql-common/PgCommon.pm
Using Linux-Ubutu.

Reading the script suggests that the user to be a member of the "shadow" group, which is now done.
However, postgresql is still not starting and produces the same errors:

Are there special privileges that the "shadow" group has?

What should also be done to getting  postgresql working again?

TIA

Russell

Re: changing user id

From
Tom Lane
Date:
Russell Davie <rjrd@exemail.com.au> writes:
> postgres@XXXXX:~$ /etc/init.d/postgresql-7.4 start
> chmod: changing permissions of `/var/run/postgresql': Operation not permitted
>  * Starting PostgreSQL 7.4 database server:main
> Error: Could not change user id                                     [fail]

init scripts generally expect to be launched as root.  Perhaps
    sudo /etc/init.d/postgresql-7.4 start
would work better.  Actually, I believe that on modern systems
you're not really supposed to invoke an init script directly like
that at all, but instead through the "service" program; that is,
you should really be typing something like
    sudo /sbin/service postgresql-7.4 start

            regards, tom lane

Re: changing user id

From
Mark Kelly
Date:
On Tuesday 30 May 2006 03:57, Tom Lane wrote:
> Russell Davie <rjrd@exemail.com.au> writes:

> > hope this is the right list to ask this question...

You might have been better off on the Ubuntu list, but it's one of those
questions that could go either way :)

Here it is, in case you want to join up:
http://www.ubuntu.com/community/lists

> > postgres@XXXXX:~$ /etc/init.d/postgresql-7.4 start
> > chmod: changing permissions of `/var/run/postgresql': Operation not
> > permitted * Starting PostgreSQL 7.4 database server:main
> > Error: Could not change user id
> > [fail]
>
> init scripts generally expect to be launched as root.  Perhaps
>  sudo /etc/init.d/postgresql-7.4 start

That should fix the error above, as long as you run it from a user account
that is in the sudoers file (which the user postgres isn't on Ubuntu). Your
main user account will be.

> would work better.  Actually, I believe that on modern systems
> you're not really supposed to invoke an init script directly like
> that at all, but instead through the "service" program;

"service" is not part of the vanilla Ubuntu install (I've only seen it on
redhat-based systems). The first suggestion you made is the right one for
Ubuntu.

HTH

Mark


Re: changing user id

From
Russell Davie
Date:
On Tue, 30 May 2006 06:30:34 +0100
Mark Kelly <pgsql@wastedtimes.net> wrote:

> On Tuesday 30 May 2006 03:57, Tom Lane wrote:
> > Russell Davie <rjrd@exemail.com.au> writes:
>
> > > hope this is the right list to ask this question...
>
> You might have been better off on the Ubuntu list, but it's one of those
> questions that could go either way :)
>
> Here it is, in case you want to join up:
> http://www.ubuntu.com/community/lists

thanks, have done so


>
> > > postgres@XXXXX:~$ /etc/init.d/postgresql-7.4 start
> > > chmod: changing permissions of `/var/run/postgresql': Operation not
> > > permitted * Starting PostgreSQL 7.4 database server:main
> > > Error: Could not change user id
> > > [fail]
> >
> > init scripts generally expect to be launched as root.  Perhaps
> >  sudo /etc/init.d/postgresql-7.4 start
>
> That should fix the error above, as long as you run it from a user account
> that is in the sudoers file (which the user postgres isn't on Ubuntu). Your
> main user account will be.

PostgreSQL will not start for root user in Ubuntu or for a user who is listed in sudoers file

as root or as a sudoer:
XXX@XXXX:~$ sudo /etc/init.d/postgresql-7.4 start
 * Starting PostgreSQL 7.4 database server:main
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.                    [fail]

> > would work better.  Actually, I believe that on modern systems
> > you're not really supposed to invoke an init script directly like
> > that at all, but instead through the "service" program;
> "service" is not part of the vanilla Ubuntu install (I've only seen it on
> redhat-based systems). The first suggestion you made is the right one for
> Ubuntu.

The "service" is a feature of Red Hat based Linux distributions and not used by Ubuntu, which is based on Debian which
usesa different way to start processes. 
This script is what is started at boot up, and here I have done it at CLI to show the output of what happens at boot.

- Russell