I can access the web interface but get a grey screen then saying "Unable to open device".

I tried:

pi@octopi:~ $ ls /dev/video*
pi@octopi:~ $ /dev/video0

I can also take pictures with fswebcam so the hardware is working.

There seems to be a problem with /var/run/motion/motion.pid I tried give all permissions but the error is still there.

Here is the output from the command motion:

pi@octopi:~ $ motion
[0] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion/motion.conf
[0] [ALR] [ALL] conf_cmdparse: Unknown config option "sdl_threadnr"
[0] [NTC] [ALL] motion_startup: Motion 3.2.12+git20140228 Started
[0] [NTC] [ALL] motion_startup: Logging to syslog
[0] [NTC] [ALL] motion_startup: Using log type (ALL) log level (NTC)
[0] [NTC] [ALL] become_daemon: Motion going to daemon mode
[0] [ERR] [ALL] myfopen: Error opening file /var/run/motion/motion.pid with mode w+:

Broadcast message from systemd-journald@octopi (Sat 2017-07-08 21:41:39 UTC):

motion[718]: [0] [EMG] [ALL] become_daemon: Exit motion, cannot create process id file (pid file) /var/run/motion/motion.pid:

Message from syslogd@octopi at Jul  8 21:41:39 ...
motion: [0] [EMG] [ALL] become_daemon: Exit motion, cannot create process id file (pid file) /var/run/motion/motion.pid:
[0] [EMG] [ALL] become_daemon: Exit motion, cannot create process id file (pid file) /var/run/motion/motion.pid:
  • you might need to create /var/run/motion - 'mkdir /var/run/motion'
    – Gotschi
    Jul 10, 2017 at 7:41

3 Answers 3


A crash or unclean shutdown can leave the motion.pid file behind. If this file exists the new process can't create the file.

You can solve this by removing the motion.pid file. To remove the file use the following command:

rm /var/run/motion/motion.pid

You may need to prepend the above command with sudo


For me it were some permission settings that had to be changed. Running these as root fixed the error:

touch /var/run/motion/motion.pid
chown root:motion /var/run/motion/motion.pid
chmod o+w /var/run/motion/motion.pid

I checked many places to find a solution. I also add a grey screen. Then I decided to uninstall Infrared module and it worked. Then I reinstalled infrared module onto the camera module, but I installed infrared modules over camera module or not under as it was. Now it works perfectly. I think that putting infrared modules under decrease the voltage and this is the reason why it didn't work. I hope that this could help some of you

Thanks for all your support

  • 1
    I don't see how an infrared module is relevant to the question. Mar 14, 2019 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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