NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Fileshare listed in /etc/fstab not loading before startup package

Solved!
Go to solution

So I'm pointing to a NFS fileshare that's correctly set up in /etc/fstab -- "mount -a" finds and mounts it correctly -- that is loading AFTER a package that my coworkers are setting as the startup package. Since this package relies on files that are on the fileshare, it is choking. Do we need to modify the package to issue a mount command, or is there a way to make sure that the items in fstab are mounted before a NI startup package begins execution?

0 Kudos
Message 1 of 2
(2,668 Views)
Solution
Accepted by topic author TomDavidson

Hi TomDavidson,

 

Consumption of the contents of fstab for all local devices is handled by the mountall.sh command, which is run on startup due to the /etc/rcS.d/S02mountall.sh link.

 

There is a similar script, mountnfs.sh, that handles network mounts listed in fstab. This script is not curently enabled in the NI Linux RT images, and needs to be enabled after the networking script (to make sure the network is available prior to attempting to mount network shares).

 

Checking the controller at my desk, networking is enabled at runlevel 1, priority 80. This means that you'd need to enable mountnfs.sh (which, despite the name, handles nfs, smb/cifs, and ncp) at runlevel 1 with a later priority (>80) or at a later runlevel (NI Linux RT evaluates rcS → rc1 → rc2 → rc3 → rc4 → rc5, rc0 is halt/poweroff, rc6 is reboot).

 

Ideally, you'd want to either have some delay or checking in the script to make sure that the networking is up and ready, able to resolve the server called out in the fstab file, however a quick check of the mountnfs.sh script leads me to believe that, if the networking is not up and ready at the completion of the networking script (which it is not guaranteed to be, otherwise disconnected targets would hang in boot waiting for networking to come up until some timeout). So, that being said, you probably want to either push the mountnfs.sh script as late as reasonable or add some validation/looping to the script itself. That, or roll your own script to do this for you.

 

Run update-rc.d without arguments to see how to invoke the tool to setup the links needed to enable initscripts like mountnfs.sh and read up on the resources online for sysvinit initscripts for more details.

Message 2 of 2
(2,652 Views)