Installing peak-linux-driver-8.9.2 inside Ubuntu1804 docker

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
mjm522
Posts: 4
Joined: Tue 29. Oct 2019, 16:47

Installing peak-linux-driver-8.9.2 inside Ubuntu1804 docker

Post by mjm522 » Tue 29. Oct 2019, 16:55

Hi,

I recently started using peak driver (2 days) and have been trying to set it up on a docker container with Ubuntu 1804. I use the following steps after going to the folder.

1) sudo make NET=NO PCC=NO

This step runs successfully without any issues.

2) sudo make install.

When I run this, I get the following error.

Code: Select all

Info: Copied 45-pcan.rules to /etc/udev/rules.d.
Info: mainline drivers removed and blacklisted in
      /etc/blacklist-peak.conf
Makefile:617: recipe for target 'install_udev' failed
make[1]: *** [install_udev] Error 2
make[1]: Leaving directory '/tmp/p_tmp/peak-linux-driver-8.9.2/driver'
Makefile:109: recipe for target 'install' failed
make: *** [install] Error 2
I face no issues when installing it on a machine with Ubuntu 1804 (i.e. without using docker). Has anyone of you faced this problem? If so, could anyone please give some helpful advice?

Best,

Michael

M.Heidemann
Sales & Support
Sales & Support
Posts: 673
Joined: Fri 20. Sep 2019, 13:31

Re: Installing peak-linux-driver-8.9.2 inside Ubuntu1804 doc

Post by M.Heidemann » Wed 30. Oct 2019, 12:24

Hello Michael,

Please try to install udev on that docker-image:

Code: Select all

$ sudo apt-get install udev
And try the installation again.

Report back to me, once you have done so.

Best Regards

Marvin

mjm522
Posts: 4
Joined: Tue 29. Oct 2019, 16:47

Re: Installing peak-linux-driver-8.9.2 inside Ubuntu1804 doc

Post by mjm522 » Wed 30. Oct 2019, 15:21

Thanks for the reply. Yes, I have already installed udev. We also tried putting set -x; in the makefile to see any further error that was happening. But couldn't get any useful errors.

M.Heidemann
Sales & Support
Sales & Support
Posts: 673
Joined: Fri 20. Sep 2019, 13:31

Re: Installing peak-linux-driver-8.9.2 inside Ubuntu1804 doc

Post by M.Heidemann » Wed 30. Oct 2019, 15:48

This was my first guess,

Let us try something else.

Can you send me the output of:

Code: Select all

rpm -ql systemd | grep udev
?

Best Regards

Marvin

mjm522
Posts: 4
Joined: Tue 29. Oct 2019, 16:47

Re: Installing peak-linux-driver-8.9.2 inside Ubuntu1804 doc

Post by mjm522 » Wed 30. Oct 2019, 16:11

I get nothing. I also get nothing on the system on which peak driver is successfully running. However, trying to do

Code: Select all

sudo apt-get install udev
gives me

Code: Select all

udev is already the newest version (237-3ubuntu10.31).
.

M.Heidemann
Sales & Support
Sales & Support
Posts: 673
Joined: Fri 20. Sep 2019, 13:31

Re: Installing peak-linux-driver-8.9.2 inside Ubuntu1804 doc

Post by M.Heidemann » Thu 31. Oct 2019, 14:31

Hello Michael,

I spent some time trying to replicate your setup and get our driver running in a docker container, but was not able to do so myself.

From what i learned this has to do with the way docker shares the kernel with its host and how kernel modules might be used within docker containers.

Note: Our driver is a kernel module.

There are potential ways to do this but we are not knowledgeable enough when it comes to docker, so you might ask the docker community for help in this case.

I am really sorry i can't give you the solution you are looking for.

I would really appreciate it, if you could update us on your progress regarding this issue, so we can take it into consideration in the future.

Best Regards

Marvin

mjm522
Posts: 4
Joined: Tue 29. Oct 2019, 16:47

Re: Installing peak-linux-driver-8.9.2 inside Ubuntu1804 doc

Post by mjm522 » Fri 1. Nov 2019, 10:35

Hi Marvin,

Thanks for the reply. Here is my setup dockerfile with just ubuntu 1804 and peak drivers: <link removed by admin - no external links allowed>. The only thing I have modified is to add

Code: Select all

@set -x;
above install_udev section of the Makefile inside peak-linux-driver-8.9.2\driver. If you could please clone this repository and try running ./install.sh, you may be able to decipher the error a bit more.

I will also post the same in the docker community. However, I don't face issues with my other driver modules. If I get any workarounds or suggestions, I will definitely keep you posted. Thanks for your support.

Best

Michael

M.Heidemann
Sales & Support
Sales & Support
Posts: 673
Joined: Fri 20. Sep 2019, 13:31

Re: Installing peak-linux-driver-8.9.2 inside Ubuntu1804 doc

Post by M.Heidemann » Mon 4. Nov 2019, 11:11

Hello Michael,

i did run your script and there seems to be either missing dependencies or changed paths,

The kernel headers are not found, modprobe was not found, etc...

You seem to run this as --privileged but the necessary components are still missing to run the installation.

The Docker Forum has 2 threads that seem to be related to the issues you are having, search for these subjects in the Docker Forum:

'Lsmod and modprobe not found'

and

'Consequence of Installing kernel modules on the container'

From what i could gather it seems to be not recommended to use docker in the way you want to use it, although there seem to be ways to grant privileges (which you seem to already know) and capabilities not provided to a default container, even going as far as loading modules from the underlying host kernel.

But this is going beyond the scope of support we can provide you.


I hope this is still somewhat helpful in your endeavor to get this working.

Please keep us updated on this matter in case, we would highly appreciate it.


Best Regards

Marvin

MartinH
Posts: 5
Joined: Wed 18. Nov 2015, 12:23

Re: Installing peak-linux-driver-8.9.2 inside Ubuntu1804 docker

Post by MartinH » Mon 10. May 2021, 18:10

This topic is old, but I found a hacky workaround I would like to share (note: I am no docker expert).

TL;DR: I precompiled the driver on my host build machine and copied the installation to the docker filesystem. This way at least I can combile code inside docker (I have not tried running the driver!).

Code: Select all

# On your local pc where you usually compile the code:
wget https://www.peak-system.com/fileadmin/media/linux/files/peak-linux-driver-8.3.tar.gz
cd peak-linux-driver-8.3
make
mkdir -p deploy
make DESTDIR=/home/martin/Downloads/peak-linux-driver-8.3/deploy install
# Patch pcanfd.h cannot find sys/time.h when compiling inside the docker container!
#    /usr/include/pcanfd.h:124:17: error: field ‘timestamp’ has incomplete type ‘timeval’
    diff --git a/usr/include/pcanfd.h b/usr/include/pcanfd.h
    index 17f2b2e..9b43db8 100644
    --- a/usr/include/pcanfd.h
    +++ b/usr/include/pcanfd.h
    @@ -30,6 +30,8 @@
    
     #endif
    
    +#include <sys/time.h>
    +
     /* enable to define types including array with 0, 1 or more items */
     #define __array_of_struct(_n, _x)                                      \
            _n##s_##_x {                       
# Manually install to docker for testing:
docker cp deploy/ <CONTAINER ID>:/tmp/
# Inside the docker container: fake install the driver:
cp -r /tmp/deploy/* /
This of course can be automated in your Dockerfile. With this the driver is "pseudo" installed, so that at least I can build code compiling against the includes.

As stated above, hacky workaround, but at least the code compiles.

Post Reply