We have one of these devices that we wanted to get working in linux, specifically RHEL6.

Here’s what we did.

First, you need to install the libftdi libraries. There are rpm packages for those on the EPEL site, if we couldn’t get them directly from RedHat. (I can’t remember where we got those from, but it was pretty easy to find.)

The problem we had was that we wanted the device to be automatically created at login or when it was plugged in. And we didn’t want to have to be root to use it. So here is what we set up.

* Create /etc/sysconfig/modules/ftdi_sio.modules
We are creating this so that the ftdi_sio module is automatically loaded at boot

#!/bin/sh
exec /sbin/modprobe ftdi_sio >/dev/null 2>&1

* Create /etc/modprobe.d/ftdi_sio.conf
This is for the options that we would use with the modprobe command

options ftdi_sio vendor=0x0c52 product=0xe402

Note that we got the vendor and product ids by running lsusb when the device was plugged in.

* Create /etc/rc.d/init.d/setup_Seamax
This is a script to run at startup. It adds the ids of the device to a file. However, that file is not created unless the module is loaded, which is why we did the previous two steps. Also note that this script could be better written, I just copied an old script I had around and edited it.

#!/bin/sh

# setup_Seamax

# chkconfig: 2345 99 10
# description: add device info about Seamax

start() {
  echo -n "Setting up Seamax: "
  echo "0c52 e402" > /sys/bus/usb-serial/drivers/ftdi_sio/new_id
  RETVAL=$?
  echo
  return $RETVAL
}

case "$1" in 
  start)
    start
    ;;

  *)
    echo "Usage: $0 {start}"
    exit 1

esac

exit $RETVAL
* Add the script to chkconfig and make sure that it will start on boot
# chkconfig --add setup_Seamax
# chkconfig --list setup_Seamax
setup_Seamax   	0:off	1:off	2:on	3:on	4:on	5:on	6:off

* Create /etc/udev/rules.d/10-uc.rules
This will run when the device is detected and will set the owner/permissions that we want

SUBSYSTEM=="tty", ATTRS{idVendor}=="0c52", ATTRS{idProduct}=="e402", OWNER="kelby", MODE="0666"

REBOOT

After reboot, you should see /dev/ttyUSB0 as being owned by our regular user.

$ ll /dev/ttyUSB0 
crw-rw-rw- 1 kelby dialout 188, 0 Oct 11 09:47 /dev/ttyUSB0

Even though the parted command shows the partition as ext3, you can format it as ext4.

(parted) mklabel gpt
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to
continue?
Yes/No? Yes                                                               
(parted) unit TB
(parted) mkpart primary 0.00TB 10.00TB
(parted) p                                                                
Model: LSI MR9261-8i (scsi)
Disk /dev/sda: 9.99TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  9.99TB  9.99TB  ext3         primary

(parted) quit                                                             
Information: You may need to update /etc/fstab.

[root@mh ~]# mkfs.ext4 /dev/sda1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
305025024 inodes, 2440183808 blocks
122009190 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
74469 block groups
32768 blocks per group, 32768 fragments per group
4096 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848, 512000000, 550731776, 644972544, 1934917632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done       

[root@mh ~]# blkid
/dev/sda1: UUID="1485be35-8319-4a49-b0bd-9ee465303b41" TYPE="ext4" PARTLABEL="primary" PARTUUID="a7f0e3ef-3e72-4bc9-849a-90dde882f07f" 
/dev/sdb1: UUID="6ca14ed0-e5e0-422a-9e82-ea72fc84516b" TYPE="ext4" 
/dev/sdb2: UUID="ceb6e531-4a0a-49b9-9e59-d8f1ae4593c6" TYPE="swap" 
/dev/sdb3: UUID="ab27cea4-abc8-49d8-894f-2c39408b196f" TYPE="ext4" 
[root@mh ~]# blkid|grep sda
/dev/sda1: UUID="1485be35-8319-4a49-b0bd-9ee465303b41" TYPE="ext4" PARTLABEL="primary" PARTUUID="a7f0e3ef-3e72-4bc9-849a-90dde882f07f" 
[root@mh ~]# blkid|grep sda >> /etc/fstab
[root@mh ~]# vi /etc/fstab
[root@mh ~]# mount -a

Go to the elog website and log into one of the logbooks (say DRS4).

Go to “Config”

Go to “Change config file”

Select “Create new logbook”

Give it a name and use template or template_password as the template.

Under “Config” you can add a new user. Don’t check any boxes by subscribe to logbooks. This sends these people email each time a post is made.

First need to install the fftw library. Download it here.

# ./configure --prefix=/code/fftw-3.3.4 --with-pic
# make
# make install

The –with-pic bit was added because the ROOT compilation complained about it.

For ROOT, –with-fftw3-incdir is directory with fftw3.h and –with-fftw3-libdir is directory with fftw library.

# ./configure --prefix=/code/root_v5.34.20 --enable-qt --with-fftw3-incdir=/code/fftw-3.3.4/include --with-fftw3-libdir=/code/fftw-3.3.4/lib
...
Enabled support for asimage, astiff, builtin_afterimage, builtin_ftgl, builtin_glew, builtin_lzma, cintex, explicitlink, fftw3, genvector, krb5, ldap, memstat, mysql, opengl, pgsql, python, reflex, shadowpw, shared, sqlite, ssl, tmva, vdt, x11, xft, xml.

# make
# make install

Normally, I’d do a make -j2 above. But, for some reason, it would just hang at a particular point in the compilation. So I took off the -j2 and things seemed to work.

$ root-config –features
asimage astiff builtin_afterimage builtin_ftgl builtin_glew builtin_lzma cintex explicitlink fftw3 genvector krb5 ldap memstat mysql opengl pgsql python reflex shadowpw shared sqlite ssl tmva vdt x11 xft xml thread

Our VME system is somewhat old, running Scientific Linux 4.7. Unfortunately, I was never able to get a newer version of the operating system working with these computers.

I needed to compile a program on this system. And the first attempt gave me tons of errors:

[root@wahcrate koto]# gcc adclossless.c -o adclossless -lvme
In file included from /usr/include/stdio.h:28,
                 from adclossless.c:1:
/usr/include/features.h:1: error: stray '\31' in program
/usr/include/features.h:1: error: stray '\139' in program
/usr/include/features.h:1: error: stray '\8' in program
/usr/include/features.h:1: error: stray '\2' in program
/usr/include/features.h:1: error: stray '\3' in program

Since I can’t really update this program, my hack to get this working was to copy any header files that were causing errors from a different computer. I copied the following files from a system running Red Hat Enterprise Linux, version 5.

/usr/include/features.h
/usr/include/gconv.h
/usr/include/alloca.h
/usr/include/errno.h
/usr/include/fcntl.h
/usr/include/getopt.h

In case this caused any problems, I renamed the old files first to .OLD. Lastly, the compilation complained about the file /usr/include/endian.h not being present. So I copied that file too.

After that the compilation worked.

[root@wahcrate koto]# gcc adclossless.c -o adclossless -lvme
/tmp/cc5q5khk.o(.text+0x270): In function `main':
: warning: the `gets' function is dangerous and should not be used.

I was also able to start the program.

[root@wahcrate koto]# ./adclossless 

 *************************************************** 
 *****     Beam Test Program for FADC Board     **** 
 *************************************************** 

(Slot:4 type:"none")>>help


    Commands:   read 
    Commands:   write    < value> 
    Commands:   read_vme  slot_number address 
    Commands:   write_vme slot_number address value 

    Commands:   run lb  <2.5, 3.125> 
    Commands:   run dc  
    Commands:   run db  
    Commands:   run ec  
    Commands:   run rnt  

    Commands:   reset_reg     
    Commands:   set slot_number   <1-21>
    Commands:   show
    Commands:   Exit,exit,q 


(Slot:4 type:"none")>>q

Unfortunately, at this point, I have no idea if it will work, since I don’t know how to use it. I will wait and see if it works for the student.

Commands to use to partition a new 3TB disk with parted.

[ ~]# parted /dev/sdg
GNU Parted 2.1
Using /dev/sdg
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Error: /dev/sdg: unrecognised disk label                                  
(parted) mklabel gpt                                                  
(parted) mkpart primary ext3 1 -1                                         
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? C                                                          
(parted) print                                                            
Model: ASMT 2105 (scsi)
Disk /dev/sdg: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart                                                           
Partition name?  []?                                                      
File system type?  [ext2]? ext3                                           
Start? 0%                                                                 
End? 100%

Using percentages worked better than trying to specify the start/stop sectors. Not sure why.

[ ~]# mkfs.ext3 /dev/sdg1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
183148544 inodes, 732566272 blocks
36628313 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
22357 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848, 512000000, 550731776, 644972544

[ ~]# tune2fs -c0 -i0 /dev/sdg1

I installed the following packages first. (I’ll add these to my kickstart file so they’re always installed.)

yum install python-devel \
python-imaging \
python-imaging-devel \
python-tools

My configure command:

./configure --with-python-incdir=/usr/include/python2.4 --with-python-libdir=/usr/lib64 --enable-qt --prefix=/code/root_v5.34.18_rhel5

When this finished, I just ran:

make -j2
make install

The -j2 basically means can use two cores on the cpu for ROOT. Probably could have done -j4, but thought I’d start with -j2 and see how it goes.

Next need to set the following environment variables:

export ROOTSYS=/code/root_v5.34.18_rhel5
export PATH=$PATH:$ROOTSYS/bin
export PYTHONPATH=$ROOTSYS/lib/root:/usr/lib/python2.4:/usr/bin/python
export LD_LIBRARY_PATH=$ROOTSYS/lib

To see what features are installed, can use:

$ root-config --features
asimage astiff builtin_afterimage builtin_ftgl builtin_glew builtin_pcre builtin_lzma cintex explicitlink genvector memstat opengl python reflex shadowpw shared tmva vdt x11 xft thread

TEST THAT IT’S INSTALLED CORRECTLY
In ROOT:

root [0] gSystem->Load("libPyROOT")
(int)0
root [1] TPython::Exec("print 1+1")
2
(Bool_t)1

In python:

>>> import ROOT
>>> import MH
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named MH

(No errors for ROOT is what we want.)

As root, run activate_matlab.sh to start the activation process. You may have to first login to the mathworks account and set up the new computer.

The spare disk on one of my raids failed. Here’s how to replace.

[root@cp x86_64]# ./tw_cli 
//cp> info

Ctl   Model        (V)Ports  Drives   Units   NotOpt  RRate   VRate  BBU
------------------------------------------------------------------------
c8    9650SE-8LPML 8         6        1       0       1       1      -        

//cp> info c8

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397     
p1     DEVICE-ERROR     u?     465.76 GB   976773168     WD-WCANU2051520     
p2     OK               u0     465.76 GB   976773168     WD-WCAS84972002     
p3     OK               u0     465.76 GB   976773168     WD-WCAS84739115     
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264     
p5     OK               u0     465.76 GB   976773168     WD-WCASY8726207     
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

//cps1> maint remove c8 p1
Removing port /c8/p1 ... Done.


//cp> info c8 

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397     
p1     NOT-PRESENT      -      -           -             -
p2     OK               u0     465.76 GB   976773168     WD-WCAS84972002     
p3     OK               u0     465.76 GB   976773168     WD-WCAS84739115     
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264     
p5     OK               u0     465.76 GB   976773168     WD-WCASY8726207     
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

//cp> info c8

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397     
p1     NOT-PRESENT      -      -           -             -
p2     OK               u0     465.76 GB   976773168     WD-WCAS84972002     
p3     OK               u0     465.76 GB   976773168     WD-WCAS84739115     
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264     
p5     OK               u0     465.76 GB   976773168     WD-WCASY8726207     
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

//cp> info c8

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397     
p1     OK               -      465.76 GB   976773168     WD-WMAYP5602245     
p2     OK               u0     465.76 GB   976773168     WD-WCAS84972002     
p3     OK               u0     465.76 GB   976773168     WD-WCAS84739115     
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264     
p5     OK               u0     465.76 GB   976773168     WD-WCASY8726207     
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

//cp> /c8/u0 start rebuild disk=1
Sending rebuild start request to /c8/u0 on 1 disk(s) [1] ... Failed.
(0x0B:0x0031): Unit is ok

//cp> info c8

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397     
p1     OK               -      465.76 GB   976773168     WD-WMAYP5602245     
p2     OK               u0     465.76 GB   976773168     WD-WCAS84972002     
p3     OK               u0     465.76 GB   976773168     WD-WCAS84739115     
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264     
p5     OK               u0     465.76 GB   976773168     WD-WCASY8726207     
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

//cp> /c8 add type=spare disk=1
Creating new unit on controller /c8 ... Done. The new unit is /c8/u1.
WARNING: This Spare unit may replace failed drive of same interface type only.

//cp> info c8

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF    
u1    SPARE     OK             -       -       -       465.753   -      OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397     
p1     OK               u1     465.76 GB   976773168     WD-WMAYP5602245     
p2     OK               u0     465.76 GB   976773168     WD-WCAS84972002     
p3     OK               u0     465.76 GB   976773168     WD-WCAS84739115     
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264     
p5     OK               u0     465.76 GB   976773168     WD-WCASY8726207     
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

//cp> 

If Matlab is very slow to start or stuck in the initializing state or unable to quit, it could be because the LM_LICENSE_FILE is set. And it’s usually set because other programs need it set, so the solution of deleting that variable won’t work. Instead, change the shortcut that starts the program to:

C:\MATLAB\R2013b\matlab.exe -c "C:\MATLAB\R2013b\licenses\license_file.dat"

That will cause it to just look at the license file specified and not do anything with LM_LICENSE_FILE.