3

Trying to start postgresql on a Virtualbox VM managed by Vagrant I have the following error:

LOG:  could not link file "pg_xlog/xlogtemp.29" to "pg_xlog/000000010000000000000001" (initialization of log file): Operation not permitted
FATAL:  could not open file "pg_xlog/000000010000000000000001": No such file or directory

```

Thomasleveil
  • 441
  • 5
  • 14

2 Answers2

5

This happens when the data directory of postgresql is in a Vagrant shared folder (/vagrant for instance), and the Vagrant host is Windows. In that case permissions cannot be set the unix way.

Move that folder to another location (the home dir of the vagrant user for instance) and postgresql will start.

Solution found at: https://gitlab.com/gitlab-org/gitlab-development-kit/issues/20

womble
  • 96,255
  • 29
  • 175
  • 230
Thomasleveil
  • 441
  • 5
  • 14
3

The underlying cause for this is that vboxsf does not support filesystem links (neither hard nor symbolic). You can reproduce the issue by mounting a host folder inside a VirtualBox guest and trying to do the following: ln /path/to/mounted/share/existingfile.txt /some/path/link-to-file.txt

for example (with /var/data mounted as a vboxsf share) jim@a55a005fc5a5:/~ ln /var/data/foo.txt ~/data/link-to-foo ln: failed to create hard link ‘/users/jim/data/link-to-foo’ => ‘/var/data/foo.txt’: Operation not permitted

There are numerous tickets for this at virtualbox.org (#818, #10085) but seeing as they go back 7 years, it might be another while yet before it's fixed!

Jim Riordan
  • 131
  • 2