Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whilst installing Oracle 11gR2 Express Edition on Ubuntu 12.04 by following the Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 howto and have encountered the Oracle memory target problem with /dev/shm (as documented in section 7. of that guide) since /dev/shm is now implemented by default as a symbolic link as noted in the Ubuntu 11.10 release notes from /dev/shm to /run/shm. The symbolic link is incompatible with what Oracle expects and this results in an Oracle error (ORA-00845: MEMORY_TARGET) on database startup.

Section 7) of the 'Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 howto' documents a startup script /etc/init.d/oracle-shm that is meant to configure /dev/shm to use Ubuntu’s /run/shm, however this does not appear to have the desired effect on Ubuntu 12.04 and /dev/shm is not mounted as expected - presumably it did work on 11.10. Although this has already been noted and various solutions proposed I chose to work around the problem in a slightly different way by adding an entry to /etc/fstab and modifying the /etc/init.d/oracle-shm script as follows:

  1. Adding an entry for the shared memory temporary file system to /etc/fstab, say (for a 2 gigabyte file)

    shm /dev/shm    tmpfs   size=2g 0   0
  2. Changing the mount line in /etc/init.d/oracle-shm from:

    rm -f /dev/shm  
    mkdir /dev/shm
    mount -B /run/shm /dev/shm

    to simply

    rm -f /dev/shm
    mkdir /dev/shm 
    mount /dev/shm

Regardless, all the proposed solutions involve undoing the default Ubuntu behaviour at bootup, by first removing the symbolic link and then implementing the desired behaviour.

I would like to be able to setup the shared memory file system once and for all by:

  1. Adding an entry for the shared memory temporary file system to /etc/fstab, say (for a 2 gigabyte file)

    shm /dev/shm    tmpfs   size=2g 0   0
  2. Remove the existing symbolic link to /dev/shm and create as a directory, as sudo.

    rm –f /dev/shm
    mkdir /dev/shm
  3. Mounting the shared memory temporary file system

    mount /dev/shm

This all works fine until you reboot, at which point the symbolic link from /dev/shm to /run/shm re-appears instead of /dev/shm being mounted as a shared memory temporary file system.

Here’s the question then.

How can I modify the default behaviour of Ubuntu 12.04 (& 12.10) to prevent a symbolic link from /dev/shm to /run/shm ever being created in the first place on boot up?


share|improve this question
Note also… which rather moves and rebinds /dev/shm to /run/shm – David Fraser Sep 4 '15 at 7:17
up vote 5 down vote accepted

In /etc/init/mounted-dev.conf remove the line

 [ -e /dev/shm ] || ln -s /run/shm /dev/shm
share|improve this answer
Thank you Florian for a fantastic response. The symbolic link is now not created and my temporary file system is mounted on /dev/shm as expected - works like a dream. Now the /etc/init.d/oracle-shm script is not required at all. – Paul Hudson Jan 12 '13 at 17:03
The comment above that line says "With the /run transition, shm lives there now, but eglibc still looks in /dev/shm. So create a symlink there". How concerned should I be about side effects of removing this? – explunit Mar 15 '13 at 19:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.