[Pkg-sysvinit-devel] Bug#694379: initscripts: Symlinking /dev/shm to /run/shm makes Oracle Database XE unable to start. Bind mount makes it work.

Roger Leigh rleigh at codelibre.net
Thu Nov 29 23:04:25 UTC 2012


On Thu, Nov 29, 2012 at 10:14:51PM +0000, Roger Leigh wrote:
> On Sun, Nov 25, 2012 at 11:45:48PM +0100, Jozsef Marton wrote:
> > After the transition to /run/shm from its previous location at /dev/shm, a symlink was created for compatibility reasons:
> > /dev/shm -> /run/shm
> > 
> > In this configuration Oracle Database 11g XE refuses to start with the following error message:
> > ORA-00845: MEMORY_TARGET not supported on this system
> > 
> > Bind mounting /run/shm to /dev/shm does the trick: Oracle starts properly.
> 
> How is Oracle testing for the presence of /dev/shm?  Their check is
> obviously broken, but it would be helpful to know what exactly they
> are doing.  strace would be useful here.

Just to double check that everything is working correctly, this is
a simple test program:

------------------------------------------------------------------
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

void fail(const char *msg, const char *err)
{
  fprintf(stderr, "E: %s: %s\n", msg, err);
  exit(1);
}

int main(void)
{
  int fd = shm_open("test_shm", O_CREAT|O_RDWR|O_EXCL|O_TRUNC, 0600);

  if (fd < 1)
    fail("shm_open", strerror(errno));

  if (write(fd, "Test\n", 4) < 0)
    fail("write", strerror(errno));

  if (shm_unlink("test_shm") < 0)
    fail("shm_unlink", strerror(errno));

  exit(0);
}
------------------------------------------------------------------

Build with
% gcc -o test test.c -lrt -g3 -Wall -Wextra

Trace:
% strace ./test 2>&1 | tail -n 4
open("/dev/shm/test_shm", O_RDWR|O_CREAT|O_EXCL|O_TRUNC|O_NOFOLLOW|O_CLOEXEC, 0600) = 3
write(3, "Test", 4)                     = 4
unlink("/dev/shm/test_shm")             = 0
exit_group(0)                           = ?

As you can see, this opens "test_shm", i.e. "/dev/shm/test_shm",
writes some data into it, and unlinks it.  If you remove the unlink
call and look in /run/shm (or /dev/shm), you'll see test_shm there.

This is just to demonstrate that the fundamental calls of the POSIX
SHM interface are indeed working correctly with /run/shm and /dev/shm
as a symlink to /run/shm.  It's all working entirely correctly.


Has this issue been brought up with Oracle?  Given that this looks like
a bug in Oracle, that's really where the problem needs to be fixed.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800



More information about the Pkg-sysvinit-devel mailing list