Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel Patch not working on ubuntu 5.0.0-23-generic #13052

Closed
devkrish23 opened this issue Jun 18, 2024 · 14 comments
Closed

Kernel Patch not working on ubuntu 5.0.0-23-generic #13052

devkrish23 opened this issue Jun 18, 2024 · 14 comments

Comments

@devkrish23
Copy link


Required Info
Camera Model { D435I }
Firmware Version (05.12.07.150)
Operating System & Version Ubuntu 18.04.5 LTS
Kernel Version (Linux Only) 5.0.0-23-generic
Platform PC
SDK Version 2.38.1

Issue Description

I am trying to patch the realsense on ubuntu platform. However i am facing issues with the bionic repo, the support for bionic doesn't seem to exists anymore.

Step1: git clone https://github.com/IntelRealSense/librealsense.git
Step2: git checkout v2.38.1
Step3: sudo apt install libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev at
Step4: ./scripts/setup_udev_rules.sh
step5: Apply patch kernel modules
./scripts/patch-realsense-ubuntu-lts.sh

Error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
bc is already the newest version (1.07.1-2).
build-essential is already the newest version (12.4ubuntu1).
git is already the newest version (1:2.17.1-1ubuntu0.18).
linux-headers-generic is already the newest version (4.15.0.213.196).
The following packages were automatically installed and are no longer required:
  apport-symptoms gir1.2-dbusmenu-glib-0.4 gir1.2-dee-1.0 gir1.2-unity-5.0 python3-debconf
  python3-debian python3-systemd update-notifier-common
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Package required libusb-1.0-0-dev:  - found
Package required libssl-dev:  - found
Create patches workspace in ubuntu-bionic-5 folder

Package required libelf-dev:  - found
Package required elfutils:  - found
Package required bison:  - found
Package required flex:  - found
Initialized empty Git repository in /home/bedgear/Downloads/librealsense/ubuntu-bionic-5/.git/
fatal: repository 'https://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git/' not found
Fetching Ubuntu LTS tag   to the local kernel sources folder
fatal: You need to specify a tag name.

After checking more, it seems support for bionic has been suspended and i was not able to find this repo; https://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git/'
has this migrated somewhere else or is there any workaround?

@MartyG-RealSense
Copy link
Collaborator

Hi @devkrish23 Bionic is Ubuntu 18.04, which is still supported by the librealsense SDK.

It is possible to use a source code build of the librealsense SDK without applying a kernel patch script, though there may be unpredictable consequences in regards to stability.

Alternartively, instead of building 2.38.1 with git clone, you could instead download a zipped source code folder of 2.38.1, extract it and build from that with CMake.

https://github.com/IntelRealSense/librealsense/releases/tag/v2.38.1

If the flag -DFORCE_RSUSB_BACKEND=TRUE is included in the CMake build instruction then librealsense will bypass the kernel, avoiding the need to apply a patch script, and it will also not be dependent on a particular Linux version.

Instructions for an RSUSB build can be found at #9931 (comment)

@devkrish23
Copy link
Author

Hi @MartyG-RealSense, thank you for the response.

So, we are using Ubuntu 18.04.5 LTS that was shipped with 5.4 kernel. Since, this kernel was not supported by realsense we had to downgrade our kernel version to 5.0.0-23-generic. We tried using the camera (D435I x2), however we were experiencing a lot of issues, such as

XIOCTL (vidioc_s_ctrl) failed last error: connection timed out,
NULL pointer passed for argument 'frame_ref',
get_xu(ctrl=1) failed! last error: device or resource busy

Hence we resorted to patching our system as instructed in librealsense documentation and it worked fine few years back.

But now, when i am trying to patch the system, it fails at the following line
kernel_git_tag=$(git ls-remote --tags origin | grep "${kernel_full_num}\." | grep '[^^{}]$' | tail -n 1 | awk -F/ '{print $NF}')
in script patch-realsense-ubuntu-lts.sh

@MartyG-RealSense
Copy link
Collaborator

Is it possible for you to install librealsense from packages instead of building from source code? A package build of the SDK supports kernel 5.4 and you do not need to apply a patch script as the kernel patch is bundled within the packages.

https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md

image

@MartyG-RealSense
Copy link
Collaborator

Hi @devkrish23 Do you require further assistance with this case, please? Thanks!

@devkrish23
Copy link
Author

Hi @devkrish23 Do you require further assistance with this case, please? Thanks!

Hello, i am testing this solution with 5.4 kernel. Will update you in a day or two. Thank you!

@MartyG-RealSense
Copy link
Collaborator

You are very welcome. I look forward to your next report. Good luck!

@devkrish23
Copy link
Author

I did try your solution and started a fresh ubuntu install 18.0.4 with 5.4.0-150 kernel as mentioned in https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md
I then performed stress testing on librealsense and intel realsense cameras.
The cameras failed for 1 in 1500 times during picture capture. Do you think there is any patching issue or you suspect something else?

@MartyG-RealSense
Copy link
Collaborator

Your system's setup looks correct and appropriate for librealsense 2.38.1 (Ubuntu 18.04, kernel 5.4, firmware 5.12.7.100).

Have you tried the suggestion earlier in this discussion at #13052 (comment) to build librealsense from source code with RSUSB = true in order to test whether the kernel is a factor when a failure occurs, since an RSUSB build of librealsense bypasses the kernel and does not require a patch.

@devkrish23
Copy link
Author

My new ubuntu 18.04 machine has following specifications:
kernel: 5.4
firmware: 5.16.0.1
SDK: 2.55.1

@MartyG-RealSense
Copy link
Collaborator

A couple of possible paths that you could consider if an RSUSB = true source code build of librealsense is not suitable for your project are:

  1. Use a much more recent kernel with Ubuntu 18.04. My research suggests that up to kernel 5.13 could be used with 18.04.

  2. Disregard the stress test results, as such a test may not reflect the real-world circumstances that a program will be used in if it will not be capturing 1500 times in quick succession during actual use.

@MartyG-RealSense
Copy link
Collaborator

Hi @devkrish23 Do you require further assistance with this case, please? Thanks!

@MartyG-RealSense
Copy link
Collaborator

Case closed due to no further comments received.

@devkrish23
Copy link
Author

Hi @devkrish23 Do you require further assistance with this case, please? Thanks!

Yes, I am done with the testing. Putting 200 ms sleep between camera captures worked for me on latest 5.4 kernel and camera firmware version 5.12.100.
Thank you!

@MartyG-RealSense
Copy link
Collaborator

That's excellent news, @devkrish23 - thanks very much for the update and the details of what worked for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants