Why Can't I Use the mount or unmount Command when Using System Exec VI in Linux?

Updated Dec 27, 2022

Reported In

Software

  • LabVIEW Real-Time Module

Operating System

  • Linux
  • NI Linux Real-Time

Issue Details

I am attempting to call umount or mount using the LabVIEW System Exec VI; however, this returns with the error umount failed: Operation not permitted. Why is this happening and how can I use these commands?

Solution

In LabVIEW Real-Time 2013 and later, the umount and mount commands have a setuid bit that is not underneath all users. lvuser is the default user when deploying the System Exec VI and this does not have access to these commands. For most targets, it is unnecessary to use this eject option.  


If you would still like to provide lvuser with the permissions necessary to call umount and mount, you can do the following (which assumes familiarity with using a tool like vi to edit files in Linux):
  1. Log into the cRIO using PuTTY or some other SSH tool.
  2. Use vi at the command line to open /etc/fstab to be edited.
  3. Insert a new line below the last line that begins with "tmpfs".
  4. Add the line, "/dev/sda1     /media/sda1     auto     users     0     0
  5. Confirm that the formatting of the newly-added line matches the image below.
  6. Save the file and reboot the target.
NOTE: sda1 is the default identifier for the device, but if there are multiple external devices, the identifier may be different.

Another way to incorporate the functionality is by flushing the data programmatically and properly closing all file references to the removable media in LabVIEW before ejecting the device.