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

T.Michael Turney tmiket at recipes4linux.com
Tue Jan 17 14:53:04 UTC 2012


Quoting Patrick Kevin McCaffrey <pkm at uwm.edu>:

...

> 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."
>

Try adding this to config file:

lxc.cgroup.devices.allow = c 1:3 rwm

This allows the container to read/write/mknod
character device major 1, minor 3

tmike at tmike-Inspiron-1464:~/lxc/oneiric$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 2012-01-13 13:45 /dev/null

This should take care of the

"sh: cannot create /dev/null: Permission denied

Not sure about the postgres error, is it installed in container?

> 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
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
>





More information about the lxc-users mailing list