[Lxc-users] PostgreSQL - "sh: cannot create /dev/null: Permission denied" - LXC Issue?

Patrick Kevin McCaffrey pkm at uwm.edu
Tue Jan 17 07:47:39 UTC 2012


Sorry for the long delay, but the holidays and school got in the way.  I originally thought this was originally a PostgreSQL problem (or so I thought), but it seems to be an LXC one now.  Anyway, I've added "lxc.utsname" to my containters' configuration files, as suggested by another user.  I'm still left with the same problem that I had before.  I have one container set up (email) which run perfectly, and I'm working on a database container, but when I run:

"/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data"

to set up my database, it errors out with:

"sh: cannot create /dev/null: Permission denied
fgets failure: Success
The program "postgres" is needed by initdb but was not found in the
same directory as "/usr/local/pgsql/bin/initdb".
Check your installation."

I tried adding sudo privileges for user "postgres" but then I get "initdb: cannot be run as root"

I can attach logs and config files as necessary.  I'm kind of at a dead end here.

Thanks in advance,

Pat


----- Original Message -----
From: "Guido Jäkel" <G.Jaekel at dnb.de>
To: "Patrick Kevin McCaffrey" <pkm at uwm.edu>, "lxc-users" <lxc-users at lists.sourceforge.net>
Sent: Tuesday, December 20, 2011 2:06:49 AM
Subject: Re: [Lxc-users] PostgreSQL - "sh: cannot create /dev/null: Permission denied" - LXC Issue?

Dear Patrick,

As I understand /dev/null isn't writable in your container. That's definitely a wrong configuration.

Please check, that there is a real device node for  /dev/null  (and others) in your container and you have it (and others) in the lxc device access control list (lxc.cgroup.devices.allow = c 1:3 rw)

Note that -- depending on the linux flavor in your LXC container -- you might have to populate /dev by your own, because it's not reasonable to run udev or something like this inside a container.

Greetings

Guido




More information about the lxc-users mailing list