Installing Postgresql on Linux Friendlyarm

Started by Xiang Ganover 11 years ago8 messagesgeneral
Jump to latest
#1Xiang Gan
XiangGan@santaitech.com

Hi,

I'm newbie here so I'm sorry if this is posted in wrong place.

I tried to install Postgresql 9.2.9 on Linux Friendlyarm. The Postgresql
was cross compiled (use arm-linux-gcc 4.4.3) successfully on my desktop Ubuntu. Then it was moved to
Linux Friendlyarm environment. When I tried to start the Postgresql server, however,
it gives me the following errors:

LOG: could not create IPv4 socket: Permission denied
WARNING: could not create listen socket for "127.0.0.1"
FATAL: could not create any TCP/IP sockets

The kernel info. of my Linux friendlyarm is as follows:
Linux FriendlyARM 2.6.35.7-FriendlyARM #1 PREEMPT Thu Mar 1 17:38:57 HKT 2012 arm7l GNU/Linux.

Anyone could provide some help about this?
Thanks in advance!

Gerry

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Xiang Gan (#1)
Re: Installing Postgresql on Linux Friendlyarm

On 09/22/2014 01:22 AM, Xiang Gan wrote:

Hi,

I'm newbie here so I'm sorry if this is posted in wrong place.

I tried to install Postgresql 9.2.9 on Linux Friendlyarm. The Postgresql

was cross compiled (use arm-linux-gcc 4.4.3) successfully on my desktop
Ubuntu. Then it was moved to

Linux Friendlyarm environment. When I tried to start the Postgresql
server, however,

it gives me the following errors:

LOG: could not create IPv4 socket: Permission denied

WARNING: could not create listen socket for "127.0.0.1"

FATAL: could not create any TCP/IP sockets

The kernel info. of my Linux friendlyarm is as follows:

Linux FriendlyARM 2.6.35.7-FriendlyARM #1 PREEMPT Thu Mar 1 17:38:57 HKT
2012 arm7l GNU/Linux.

Anyone could provide some help about this?

The user you are running Postgres as does not the permissions to create
an IPv4 socket. I know nothing about Linux FriendlyArm, so I don't know
where to go from here. I would say ask the FriendlyArm forum, but I see
you have already done that.

Thanks in advance!

Gerry

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Xiang Gan
XiangGan@santaitech.com
In reply to: Adrian Klaver (#2)
Re: Installing Postgresql on Linux Friendlyarm

OK. So a stupid question, whether there is any possibility to run Postgresql as root? (I know this is forbidden generally. But what I find out is that in Linux FriendlyArm environment, root could create socket while non-root user does not have such privilege)

Kind regards,
Gerry

On 09/22/2014 01:22 AM, Xiang Gan wrote:

Hi,

I'm newbie here so I'm sorry if this is posted in wrong place.

I tried to install Postgresql 9.2.9 on Linux Friendlyarm. The Postgresql

was cross compiled (use arm-linux-gcc 4.4.3) successfully on my desktop
Ubuntu. Then it was moved to

Linux Friendlyarm environment. When I tried to start the Postgresql
server, however,

it gives me the following errors:

LOG: could not create IPv4 socket: Permission denied

WARNING: could not create listen socket for "127.0.0.1"

FATAL: could not create any TCP/IP sockets

The kernel info. of my Linux friendlyarm is as follows:

Linux FriendlyARM 2.6.35.7-FriendlyARM #1 PREEMPT Thu Mar 1 17:38:57 HKT
2012 arm7l GNU/Linux.

Anyone could provide some help about this?

The user you are running Postgres as does not the permissions to create
an IPv4 socket. I know nothing about Linux FriendlyArm, so I don't know
where to go from here. I would say ask the FriendlyArm forum, but I see
you have already done that.

Thanks in advance!

Gerry

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Xiang Gan (#3)
Re: Installing Postgresql on Linux Friendlyarm

Xiang Gan <XiangGan@santaitech.com> writes:

OK. So a stupid question, whether there is any possibility to run Postgresql as root? (I know this is forbidden generally. But what I find out is that in Linux FriendlyArm environment, root could create socket while non-root user does not have such privilege)

So, it's not so much FriendlyArm as StupidAndUselessArm? What sort of nut
would think that all network services should run as root?

The short answer to your question is that if you're so inclined, you
can easily find and dike out the no-root check in the server source
code. But the Postgres project never has and never will publish a
version with that check removed or compromised in any way, and we will
not provide support if you have any problems running the server that way.
We do not believe it's advisable to run network-accessible services
as root.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Abelard Hoffman
abelardhoffman@gmail.com
In reply to: Tom Lane (#4)
Re: Installing Postgresql on Linux Friendlyarm

On Mon, Sep 22, 2014 at 7:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Xiang Gan <XiangGan@santaitech.com> writes:

OK. So a stupid question, whether there is any possibility to run

Postgresql as root? (I know this is forbidden generally. But what I find
out is that in Linux FriendlyArm environment, root could create socket
while non-root user does not have such privilege)

Typically, applications open the port as root and then change to low
privilege for the actual service.
See also this thread:

http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l

#6Vick Khera
vivek@khera.org
In reply to: Abelard Hoffman (#5)
Re: Installing Postgresql on Linux Friendlyarm

On Tue, Sep 23, 2014 at 2:29 AM, Abelard Hoffman
<abelardhoffman@gmail.com> wrote:

Typically, applications open the port as root and then change to low
privilege for the actual service.
See also this thread:

http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l

Postgres does not use a privileged port, so this is not necessary.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#7Xiang Gan
XiangGan@santaitech.com
In reply to: Tom Lane (#4)
Re: Installing Postgresql on Linux Friendlyarm

Finally, I managed to run Postgresql in Linux FriendlyARM environment. It seems that Postgresql server starts to work, however, it prints out some WARNING info. during the start. The error info. is as follows:

LOG: could not resolve "localhost": Temporary failure in name resolution
LOG: disabling statistics collector for lack of working socket
WARNING: autovacuum not started because of misconfiguration
HINT: Enable the "track_counts" option.

So the above log indicates that autovacuum failed to start mainly due to the problem that "localhost" cannot be resolved as 127.0.0.1? But I can ping localhost from command line without any problem. My /etc/hosts file reads as:
127.0.0.1 localhost.localdomain localhost

In addition, options "autovacuum" and "track_counts" are turned on by default in postgresql.conf file. But in database, with command "show autovacuum", its value is shown as "on" while with command "show track_counts", its value is shown as "off".

Could anyone provide some hints about how to handle this kind of problem?

Kind regards,
Gerry

Xiang Gan <XiangGan@santaitech.com> writes:

OK. So a stupid question, whether there is any possibility to run Postgresql as root? (I know this is forbidden generally. But what I find out is that in Linux FriendlyArm environment, root could create socket while non-root user does not have such privilege)

So, it's not so much FriendlyArm as StupidAndUselessArm? What sort of nut
would think that all network services should run as root?

The short answer to your question is that if you're so inclined, you
can easily find and dike out the no-root check in the server source
code. But the Postgres project never has and never will publish a
version with that check removed or compromised in any way, and we will
not provide support if you have any problems running the server that way.
We do not believe it's advisable to run network-accessible services
as root.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#8Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Xiang Gan (#7)
Re: Installing Postgresql on Linux Friendlyarm

On 09/24/2014 11:34 PM, Xiang Gan wrote:

Finally, I managed to run Postgresql in Linux FriendlyARM environment. It seems that Postgresql server starts to work, however, it prints out some WARNING info. during the start. The error info. is as follows:

LOG: could not resolve "localhost": Temporary failure in name resolution
LOG: disabling statistics collector for lack of working socket
WARNING: autovacuum not started because of misconfiguration
HINT: Enable the "track_counts" option.

So the above log indicates that autovacuum failed to start mainly due to the problem that "localhost" cannot be resolved as 127.0.0.1? But I can ping localhost from command line without any problem. My /etc/hosts file reads as:
127.0.0.1 localhost.localdomain localhost

In addition, options "autovacuum" and "track_counts" are turned on by default in postgresql.conf file. But in database, with command "show autovacuum", its value is shown as "on" while with command "show track_counts", its value is shown as "off".

There is a cascading effect. The statistics collector needs a working
socket and autovacuum needs a working statistics collector, in
particular track_counts. You fix the socket/networking issues the other
issues should resolve.

Could anyone provide some hints about how to handle this kind of problem?

Well this going to depend greatly on what you did to get to this phrase
'I managed to run Postgresql in Linux FriendlyARM environment.'.

So a detailed explanation on how you got Postgres to sort of start would
be in order.

Kind regards,
Gerry

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general