Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQmx on Ubuntu 22.04 with kernel 6.8 not working

Solved!
Go to solution

Hi,

Not really a question, but more a note, for those who are also facing the same issue.

Ubuntu 22.04 just got an updated HWE kernel (beginning of August), from 6.5 to 6.8. That's the also the kernel which is used on Ubuntu 24.04 LTS.

However, with our systems, using a PCIe 636x, although the NI-DAQmx drivers do compile, they fail to work properly.

We see such error:

  File "/usr/local/lib/python3.10/dist-packages/nidaqmx/stream_writers.py", line 398, in write_int16
    return self._interpreter.write_binary_i16(
  File "/usr/local/lib/python3.10/dist-packages/nidaqmx/_library_interpreter.py", line 5968, in write_binary_i16
    self.check_for_error(error_code, samps_per_chan_written=samps_per_chan_written.value)
  File "/usr/local/lib/python3.10/dist-packages/nidaqmx/_library_interpreter.py", line 6410, in check_for_error
    raise DaqWriteError(extended_error_info, error_code, samps_per_chan_written)
nidaqmx.errors.DaqWriteError: A hardware failure has occurred. The operation could not be completed as specified.

Task Name: AO

The kernel log shows:

kernel: [  218.402117] DMAR: DRHD: handling fault status reg 3
kernel: [  218.402131] DMAR: [DMA Read NO_PASID] Request device [01:00.0] fault addr 0x148df5000 [fault reason 0x06] PTE Read access is not set

 

The NI "platform roadmap" states that only kernels 5.15 and 6.2 are supported (for now), so that issue is not really surprising (and maybe the surprising part is that it did work on v6.5). https://www.ni.com/en/shop/software-portfolio/platform-roadmap.html

The roadmap states that the Ubuntu 24.04 LTS kernel is 6.2, though that's actually 6.8, so probably it will be something looked into soon, for Q4?

 

I guess, for our side, the lesson is that really, with the NI-DAQmx drivers, only the LTS kernel can be used on production systems.

Cheers,

Éric

0 Kudos
Message 1 of 7
(1,184 Views)
Solution
Accepted by topic author pieleric

Ubuntu 24.04 has begun enabling DMA remapping by default.  Many NI drivers do not support DMA remapping.  "DMA is not working with NI Drivers on IOMMU-enabled systems" on the 2024 Q1 Known Issues page has more information and a potential workaround.

Message 2 of 7
(1,152 Views)

Thanks a lot GabeJ, that did work.

 

We'll switch the production systems the LTS kernels anyway, at the ones where the hardware is supported because apparently the kernel updates can break things a little bit too easily...

0 Kudos
Message 3 of 7
(1,080 Views)

Just wanted to mention I have the same Issue with Ubuntu 24.04.1 LTS (Noble Numbat) and Kernel 6.8.0-47-generic.

 

I have a python script, that creates this error:

A hardware failure has occurred. The operation could not be completed as specified.
Task Name: voltage-sweep
Status Code: -5015
Before executing the python script I run the following command to check for the kernel message
sudo journalctl --system -f 
I can relate this message to this message
kernel: niraptnonusb 0000:04:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x000c address=0x1133cd000 flags=0x0000]
kernel: niraptnonusb 0000:04:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x000c address=0x1133db000 flags=0x0020]​

Your message is different, thats why I did not find the error before via grep.

Are You using a Intel CPU? Maybe thats the reason for the different messages

 

This guide solved the issue for me, too.

 

0 Kudos
Message 4 of 7
(876 Views)

Yes, here I have an Intel CPU. That could well be the reason for difference of logs.

Eventually, passing "iommu=pt" as kernel option (by editing /etc/default/grub) works fine.

0 Kudos
Message 5 of 7
(869 Views)

Yes 🙂

 

I created a ansible playbook to automate installing nidaqmx on ubuntu machines. Thought I share it here.

Unfortunately I cant create a new topic. Before I forget I just post it here:

 

 

 

---

# Attention! Spacing ist very important!
- hosts: labpc
  become: true
  tasks:

  - name: Install nidaqmx
    block:
      - name: Install signing key for ni repo
        ansible.builtin.template:
          src: templates/ni-driver/ni-software-2024-noble.asc
          dest: /usr/share/keyrings/ni-software-2024-noble.asc
          owner: root
          group: root
          mode: '0755'

      # Get the signing key and source list entry from existing installation
      - name: Install template for ni repo
        ansible.builtin.template:
          src: templates/ni-driver/ni-software-2024-noble.list
          dest: /etc/apt/sources.list.d/ni-software-2024-noble.list
          owner: root
          group: root
          mode: '0755'

      - name: Install ni-daq package
        ansible.builtin.package:
          name:
            - ni-daqmx  # ni driver
          state: latest
          update_cache: yes

      - name: NI Driver install 
        ansible.builtin.command: dkms autoinstall

  # Apply workaround https://www.ni.com/docs/en-US/bundle/ni-platform-on-linux-desktop/page/iommu-linux.html
  - name: Apply DMA workaround
    block:

    # https://stackoverflow.com/questions/55844981/ansible-insert-word-in-grub-cmdline
    - name: Enable IOMMU via grub
      ansible.builtin.lineinfile:
        path: /etc/default/grub
        regexp: '^GRUB_CMDLINE_LINUX_DEFAULT="((?:(?!iommu=pt).)*?)"$'
        line: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 iommu=pt"'
        backup: true
        backrefs: true
      notify: update-grub

    - name: Update grub
      ansible.builtin.command: update-grub
      become: yes

    - name: Reboot machine
      ansible.builtin.reboot:
        reboot_timeout: 3600

 

 

 

0 Kudos
Message 6 of 7
(862 Views)

Hey nikongen,

 

Do you mind sharing the python script you used to reproduce this error? I believe we are experiencing a similar issue, but it seems to happen intermittently and are struggling to reproduce the issue consistently. This has made it quite difficult to validate any changes that we make to our system.

 

Thank you!

0 Kudos
Message 7 of 7
(614 Views)