Fixing solr error: /dev/null: Permission denied

If you try to start solr on Ubuntu (service solr start) you can hit the following error:

service solr start
/opt/solr/bin/solr: line 120: /dev/null: Permission denied
Java not found, or an error was encountered when running java.
A working Java 7 or later is required to run Solr!
Please install Java or fix JAVA_HOME before running this script.
Command that we tried: '/usr/lib/jvm/java-7-openjdk-i386/bin/java -version'
Active Path:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin

This will happen if “/dev/null” has changed into a regular file.

To fix this, run the following:

rm /dev/null
mknod /dev/null c 1 3
chmod 666 /dev/null

Leave a Reply

Your email address will not be published. Required fields are marked *