Permission denied (EPERM) in Serial Monitor on Linux

Symptoms

Starting the Serial Monitor plugin and pressing the Capture button yields:

Session started
Cannot start capture: Permission denied

Details

This error might happen for two reasons:

  1. You have no permissions to access /dev/tdevmon
  2. You have no permissions to access the target device (e.g. /dev/ttyS0)

/dev/tdevmon is a communication device created by Tibbo Device Monitor. By default, it only allows root access so a non-superuser simply would not be able to open it.

As for the target serial devices, hooking a device requires opening it first (as to get a pointer to struct file_operations). On different Linux distros /dev/ttuS<n> devices usually belong to groups such as dialout, uucp, tty, etc. Unless you are a member of these groups (or a root), you will see the Permission denied error during an open attempt.

Solution

To resolve this problem, you need to make sure you have access both to /dev/tdevmon and to the target device (e.g. /dev/ttyS0).

The obvious solution would be to start IO Ninja as root:

sudo ./ioninja

You can also start only the Serial Monitor session as root (using a Run session as root (sudo) checkbox on the New Session dialog).

Yet another option would be to alleviate access restrictions on both devices:

sudo chmod 666 /dev/tdevmon
sudo chmod 666 /dev/ttyS0

If the Permission denied error is caused by the target device, you can add yourself to the corresponding group. First, find out the group of the device with:

ls -l /dev/ttyS0

Then add yourself to this group:

sudo usermod -aG dialout $USER

Finally, if the Permission denied error is caused by the /dev/tdevmon device, then instead of modifying permissions on the /dev/tdevmon post creation, you can specify required permissions when loading the Linux kernel module next time:

sudo insmod tdevmon.ko permissions=0666