Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
7. What is PXE, DHCP, TFTP and NFS and why are they needed by my linuxRT IOC?

LinuxRT is installed on our system using the Preboot Execution Environment (PXE) method of network booting.

We enable the PXE/network-booting method in the BIOS.

In order to use PXE there is a boot-server that will allow our client system to :
(a) Request an IP address (via DHCP)
(b) Download a kernel (via TFTP)

With both of these services in place any system which supports PXE/network-booting
should be able to gain an IP address, fetch a kernel, and boot without an installed operating system.

PXE uses three distinct network protocols that map to three server processes to perform the installation.
In our case, some of the processes run on lcls-dev1 (LCLSDEV daemon)

Both  DHCP and TFTP services run on the LCLSDEV host 'dhcp3' maintained by SCCS.

(a) Dynamic Host Configuration Protocol (DHCP)

PXE uses DHCP to deliver initial network configuration options to client nodes.
The DHCP server supplies the PXE boot plug-in with
(i) IP address
(ii) TFTP server address
(iii) Stage 1 image boot-loader name from which to download and execute the image.

As the supplied PXE installation environments are non-interactive and will unconditionally reinstall a client machine,
we have the client associate its MAC address with a specific OS installation before starting the PXE boot.

The configuration information, in our case, in addition to IP/MAC address, includes a hostname and a pointer to the Master Starupt script in afs for our IOC.
It has an optional root-path variable pointing to the afs area which hosts the boot image that is served via TFTP.
This can be over-ridden as will be seen later.

When the Linux server is rebooted or power-cycled, PXE will attempt the network booting method first
and as a first step it will contact the DHCP server to retrieve the network configuration information.

Hence, every new linuxRT ioc (host) needs to be added to the DHCP server configuration file in afs.

This file is in /afs/slac/service/dhcp-pxe/dhcpd.conf

Note that the DHCP service running on dhcp3 is intended only for booting embedded devices like our linuxRT servers that are connected to the LCLSDEV and SSRL subnets.

The MAC addresses for such devices must be registered in CANDO and assigned fixed IP addresses.

The IP/MAC address of the primary ethernet that will fetch the linuxRT boot image is defined here.
To add a new host to the DHCP configuration, contact Thuy.

After a new ioc is added to dhcpd.conf, the DHCP service must be restarted.

 

To restart DHCP Server

 

From a Unix command line:

 

remctl dhcp3 dhcp check

 

remctl dhcp3 dhcp restart

 

 

For help:

 

remctl dhcp3 dhcp help

Currently only Thuy, Ernest and a couple of others have permissions to perform this restart on dhcp3.

Here's is an example - ioc-b34-bd32:

host ioc-b34-bd32 {
# SuperMicro (INTELx86)
#
hardware ethernet 00:25:90:D1:95:1E;
fixed-address 134.79.218.190;
option host-name "ioc-b34-bd32";
if ( substring( option vendor-class-identifier, 0, 5 ) = "udhcp" ) {
filename "/afs/slac/g/lcls/epics/iocCommon/ioc-b34-bd32/startup.cmd";
option root-path "afsnfs1:/afs/slac:/afs/slac";
}
}

To find out more about how our linux server boots up linuxRT, click on the following link:

 How does the Linux Server boot up linuxRT?


(b) Trivial File Transfer Protocol (TFTP)

PXE uses TFTP that defines a simple UDP protocol for delivering files over a network.
PXE delivers kernels and initial bootstrap software to client nodes using TFTP.

tftpboot is mounted in afs area in LCLSDEV on the server dhcp3, which runs both the TFTP an DHCP services:

 /tftpboot -> /afs/slac.stanford.edu/service/dhcp-pxe/tftpboot/

The iocs retrieve the linuxRT boot image from the TFTP server from the following location:

/afs/slac/g/lcls/tftpboot/linuxRT/boot

In this location, there are several linuxRT-x86 bootimages.
These were custom-built by T.Straumann for the various Linux Servers/IPCs that we currently have setup to boot with linuxRT OS.

Of these images, '3.14.12-rt9' is the latest and it has in-built support for the
Broadcom networking ethernet chipset that are used in our dev Poweredge Dell Servers.

(c) Network File System (NFS)

The NFS service is used by the installation kernel to read all of the packages necessary to the installation process.

NFS services run on the LCLSDEV hosts afsnfs1 and afsnfs2  maintained by SCCS.

 This service makes available the boot directory to all linuxRT targets that boot as diskless clients.

All clients have read-only permissions to this directory.

The linuxRT iocs need some additional NFS Mount Points to write their data some where.

surrey04b is an NFS Appliance and is used by iocs for data and have both read and write permissions to the data directory ($IOC_DATA).

In LCLSDEV, we must obtain permissions for the iocs to write to the $IOC_DATA directory.

 Fill out an online form provided by SCCS to obtain permissions for your ioc to write to this directory:

https://www-rt.slac.stanford.edu/rt3/SelfService/Forms/IocNfs.html

...

Panel
13. How do I start my ioc and monitor it?

Example, from any lcls-dev host (a) You can directly ssh to your ioc as 'laci' from any LCLSDEV host:

ssh laci@ioc-b34-bd32

$ cd /afs/slac/g/lcls/epics/iocCommon/ioc-b34-bd32 Ensure that 'startupConsole-laci-rt.cmd' is in your current directory.
Start the ioc as a foreground process:
./startupConsole-laci-rt.cmd

Panel

Alternately, you can get a console to the target ioc-b34-bd32 using iocConsole and ssh as user "laci" from there:

iocConsole ioc-b34-bd32

When prompted to enter the "login" username as below, enter "laci".

Welcome to Buildroot

ioc-b34-bd32 login:

No password is needed. Just hit Enter an you will get the shell prompt "$".

 Ensure the caRepeater process is running on this CPU.

(b) Ensure your IOC is not already running as below:

$ screen -ls

No Sockets found in /tmp/uscreens/S-laci. 

You can also look for your application under all running processes and make sure one is not already running:

If it was running already, then you may get something as below:

$ ps -ef | grep MyTest

 2085 laci       0:07 bin/MyTest iocStartup.cmd 

(c) Change to $IOC/ioc-b34-bd32 and from there start your ioc as a foreground process as below: 

$ pwd

/home/laci

$ ls -lt

total 0

lrwxrwxrwx    1 root     lcls            45 Nov  5 15:11 bld -> /afs/slac/g/lcls/epics/iocCommon/ioc-b34-bd32

$ cd bld
Ensure that 'startupConsole-laci-rt.cmd' is in your current directory.

$ ls -lt | grep startupConsole-laci-rt.cmd

-rwxrwxr-x    1 8396     1020          1225 Nov  5 15:22

14. How do I start my ioc automatically every time my server boots up?

You can start your ioc as a background process that will start up everytime your Linux server reboots, as follows:

In $IOC/ioc-b34-bd32, you can add another script 'startup-laci-rt.cmd' that lets you start your EPICS-based ioc as a background process in your host.

Invoke this script from  $IOC/ioc-b34-bd32/startup.cmd:

su laci -c /usr/local/lcls/epics/iocCommon/eioc-b34-bd32/startup-laci-rt.cmd

The above line starts another shell so that the user called "laci" can start the IOC Process as opposed to the "root" account

Remember, the kernel modules can only be loaded onto the kernel with "root" permissions but iocs can be run by users.

'startup-laci-rt.cmd' executes the EPICS-based IOC startup script and detaches it using the linux screen program

It contains the following lines which are similar to what we have in startupConsole-laci-rt.cmd:

Start the ioc as a foreground process:

./startupConsole-laci-rt.cmd

You can observe the viocb34bd32 go through the boot process.

If you had an EVR230 and it was initialized correctly, you may see something as below before iocInit():

ErConfigure(0, 0, 0, 0, 1)

Try EvrOpen, device = /dev/era3

EVR Found with Firmware Revision 0x11000007

Found a PMC_EVR /dev/era3

Verify if all your drivers, modules and databases loaded correctly.

If you used iocConsole, you can scroll back and forth in the screen using <CTRL> A-[ and <CTRL>-A-]

If everything went well, you must get your interactive ioc shell prompt as below:

vioc-b34-bd32> 

(d) Once the ioc is started, you can interact with vioc-b34-bd32 from any LCLSDEV host via ssh laci@ioc-b34-bd32:

To attach a screen session:

screen  -r  vioc-b34-bd32

To detach from a screen session:

<CTRL> A D

(e) To exit an EPICS IOC Process type exit at the IOC Shell and you will be back at the "$" prompt:

vioc-b34-bd32>exit

If the IOC hangs too long while trying to exit, use <CTRL> C

Panel
14. How do I start my ioc automatically every time my server boots up?

You can start your ioc as a background process that will start up everytime your Linux server reboots, as follows:

In $IOC/ioc-b34-bd32, you can add another script 'startup-laci-rt.cmd' that lets you start your EPICS-based ioc as a background process in your host.

Invoke this script from  $IOC/ioc-b34-bd32/startup.cmd:

su laci -c /usr/local/lcls/epics/iocCommon/eioc-b34-bd32/startup-laci-rt.cmd

The above line starts another shell so that the user called "laci" can start the IOC Process as opposed to the "root" account

Remember, the kernel modules can only be loaded onto the kernel with "root" permissions but iocs can be run by users.

'startup-laci-rt.cmd' executes the EPICS-based IOC startup script and detaches it using the linux screen program

It contains the following lines which are similar to what we have in startupConsole-laci-rt.cmd:

export EPICS_IOCS=/afs/slac/g/lcls/epics/iocCommon

# Lock Kernel in memory
ulimit -l unlimited
# Run with real-time priorities
ulimit -r unlimited

# Set umask for the laci user
umask 002

# EPICS IOC Application Real-time Process

cd $EPICS_IOCS/ioc-b34-bd32/vioc-b34-bd32

 screen -h 8192 -c screenrc -dm -S vioc-b34-bd32 bin/MyTest iocStartup.cmd 

The above line will automatically start your ioc and have it running in the background, every time your server reboots

To view the console output from the running ioc, you can attach the screen process to it, as described below:

(1)   ssh into the ioc-b34-b32 as user  "laci":

ssh laci@ioc-b34-bd32

(2) To see the list of all EPICS iocs running on this CPU, at the console type:

screen  -ls

(3) To attach to vioc-b34-b32 that is running MyTest application:

screen -r vioc-b34-b32

export EPICS_IOCS=/afs/slac/g/lcls/epics/iocCommon

# Lock Kernel in memory
ulimit -l unlimited
# Run with real-time priorities
ulimit -r unlimited

# Set umask for the laci user
umask 002

# EPICS IOC Application Real-time Process

cd $EPICS_IOCS/ioc-b34-bd32/vioc-b34-bd32

 screen -h 8192 -c screenrc -dm -S vioc-b34-bd32 bin/MyTest iocStartup.cmd 

The above line will automatically start your ioc and have it running in the background, every time your server reboots

To view the console output from the running ioc, you can attach the screen process to it, as described below:

(1)   ssh into the ioc-b34-b32 as user  "laci":

ssh laci@ioc-b34-bd32

(2) To see the list of all EPICS iocs running on this CPU, at the console type:

screen  -ls

(3) To attach to vioc-b34-b32 that is running MyTest application:

screen -r vioc-b34-b32

(4) To detach screen process from vioc-b34-bd32, press:

While pressing <CTRL> key, press ''A" and then 'D".

(5) You can also connect to vioc-b34-bd32 from any linux host, not just from ioc-b34-bd32.

This method uses the python-based iocConsole program.

ssh into LCLSDEV host (example, lcls-dev2) an type:

iocConsole  vioc-b34-bd32

Panel
15. Which script calls what and what parameters are passed from one to another?

Here's a flowchart that shows which script calls what and some of the important parameters that can be passed from one to another:

FlowChart.pdf

...