Closed tfoote closed 5 years ago
@tfoote I ran into same problem, and I thought this is because of missing udevadm
program, and add them to package.xml (https://github.com/IntelRealSense/librealsense/pull/1829).
But if I compare success build (http://build.ros.org/view/Ksrc_uX/job/Kbin_uX64__realsense_camera__ubuntu_xenial_amd64__binary/71/consoleFull) and failed build (http://build.ros.org/view/Ksrc_uX/job/Kbin_uX64__realsense_camera__ubuntu_xenial_amd64__binary/92/consoleFull) Formar one outputs
08:21:15 Setting up ros-kinetic-librealsense (1.12.1-0xenial-20180222-192514-0800) ...
08:21:15 INFO: Docker environment not supported for udevadm; skipping.
08:21:15 INFO: Docker environment not supported for DKMS; skipping.
08:21:15 Setting up ros-kinetic-roslint (0.11.0-0xenial-20180222-193217-0800) .
This is very strange because, i remember the recent upgrade of the buildfirm changed to use docker...
Hmm that's oddly different. Maybe the newer kernel doesn't have the same proc layout and the docker detection is failing.
I managed to get librealsense to install inside a docker container.
The solution required
setup.sh
),run.sh
).Run this setup.sh
script first on the host:
#!/bin/sh
# setup keys for intel's repository server
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE
sudo bash -c 'echo "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo $(lsb_release -cs) main" > /etc/apt/sources.list.d/realsense-public.list'
sudo apt-get update
# install linux-kernel-headers on host
sudo apt-get install linux-headers-$(uname -r)
# install librealsense2
sudo apt-get install librealsense2
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
sudo apt-get install realsense-uvcvideo
# add current user to video group
sudo usermod -a -G video $USER
getent group video
Prepare a build.sh
script:
#!/bin/sh
docker build \
--file Dockerfile \
--build-arg repository=ros \
--build-arg tag=kinetic-desktop-full-xenial \
-t ros:kinetic-turtlebot-gazebo7-xenial .
Use the following Dockerfile
. I based this off an NVIDIA OpenGL dockerfile which installed ros-kinetic-core and ros-kinetic-desktop-full, so you'll have to remove the --runtime=nvidia option if you're basing it off the osrf/ros images or create your own ros/opengl image based off NVIDIA's dockerfile.
The trick was ensuring that the host and container kernel versions matched, so that when the container modprobes the uvcvideo module, it can load it when running a container with elevated privileges and appropriate volume mappings to /dev and /lib/modules on the host.
# ros:kinetic-turtlebot-gazebo7-xenial
# docker build -t ros:kinetic-turtlebot-gazebo7-xenial .
# xhost +local:root
# docker run --runtime=nvidia -ti --rm -e DISPLAY -e QT_GRAPHICSSYSTEM=native -e QT_X11_NO_MITSHM=1 -v /dev:/dev -v /lib/modules:/lib/modules -v /tmp/.X11-unix:/tmp/.X11-unix --privileged --cap-add=ALL ros:kinetic-turtlebot-gazebo7-xenial
# xhost -local:root
ARG repository
ARG tag
FROM ${repository}:${tag}
LABEL description "Kinetic ROS Turtlebot with Gazebo 7 and NVIDIA OpenGL - Ubuntu-16.04."
# setup environment
ENV container docker
#ARG DEBIAN_FRONTEND=noninteractive
#ARG TERM=linux
# setup sources.list
RUN echo "deb-src http://us.archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted \n\
deb-src http://us.archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted \n\
deb-src http://us.archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-backports main restricted universe multiverse \n\
deb-src http://security.ubuntu.com/ubuntu $(lsb_release -cs)-security main restricted" \
> /etc/apt/sources.list.d/official-source-repositories.list
# install kernel image and kernel header packages to match that of the host
RUN apt-get update \
&& apt-get install --no-install-recommends -q -y \
apt-utils \
pkg-config \
&& apt-get install --no-install-recommends -q -y \
linux-image-$(uname -r) \
linux-headers-$(uname -r) \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# setup keys for intel's repository server
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE
RUN echo "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo $(lsb_release -cs) main" \
> /etc/apt/sources.list.d/realsense-public.list
# install intel realsense libraries
RUN apt-get update \
&& apt-get install --no-install-recommends -q -y \
librealsense2 \
librealsense2-dkms \
librealsense2-utils \
realsense-uvcvideo \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# # install ros device driver packages
# RUN apt-get update \
# && DEBIAN_FRONTEND=noninteractive apt-get install -q -y \
# ros-$ROS_DISTRO-cv-bridge \
# ros-$ROS_DISTRO-librealsense \
# ros-$ROS_DISTRO-realsense-camera \
# && apt-get autoremove -y \
# && rm -rf /var/lib/apt/lists/*
# # install ros turtlebot packages
# RUN apt-get update \
# && TERM=xterm apt-get install --no-install-recommends -q -y \
# ros-$ROS_DISTRO-turtlebot-gazebo \
# && apt-get autoremove -y \
# && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
#CMD ["roslaunch turtlebot_gazebo turtlebot_world.launch"]
Use the following run.sh
script. Remove the nvidia runtime if you're not using it:
#!/bin/sh
xhost +local:root
docker run -it \
--runtime=nvidia \
-e DISPLAY \
-e QT_GRAPHICSSYSTEM=native \
-e QT_X11_NO_MITSHM=1 \
-v /dev:/dev \
-v /lib/modules:/lib/modules \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--privileged \
--cap-add=ALL \
--rm \
ros:kinetic-turtlebot-gazebo7-xenial
xhost -local:root
This should get you as far as being able to install librealsense2 cleanly on the docker image and performing a modprobe for uvcvideo. I don't have actual hardware so haven't been able to confirm it works, but the container should have full access to the host container's usb ports with this setup.
I was wondering if perhaps someone could help with an issue where when I try to install ros-kinetic-turtlebot-package, it pulls on an older version of librealsense and attempts to patch an older version (4.4) of the linux kernel, even though I've updated and installed a newer (4.15) kernel version and header.
This is the Dockerfile
snippet (based on the one that I posted earlier, which attempts to install the ros-turtlebot packages):
# install ros turtlebot packages
RUN apt-get update \
&& TERM=xterm apt-get install --no-install-recommends -q -y \
ros-$ROS_DISTRO-turtlebot-gazebo \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
I want to prevent the ros package from trying to install the older 4.4 kernel, when the librealsense2 dependencies and uvcvideo modules have been made available for the 4.15 kernel in the previous step.
Setting up linux-headers-4.4.0-131 (4.4.0-131.157) ...
Setting up linux-headers-4.4.0-131-generic (4.4.0-131.157) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 4.4.0-131-generic /boot/vmlinuz-4.4.0-131-generic
Good news! Module version 1.1.2.realsense-1.3.0 for uvcvideo.ko
exactly matches what is already found in kernel 4.4.0-131-generic.
DKMS will not replace this module.
You may override by specifying --force.
Good news! Module version realsense2-dkms for videodev.ko
exactly matches what is already found in kernel 4.4.0-131-generic.
DKMS will not replace this module.
You may override by specifying --force.
Good news! Module version realsense2-dkms for hid-sensor-accel-3d.ko
exactly matches what is already found in kernel 4.4.0-131-generic.
DKMS will not replace this module.
You may override by specifying --force.
Good news! Module version realsense2-dkms for hid-sensor-gyro-3d.ko
exactly matches what is already found in kernel 4.4.0-131-generic.
DKMS will not replace this module.
You may override by specifying --force.
Error! Application of patch 10-realsense-camera-formats-4.4.patch failed.
Check /var/lib/dkms/realsense-uvcvideo/4.10.0/build/ for more information.
Setting up linux-headers-generic (4.4.0.131.137) ...
Setting up libjemalloc1 (3.6.0-9ubuntu1) ...
Setting up redis-tools (2:3.0.6-1) ...
Setting up redis-server (2:3.0.6-1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up libbullet-dev:amd64 (2.83.6+dfsg-3) ...
<snip>
Setting up ros-kinetic-librealsense (1.12.1-0xenial-20180222-192514-0800) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
/var/lib/dpkg/info/ros-kinetic-librealsense.postinst: 40: /var/lib/dpkg/info/ros-kinetic-librealsense.postinst: udevadm: not found
Creating symlink /var/lib/dkms/uvcvideo/1.1.1-3-realsense/source ->
/usr/src/uvcvideo-1.1.1-3-realsense
DKMS: add completed.
Kernel preparation unnecessary for this kernel. Skipping...
Running the pre_build script:
dkms: Pre-build script started...
Downloading kernel sources...
Reading package lists...
Picking 'linux-signed-hwe' as source package instead of 'linux-image-4.15.0-29-generic'
Need to get 12.2 kB of source archives.
Get:1 http://security.ubuntu.com/ubuntu xenial-security/main linux-signed-hwe 4.15.0-29.31~16.04.1 (dsc) [2123 B]
Get:2 http://security.ubuntu.com/ubuntu xenial-security/main linux-signed-hwe 4.15.0-29.31~16.04.1 (tar) [10.1 kB]
gpgv: Signature made Wed Jul 18 08:46:19 2018 UTC using RSA key ID CBEECEA3
gpgv: Can't check signature: public key not found
dpkg-source: warning: failed to verify signature on ./linux-signed-hwe_4.15.0-29.31~16.04.1.dsc
dpkg-source: info: extracting linux-signed-hwe in linux-signed-hwe-4.15.0
dpkg-source: info: unpacking linux-signed-hwe_4.15.0-29.31~16.04.1.tar.xz
W: Can't drop privileges for downloading as file 'linux-signed-hwe_4.15.0-29.31~16.04.1.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
Fetched 12.2 kB in 0s (13.5 kB/s)
grep: drivers/media/usb/uvc/uvc_driver.c: No such file or directory
INFO: No Intel RealSense(TM) cameras are currently supported.
Patching uvcvideo sources...
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/drivers/media/usb/uvc/Makefile b/drivers/media/usb/uvc/Makefile
|index c26d12fdb8f4..d86cf22155d1 100644
|--- a/drivers/media/usb/uvc/Makefile
|+++ b/drivers/media/usb/uvc/Makefile
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 14
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
|index d11fd6ac2df0..914164137a13 100644
|--- a/drivers/media/usb/uvc/uvc_driver.c
|+++ b/drivers/media/usb/uvc/uvc_driver.c
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 100
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
|index f0f2391e1b43..532ca19675a5 100644
|--- a/drivers/media/usb/uvc/uvcvideo.h
|+++ b/drivers/media/usb/uvc/uvcvideo.h
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 163
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|index a0e87d16b726..e6c1ec69cba4 100644
|--- a/include/uapi/linux/videodev2.h
|+++ b/include/uapi/linux/videodev2.h
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
Building module:
cleaning build area...
.(bad exit status: 2)
make KERNELRELEASE=4.15.0-29-generic -C /var/lib/dkms/uvcvideo/1.1.1-3-realsense/build/linux-src M=drivers/media/usb/uvc/....(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.15.0-29-generic (x86_64)
Consult /var/lib/dkms/uvcvideo/1.1.1-3-realsense/build/make.log for more information.
WARNING: DKMS module failed to installed; removing...
------------------------------
Deleting module version: 1.1.1-3-realsense
completely from the DKMS tree.
------------------------------
Done.
WARNING: Unknown configuration for Intel RealSense(TM) cameras!
To resolve, please follow the installation directions at:
http://wiki.ros.org/librealsense#Installation
Setting up ros-kinetic-map-server (1.14.4-0xenial-20180714-090330-0800) ...
I'm not sure where the turtlebot sources for librealsense are for the official ros-kinetic builds, would appreciate if someone can point me to the correct repo and branch.
If you're looking for a nice work around (like I was) for installing all this stuff on systems and not going through the pain of librealsense installation, I have a snap package for it set up with docs in the repo below.
https://github.com/SteveMacenski/ros-realsense-d400-snap-pkg
[Please Ignore - RealSense system comment]
Close this issue for lack of activity. Please feel free to reopen if the issue is still relevant.
This is still an issue that people are having to work around.
This is still an issue that people are having to work around.
It is a librealsense installation issue. not realsense2_camera. I suggest you reopen it in librealsense repository.
The librealsense if failing to install on the ROS buildfarm when trying to build and installing librealsense.
The error can be seen here: http://build.ros.org/view/Ibin_arm_uThf/job/Ibin_arm_uThf__realsense_camera__ubuntu_trusty_armhf__binary/56/consoleFull
We have recently upgraded the build farm to use a newer kernel (4.15) due to spectre/meltdown workarounds: https://github.com/ros-infrastructure/ros_buildfarm/issues/535 which looks to be a compatibility issue with librealsense.
Clearly librealsense is trying to install a kernel module. Is this something that can scale across versions or have conditional logic to handle a different kernel version. Also since this isn't going to be running on the buildfarm machines, it should be able to build against the older Trusty kernel and be installed there, but the build runs using the newer kernel.