LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mount NSF share to NI Linux

Solved!
Go to solution

I am attempting to mount a NFS share onto a 9030 cRIO using the system Exec VI.

 

I followed an old post below to get like NFS and cRIO set up for being linked:
https://forums.ni.com/t5/NI-Linux-Real-Time-Discussions/Issue-in-mounting-NFS-share-on-compactRio-90...

Unfortunatly the last step in the process of having it auto mount will not work for me. The NFS share is in the same RIG as the cRIO and it doesn't power on before the cRIO

 

Putty I can use the command (when logged in as admin user)

"mount -o port=2049,nolock,proto=tcp -t nfs 10.100.5.90:/CRR-RAID-Disks/Data /mnt/RAID_Link"

After this command the NFS share shows up on the cRIO in the location /mnt/RAID_Link

 

Trying to run this command via the system exec VI doesn't work without sudo. You get an error to say that lvuser doesn't have sudo access So I have added lvuser to sudo using the information from the below link:
https://forums.ni.com/t5/NI-Linux-Real-Time-Discussions/Is-it-possible-to-close-and-re-open-RTEXE-th...

 

However when I try to run "sudo mount -o port=2049,nolock,proto=tcp -t nfs 10.100.5.90:/CRR-RAID-Disks/Data /mnt/RAID_Link"

the standard output shows "sudo: mount: command not found"

 

Does anybody have any other suggestions on to programmatically link this NFS share or if i have missed something in the syntax of my command?


Certified LabVIEW Architect, Certified Professional Instructor

CLA CPI

0 Kudos
Message 1 of 9
(4,703 Views)

"sudo" does not exist on cRIO,

try to log in as the admin user, like they do in the link you posted.

or you could try                 su - admin -c "your command"


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 9
(4,691 Views)

Its possible to install sudo on the RT target using the commands listed in the 2nd link in my original post.

 

First, install sudo

opkg update

opkg install sudo

The output from the system exec of sudo: mount: command not found suggests that it was able to find sudo but not able to find mount. Before you add lvuser as a sudoer you get an error message of sudo: permission is denied. in the format of the below:

 

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

 

I tried your suggestion of "su - admin -c" and it gives the response of

"su: must be run from a terminal"


Certified LabVIEW Architect, Certified Professional Instructor

CLA CPI

0 Kudos
Message 3 of 9
(4,674 Views)
Solution
Accepted by topic author nwxan90

@nwxan90 wrote:

However when I try to run "sudo mount -o port=2049,nolock,proto=tcp -t nfs 10.100.5.90:/CRR-RAID-Disks/Data /mnt/RAID_Link"

the standard output shows "sudo: mount: command not found"

Try "sudo /bin/mount [...]" or "sudo -- /bin/mount [...]".

 

In general you ran into issues mainly because your VI is executed as the unprivileged user "lvuser". This user, however, is not allowed to run the mount command. Using "su - -c "<command>" admin" does not work, as the su command requires an interactive terminal to ask for the password. There are tricks to sidestep this, however most of them won't work as the users admin and lvuser don't have a password set by default. This is a solution that works in any case (describing it in full for other readers):

  1. ssh into the target using the admin account
  2. Install sudo on the target using "opkg update && opkg install sudo"
  3. Allow lvuser to use the priviledged mount command via "sudo" without the need of typing a password: "echo 'lvuser ALL=(ALL) NOPASSWD: /bin/mount' >> /etc/sudoers"
  4. Done. You can use the System Exec.vi with e.g. "sudo -- /bin/mount -t cifs //PChostname/Users /mnt" now.

Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
Message 4 of 9
(4,660 Views)

That works perfectly.

 

Using the sudo -- /bin/mount [...]  I had previously updated the sudoers file for "lvuser" user.

 

Thank you very much for your support.


Certified LabVIEW Architect, Certified Professional Instructor

CLA CPI

0 Kudos
Message 5 of 9
(4,644 Views)

For anybody interested the full syntax i got to work is as follows

 

sudo -- /bin/mount -o port=2049,nolock,proto=tcp -t nfs <IP OF NFS SHARE:/Folder location on NFS> <Location on cRIO>

 

I made a folder on the cRIO in the mnt location that is where I map the NFS share to.


Certified LabVIEW Architect, Certified Professional Instructor

CLA CPI

Message 6 of 9
(4,639 Views)

Hi, I'm trying to do same thing with the command ifconfig. I followed the instructions but still get the same message:


We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified

 

I'm aware there is a vi to chenge the ip of the CRIO but I'm in need to change it without restarting the chassis. I made it with a terminal logged as admin, but I want to do it through Exec vi.

 

Thanks

0 Kudos
Message 7 of 9
(3,329 Views)

Are you sure you replied to the right post? This thread is about mounting an NSF network share on your cRIO. You seem to ask about ifconfig which is the tool to control the network interface configuration.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 9
(3,319 Views)

Are you sure you replied to the right post? This thread is about mounting an NSF network share on your cRIO. You seem to ask about ifconfig which is the tool to control the network interface configuration.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 9
(3,318 Views)