Thread: Initdb fails on openwrt in "creating template1 database"

Initdb fails on openwrt in "creating template1 database"

From
Clemens Eisserer
Date:
Hi,

I try to run postgresql on my mips based openwrt router.
Although openwrt provides precompiled packages, I have troubles
initializing postgresql's file system:

# creating template1 database in /var/postgresql/data/base/1 ...
FATAL:  could not write to file "pg_xlog/xlogtemp.1791": No space left
on device

There are about 800mb free space on /, any idea what could be the problem here?
The only strange thing I noted was, that the openwrt package was
shipped without a postgresql.conf - whereas a default configuration is
part of both, SuSE and fedora packages.

Thank you in advance, Clemens

Re: Initdb fails on openwrt in "creating template1 database"

From
Scott Marlowe
Date:
On Thu, Dec 22, 2011 at 3:28 PM, Clemens Eisserer <linuxhippy@gmail.com> wrote:
> Hi,
>
> I try to run postgresql on my mips based openwrt router.
> Although openwrt provides precompiled packages, I have troubles
> initializing postgresql's file system:
>
> # creating template1 database in /var/postgresql/data/base/1 ...
> FATAL:  could not write to file "pg_xlog/xlogtemp.1791": No space left
> on device
>
> There are about 800mb free space on /, any idea what could be the problem here?

Could you be running out of file system nodes?

Re: Initdb fails on openwrt in "creating template1 database"

From
Clemens Eisserer
Date:
Hi,

>> There are about 800mb free space on /, any idea what could be the problem here?
>
> Could you be running out of file system nodes?

Don't think so - its a standard ext4 filesystem on a flush drive,
nothing special.
Also I've added about 128mb of swap space, so that shouldn't be an issue.

Just tried the same with a 2GB usb drive and got the same result :/


postgres@OpenWrt:~$ LC_COLLATE="C" initdb --pwprompt -D /var/postgres/data/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/postgres/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 12MB
creating configuration files ... ok
creating template1 database in /var/postgres/data/base/1 ... FATAL:
could not write to file "pg_xlog/xlogtemp.1385": No space left on
device
child process exited with exit code 1
initdb: removing contents of data directory "/var/postgres/data"

Any idea what could be wrong here?

Thanks, Clemems

Re: Initdb fails on openwrt in "creating template1 database"

From
Adrian Klaver
Date:
On Friday, December 23, 2011 1:58:38 am Clemens Eisserer wrote:
> Hi,

> Don't think so - its a standard ext4 filesystem on a flush drive,
> nothing special.
> Also I've added about 128mb of swap space, so that shouldn't be an issue.
>
> Just tried the same with a 2GB usb drive and got the same result :/
>
>

> creating template1 database in /var/postgres/data/base/1 ... FATAL:
> could not write to file "pg_xlog/xlogtemp.1385": No space left on
> device
> child process exited with exit code 1
> initdb: removing contents of data directory "/var/postgres/data"
>
> Any idea what could be wrong here?

Do you have more than one device mounted and if so are you sure you are working
on the right one?

>
> Thanks, Clemems

--
Adrian Klaver
adrian.klaver@gmail.com

Re: Initdb fails on openwrt in "creating template1 database"

From
Tom Lane
Date:
Clemens Eisserer <linuxhippy@gmail.com> writes:
> Any idea what could be wrong here?

Per-user disk space quota?

And I wouldn't be so hasty to dismiss the out-of-inodes theory, either.
There are not all that many ways to get an ENOSPC error.

            regards, tom lane

Re: Initdb fails on openwrt in "creating template1 database"

From
Ben Chobot
Date:
On Dec 23, 2011, at 1:58 AM, Clemens Eisserer wrote:

There are about 800mb free space on /, any idea what could be the problem here?

Could you be running out of file system nodes?

Don't think so - its a standard ext4 filesystem on a flush drive,
nothing special.
Also I've added about 128mb of swap space, so that shouldn't be an issue.

Just because you don't think you've done anything dumb doesn't mean you haven't configured something else to be dumb. What does df -i show?

Re: Initdb fails on openwrt in "creating template1 database"

From
Clemens Eisserer
Date:
Hi,

> Do you have more than one device mounted and if so are you sure you are working
> on the right one?

As often, the problem turned out to be a simple one.
With OpenWRT, /var is just a symlink to /tmp - which itself is located
on a ramdisk.

After moving the data-directory to /postgresql, everything worked as
expected (however made auto-vacuum less agressive to reduce writes to
the usb flash drive).
So I have now a perfectly fine working postgresql instance running on
a 35$ wlan router :)

Thanks for working on this great piece of software, Clemens