Linux : Operation not permitted

This forum covers PCAN-Linux and Linux development issues concerning our products
Heiko_H
Posts: 2
Joined: Thu 21. Apr 2016, 09:25

Linux : Operation not permitted

Post by Heiko_H » Thu 21. Apr 2016, 09:31

Good morning,
I'm using the PEAK Usb adapter which works well.

Code: Select all

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20150729_n (7.15.2) Nov  2 2015 15:32:59 --------------
*---------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] [net] -----------
*--------------------- 1 interfaces @ major 249 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32    usb   can0 ffffffff 000 0x001c 0000433c 00005285 0001bcf9 00002b33 0x0000

Code: Select all

ls -l /dev/pcan*
lrw-rw-rw- 1 root root       8 Apr 20 09:20 /dev/pcan32 -> pcanusb0
crw-rw-rw- 1 root root 180, 32 Apr 20 09:20 /dev/pcanusb0

/dev/pcanusb:
total 0
lrw-rw-rw-1 root root 11 Apr 20 09:20 devid=0 -> ../pcanusb0
when I run my application with sudo everything runs great. But now I wanted to run the application without root. Then i get ofcourse this errors :

RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted

My Question is what i have to set on Linux that I'm allow to run the application without sudo ?

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: Linux : Operation not permitted

Post by M.Maidhof » Thu 21. Apr 2016, 13:45

Hi,

what do you do in your application? Do you have the same problem when using the socketCAN tools?

regards

Michael

Heiko_H
Posts: 2
Joined: Thu 21. Apr 2016, 09:25

Re: Linux : Operation not permitted

Post by Heiko_H » Fri 22. Apr 2016, 11:46

Hi,

I got the problem

The lib I have used try to set the bitrate and start/stop the socket witch is not supported for peak with socketcan or?

regards Heiko

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: Linux : Operation not permitted

Post by M.Maidhof » Fri 22. Apr 2016, 14:03

Hi,

yes, this ip link set feature is only available in the newer 8.x driver version

best regards

Michael

BTW: when you use socketCAN, and a kernel >3.4, there is no need to install our peak-linuxdriver. The kernel already includes the Netdev driver for our hardware.

icarreno
Posts: 4
Joined: Wed 11. Apr 2018, 13:49

Re: Linux : Operation not permitted

Post by icarreno » Wed 11. Apr 2018, 14:32

Hi,

Sorry to hijack this thread.

I used mPCIe Peak Card on my system running with Ubuntu 16 and then installed version 8.x driver. I was able to received CAN messages using candump userspace application.

Now, I tried my application using socketcan and the way it works similar to Heiko's application (start/stop the socket), but for some reason I also encountered similar issue.

There is no respond the last thread if that answer solves the issue.

Best Regards,
Ian

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: Linux : Operation not permitted

Post by M.Maidhof » Wed 11. Apr 2018, 14:39

Hi,

do you use the kernel drivers for SocketCAN or did you install the peak-linux-driver? Please send us the output of cat /proc/pcan if the peak-linux-driver is used.

regards

Michael

icarreno
Posts: 4
Joined: Wed 11. Apr 2018, 13:49

Re: Linux : Operation not permitted

Post by icarreno » Thu 12. Apr 2018, 09:56

Hi Michael,

I installed libsocketcan (apt install libsocketcan-dev) before issuing modprobe pcan. Here is the output of cat /proc/pcan

Code: Select all

*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20171027_n (8.5.1) Apr 11 2018 14:53:01 --------------
*---------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] [net] -----------
*--------------------- 2 interfaces @ major 242 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
 0    pci   can0 90700000 016 0x001c 00000000 00000000 00000000 00000000 0x0000
 1    pci   can1 90700400 016 0x001c 00000000 00000000 00000000 00000000 0x0000
Regards,
Ian

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Linux : Operation not permitted

Post by S.Grosjean » Thu 12. Apr 2018, 10:31

Hi,

Setting bitrate generally needs root privileges. Can you tell us the version (or the download source) of the libsocketcan you use, please?

Regards,

Stéphane
— Stéphane

icarreno
Posts: 4
Joined: Wed 11. Apr 2018, 13:49

Re: Linux : Operation not permitted

Post by icarreno » Thu 12. Apr 2018, 16:55

Hi,

This is the information as shown when running locate libsocketcan

Code: Select all

 libsocketcan.so.2.2.1
Thanks.

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Linux : Operation not permitted

Post by S.Grosjean » Mon 16. Apr 2018, 09:21

Hi,

As I said, while running a Linux System, setting up/down a network interface (as well as setting the bitrate of a can interface) needs root privileges.

Regards,

Stéphane
— Stéphane

Post Reply