From: Russell Davie <rjrd@exemail.com.au>
To: pgsql-admin@postgresql.org
Subject: Re: Error: Could not change user id
Date: Mon, 29 May 2006 14:25:15 +1000
Message-ID: <20060529142515.2da47049@localhost.localdomain> (raw)
In-Reply-To: <1271.1148864373@sss.pgh.pa.us>
References: <20060529093122.79854750@localhost.localdomain>
<1271.1148864373@sss.pgh.pa.us>
On Sun, 28 May 2006 20:59:33 -0400
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Russell Davie <rjrd@exemail.com.au> writes:
> > Manually starting postgresql by the user postgres:
> > postgres@XXXX:/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]
>
> There is no such error message anywhere in the PG 7.4 source code.
> I suppose it's coming out of whatever init script you're using;
> have you tried reading the init script for enlightenment?
>
Interesting! I never thought it could be the window manager.
This is still occurring using Metacity and it still happened in Enlightnement and WindowMaker and also at CLI without any window-manager at all!
> (FWIW, init scripts are almost always designed to be executed as
> root, not as random unprivileged users like postgres. sudo might
> help.)
>
> regards, tom lane
postgresql doesn't like been stared as root:
f
XX@XXXX:/etc/init.d$ sudo ./postgresql-7.4 start
Password:
* 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.
The PostgreSQL server failed to start. Please check the log output: [fail]
On doing a search on the disk using the terms: "Could not change user id"
located this in in line 467 of /usr/share/postgresql-common/PgCommon.pm
It seems this is checking the group and user of the process which suggests not getting settings correct.
Maybe this could help in showing where to correct this issue?
[CODE]
# Change effective and real user and group id. If the user id is member of the
# "shadow" group, then "shadow" will be in the set of effective groups. Exits
# with an error message if user/group ID cannot be changed.
# Arguments: <user id> <group id>
sub change_ugid {
my ($uid, $gid) = @_;
my $groups = $gid;
$groups .= " $groups"; # first additional group
# check whether owner is in the shadow group, and keep shadow privileges in
# this case; this is a poor workaround for the lack of initgroups().
my @shadowmembers = split /\s+/, ((getgrnam 'shadow')[3]);
for my $m (@shadowmembers) {
my $mid = getpwnam $m;
if ($mid == $uid) {
$groups .= ' ' . (getgrnam 'shadow');
last;
}
}
$( = $) = $groups;
$< = $> = $uid;
error 'Could not change user id' if $< != $uid;
error 'Could not change group id' if $( != $gid;
}
[/CODE]
regards
Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: rjrd@exemail.com.au
Subject: Re: Error: Could not change user id
In-Reply-To: <20060529142515.2da47049@localhost.localdomain>
References: <20060529093122.79854750@localhost.localdomain> <1271.1148864373@sss.pgh.pa.us> <20060529142515.2da47049@localhost.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox