Difference between revisions of "MAS OS setup"

From MCEWiki
(Install)
 
(49 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Ubuntu 6.06 LTS server''':  This is the most supported OS.  The instructions below are mostly for 6.06.
+
{{Related|MAS}}
 +
= Supported operating systems =
  
'''Ubuntu 7.10 server''':  We can support this now.  Patched kernels are available.  In the text below, major deviations from the 6.06 installation procedure are identified.
+
We use Ubuntu.
  
'''Ubuntu 8.04 LTS server''':  This version is new enough that the kernel build system isn't producing portable kernel packagesMAS works with 8.04 but I don't want to install too many 8.04 systems until they clean up the build system.
+
* We only support LTS releasesCurrently, we support:
 +
** 18.04
 +
** 16.04
 +
** 14.04
  
= Install additional ubuntu packages =
+
= Ubuntu 16.04 and later =
  
== Disable CDROM seeking ==
+
The removal of the bigphysarea requirement from the kernel module means it's much easier to install MAS now.  Because you don't need to rebuild your kernel, it should be possible to simply checkout the MAS trunk.  Start by skipping down to the [[#Download (checkout) MAS and mce_script|Download (checkout) MAS and mce_script]] step, and then continue with installing MAS and MCE script.
  
The package manager knows that you have the Ubuntu disk and will say things like
+
= Ubuntu 14.04 =
Media change: please insert the disc labeled
 
'Ubuntu-Server 6.06.1 _Dapper Drake_ - Release i386 (20060807.1)'
 
  
To disable this (and download packages from the internet instead), open /etc/apt/sources.list
+
The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of syncIt's worth a shot though.
  sudo pico /etc/apt/sources.list
 
and remove (comment) the line
 
deb cdrom:[Ubuntu-Server 6.06.1 _Dapper Drake_ - Release i386 (20060807.1)]/ dapper main restricted
 
  
== Install required packages ==
+
After installing Ubuntu 14.04, get the install tarball:
  
  sudo apt-get update
+
  wget http://e-mode.phas.ubc.ca/mce/pc_install/install_tools/mce_install_ubuntu_14.04.tar.gz
  sudo apt-get install build-essential subversion emacs21 libreadline5-dev
+
  tar -xzf ubuntu_14.04_install.tar.gz
 +
cd install/
  
== Enable universe repository and install GGV ==
+
== Install additional ubuntu packages ==
  
Uncomment the line in /etc/apt/sources.list so it says
+
From that install folder, run
  deb http://us.archive.ubuntu.com/ubuntu/ dapper universe
+
  bash install.bash
  
Then run
+
It can't hurt to run this a couple of times to make sure all dependencies are resolved.
sudo apt-get update
 
sudo apt-get install gnome-gv
 
  
gnome-gv doesn't exist on 7.10, you'll have to settle for
+
== Bigphysarea kernel patch ==
sudo apt-get install gv
 
  
== Install packages that you shouldn't even want to install (soon to be optional) ==
+
You can either download the compiled kernels or build them from scratch.
sudo apt-get install tcsh
 
  
== Install desktop manager (optional) ==
+
From install folder, run EITHER
  sudo apt-get install ubuntu-desktop gdm
+
  bash kernel_download.bash
 +
or
 +
bash kernel_build.bash
  
== Install python stuff ==
+
Compiled kernels currently exist for the x64 architecture.
  
The 'pyth' branch MAS has experimental support for python using wx and matplotlib:
+
Then when one or the other of those has succeeded, install them:
  sudo apt-get install python-dev python-wxglade python-matplotlib python-numarray-ext swig
+
  bash kernel_install.bash
  
== Install unpackaged libraries ==
+
You can now proceed to the section below titled "[[#Configure_the_system_for_MCE_users|Configure the system for MCE users]]".
  
MAS uses libconfig to manage its configuration files. The webpage is here: [ http://www.hyperrealm.com/libconfig/ ].  To install libconfig run the following:
+
= Ubuntu 12.04 and earlier =
  
  wget http://www.hyperrealm.com/libconfig/libconfig-1.3.tar.gz
+
See [[MAS OS setup on obsolete systems]]
  tar -xzf libconfig-1.3.tar.gz
 
  cd libconfig-1.3
 
  ./configure
 
  make
 
  sudo make install
 
  
To make the system aware of this library, add "/usr/local/lib" to /etc/ld.so.conf and run "sudo ldconfig".  i.e.
+
= Configure the system for MCE users =
  echo /usr/local/lib | sudo tee -a /etc/ld.so.conf
 
  sudo ldconfig
 
  
On newer systems (Ubuntu 7.10) you can do this instead:
+
== Setup environment for MCE user ==
  echo /usr/local/include | sudo tee /etc/ld.so.conf.d/libconfig.conf
 
  sudo ldconfig
 
  
= Download and install MAS kernel patch =
+
We tend to assume that a single user and group will have dominion over the MCE software, scripts, and data.  We often assume that this user will be called "mce".  But it doesn't need to be.  Even if multiple users are running things through their own accounts it is likely useful to have a single group that can be used to manage access to the data.
  
== Download ==
+
Anyway, to set up a reasonable MCE user, see [[MAS user setup]].
  
If you're not compiling the kernel from scratch, download the binary packages from UBC:
+
All users using the MCE will need to define some environment variables to use the scriptsSee the above link for lines to add to your '''.bashrc'''.
wget http://e-mode.phas.ubc.ca/~mhasse/mce/kernel-headers-2.6.15.7-bigphys_10.00.Custom_i386.deb
 
  wget http://e-mode.phas.ubc.ca/~mhasse/mce/kernel-image-2.6.15.7-bigphys_10.00.Custom_i386.deb
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/extras.patch
 
  
For '''Ubuntu 7.10''', get these instead:
+
== System umask ==
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-headers-2.6.22.9-bigphys_10.00.Custom_i386.deb
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-image-2.6.22.9-bigphys_10.00.Custom_i386.deb
 
  
 +
You may want to set the system umask to make for a system where it's easier to share
 +
Set the umask for all users to give write access for their group by default.
  
On '''Ubuntu 7.10''' machines '''without PAE''' hardware (i.e. a maximum of 4G of system memory) use:
+
Edit /etc/profile and change the "umask 022" line to
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-headers-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
+
  umask 002
  wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-image-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
 
  
== Install ==
+
Edit /etc/login.defs and find the line that start "# UMASK" and change it to
 +
UMASK          002
  
Then, install the packages using dpkg:
+
== Folders ==
sudo dpkg -i kernel-headers-2.6.15.7-bigphys_10.00.Custom_i386.deb
 
sudo dpkg -i kernel-image-2.6.15.7-bigphys_10.00.Custom_i386.deb
 
The "image" file might complain about symbolic links, no big deal.
 
  
On '''Ubuntu 7.10''', instead install these:
+
mce_script assumes that /data/cryo/ exists and can be manipulated. To create something reasonable:
sudo dpkg -i linux-headers-2.6.22.9-bigphys_10.00.Custom_i386.deb
 
sudo dpkg -i linux-image-2.6.22.9-bigphys_10.00.Custom_i386.deb
 
  
Why are these ones called "linux" instead of "kernel"? I think it's because I got them from Ubuntu repositories instead of kernel.org.
+
  MCE_USER=mce
 +
MCE_GROUP=mce
 +
sudo mkdir /data
 +
sudo chown $MCE_USER:$MCE_GROUP /data
 +
sudo chmod g+ws /data
 +
mkdir /data/cryo/
  
On '''Ubuntu 7.10''' machines '''without PAE''' install these:
 
sudo dpkg -i linux-headers-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
 
sudo dpkg -i linux-image-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
 
  
The '''Ubuntu 8.04''' kernel has a sound-card driver that lays claim to the Motorola DSP on the PCI card.  We have to blacklist this module to prevent it from trying to configure the card as a sound card.  Add the following to the bottom of /etc/modprobe.d/blacklist :
+
= Download (checkout) MAS and mce_script =
# Conflicts with Astro-cam PCI card!!
 
blacklist snd_asihpi
 
  
== Patch ==
+
See [[MAS svn repository]].
  
This makes it possible to compile against the kernel package as though it had been locally compiled originally.
+
= Compile and install MAS =
cd /usr/src/kernel-headers-2.6.15.7-bigphys/
 
sudo patch -p1 < ~/extras.patch
 
  
This step is not necessary for Ubuntu 7.10It may be necessary to link the kernel headers into /lib/modules:
+
The following procedure outlines the default situation, where MAS is being installed on a computer containing only one fibre cardFor information on running MAS with multiple fibre cards in one computer, see [[Multicard MAS]].
  sudo ln -s /usr/src/linux-headers-2.6.22.9-bigphys/ /lib/modules/2.6.22.9-bigphys/build
 
  
== Boot menu ==
+
== Makefile.svn ==
  
We need to add the kernel option that causes bigphys to allocate boot memory for our driverIn older versions of MAS (especially ACT's stable release) we also need to disable "acpi"It's a good idea to not run any DSP/MCE commands until all of your kernel options are in place.
+
MAS uses autoconf for some basic configuration stuffAfter checking out MAS from the SVN repository the ''first'' time, you need to bootstrap the autoconf processTo simplify this, the Makefile.svn file will automate the process.  From the MAS source folder run
  
Having installed the kernel "image" package, the kernel should show up in the boot loader (grub)'s kernel list.
+
  make -f Makefile.svn
  
=== Editing the kernel list ===
+
If successful, this will create the "./configure" script. This step is only required on fresh check-outs of the repositoryIf you already have a ./configure script, even if it's out of date, you can skip this step.  (After having been bootstrapped the
As root (or using sudo), edit the file /boot/grub/menu.lst .   
+
first time, the build system is smart enough to know when it needs to regenerate itself.)
sudo pico /boot/grub/menu.lst
 
Go to the list of kernels, below the line "## ## End Default Options ##", and find the new kernel entry. On Ubuntu 6.06, it should be the third block (index 2), and look like this:
 
  
title          Ubuntu, kernel 2.6.15.7-bigphys
+
Note: this procedure requires autoconfIf it's not installed, install it with:
  root            (hd0,0)
 
kernel          /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash
 
initrd          /initrd.img-2.6.15.7-bigphys
 
savedefault
 
boot
 
  
Add the kernel options to the "kernel" line, producing either this (recent MAS):
+
  sudo apt-get install autoconf
kernel          /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash bigphysarea=8192
 
or this (old MAS, esp. ACT):
 
kernel          /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash bigphysarea=8192 acpi=off
 
  
Save and close the file, and reboot to test this kernel. If the kernel "works", you can edit menu.lst again and change the value of the "default" option to point to this kernel:
+
== ./configure ==
default    2
 
  
'''Ubuntu 7.10 and later''': the kernel packages install a bit differently so the block will likely be the first one in the list.  The 'kernel' line  must change from something like
+
Once the configure script exists, run it to generate the build system (ie. the Makefiles).  The biggest thing you usually need to tell it is what the basic username and group should be for mce dataAlso, there are a few options for the driver and some stupid python stuff.
kernel          /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash
 
to
 
kernel          /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash bigphysarea=8192
 
Note that the long hexadecimal serial numbers are system specifc and yours are probably different than these onesLeave them as they are and just add the new kernel options.  The "default" option will probably be
 
default    0
 
but it's a good idea to count these things out for yourself.
 
  
= Configure the system for mce users =
+
From the MAS source folder, run
  
== Permissions and umask ==
+
./configure
  
Set the umask for all users to give write access for their group by default.
+
Some useful options:
 +
  --disable-driver        suppress driver compilation/installation
 +
  --disable-bigphysarea  compile driver without bigphysarea support
 +
  --disable-config2      suppress mas.cfg and mce.cfg generation/installation
 +
  --enable-multicard      build a version of MAS which can drive multiple fibre cards.  (See [[Multicard MAS]] for specifics.)
 +
  --with-user=USER        set default MCE user
 +
  --with-group=GROUP      set default MCE group
 +
  --with-kernel-dir=DIR  set kernel build directory (typically automatically determined)
  
Edit /etc/profile and change the "umask 022" line to
+
Run
umask 002
 
  
Edit /etc/login.defs and find the line that start "# UMASK" and change it to
+
./configure --help
UMASK          002
 
  
Any users wishing to use MCE under their own accounts should be added to the "mce" group and should have "mce" as their primary groupTheir umask must be set properly, or other users will not be free to manipulate shared files.
+
for a full listWhen running, configure will complain if it cannot find something, and even suggest what package you need to install.
  
To setup additional system users, see the page on [[MAS user setup]].
+
== mce.cfg ==
  
== Folders ==
+
After running configure, but before running make, you must specify a template file (mce.cin) which will be used to generate  the hardware configuration file (mce.cfg).  Full details of this procedure are given in the [[mce.cfg]] page, but briefly:
  
This is the sort of thing that should be done by an install script...
+
# copy an appropriate template from <code>config2/templates</code> to <code>config2/mce.cin</code>
 +
# edit the <code>config2/mce.cin</code> file to describe your MCE.
  
Data directory:
+
The configuration file will be installed automatically when <code>make install</code> is run below. This entire step can be skipped if you passed --disable-config2 to configure above, but note that MAS will not function without mce.cfg and mas.cfg installed.
sudo mkdir /data
 
  sudo chown mce:mce /data
 
sudo chmod g+ws /data
 
mkdir /data/cryo/
 
  
Configuration directory:
+
== make ==
sudo mkdir /etc/mce
 
sudo chgrp mce /etc/mce
 
sudo chmod g+ws /etc/mce
 
  
 +
This often works.
  
= If necessary, branch MAS and mce_script =
+
make clean; make
  
You can work with a complete checked-out tree, or not.
+
=== Troubleshooting ===
 +
Sometimes after doing an SVN update <code>make</code> doesn't work but instead returns the cryptic message:
  
In the first case:
+
*** No rule to make target `defaults/masdefault.m4', needed by `aclocal.m4'.
  
svn checkout svn://e-mode.phas.ubc.ca/mas
+
In this case, it's necessary to force a rebuild of the build system manually by running
svn copy mas/trunk mas/branch/{your_project_name}
 
svn commit mas
 
  
Alternately, do the copy directly on the svn server (it is automatically committed):
+
  make -f Makefile.svn
  svn copy svn://e-mode.phas.ubc.ca/mas/trunk svn://e-mode.phas.ubc.ca/mas/branch/{your_project_name}
+
./configure
  
For mce_script, replace "mas" with "mce_script".
+
See the [[#Makefile.svn|Makefile.svn section]] above for further details.
  
Then check out the appropriate branch (or the whole tree) on the new machine.
+
== Test the driver ==
  
= Download (checkout) MAS and mce_script =
+
It is wise to test that the driver does not kill your machine before installing it to load on boot.  After compiling do:
  
See the page on [[ MAS svn repository ]]
 
 
= Compile and install MAS =
 
 
== Build the driver ==
 
 
By default, the driver will build with bigphysarea support enabled.  To override build options, create a file Makefile.local in the "driver" folder, and add lines like:
 
 
# BIGPHYS=0 disables bigphysarea frame-buffering
 
BIGPHYS = 0
 
 
or
 
 
# FAKEMCE=1 provides simple emulation of a PCI card/MCE for testing
 
FAKEMCE = 1
 
 
or
 
 
# REALTIME=1 makes use of realtime interrupt routines
 
REALTIME = 1
 
 
In Makefiles, there should not be comments on the same line as the variable definitions.  On a system running the bigphys kernel with the correct PCI card, Makefile.local will be created at compile time if it does not already exist.  It can be left empty.
 
 
Anyway, once Makefile.local is setup, type
 
cd mas
 
make clean; make
 
 
From the driver folder we can test the driver:
 
 
  cd driver
 
  cd driver
  ./reload
+
  sudo ./reload
./mknodes
 
  
Note that since "reload" first unloads the driver if it is present, and then loads the driver from the current folder, it may report an "ERROR" message if the first step fails, even though the driver is successfully loaded.  The definitive way to check that the driver is loaded is
+
This will load the driver, which should then try to talk to the SDSU PCI card if it is installed.  Note that since "reload" first unloads the driver if it is present, and then loads the driver from the current folder, it may report an "ERROR" message if the first step fails, even though the driver is successfully loaded.  The definitive way to check that the driver is loaded is
   cat /proc/mce_dsp
+
   cat [[/proc/mce_dsp]]
  
 
If this file does not exist, the driver isn't loaded.  If the cat prints out a bunch of low-level driver information, you're in good shape.
 
If this file does not exist, the driver isn't loaded.  If the cat prints out a bunch of low-level driver information, you're in good shape.
  
If you're satisfied that the driver works, install the driver with the command
+
== sudo make install ==
 +
 
 +
If you're satisfied that the driver works, install the whole thing.  Go back up to the MAS base folder and run
  
 
  sudo make install
 
  sudo make install
  
This should put mce_dsp.ko into /lib/modules/2.6.15.7-bigphys/kernel/drivers/misc/, and re-scan the module dependencies.  To get the driver to load on boot you must add manually the following lines to /etc/rc.local:
+
This will do the following:
  
modprobe mce_dsp
+
*install the kernel driver, <code>driver/mce_dsp.ko</code>, into <code>/lib/modules/$(uname -r)/kernel/drivers/misc/</code>, and re-scan the module dependencies.
/home/mce/mas/driver/mknodes
+
*install the MAS binaries from <code>applications/</code> and the scripts from <code>script/</code> into <code>/usr/mce/bin</code>
sudo -u mce /usr/mce/bin/maslog_server
+
*install the MAS udev ruleset <code>scripts/91-mas.rules</code> into <code>/etc/udev/rules.d/</code>.  These udev rules will ensure that the mce_dsp module is loaded and the MAS device nodes are created at boot time.  You can get udev to run these rules immediately, which will result in /dev being populated with the mce devices, by running:
  
 +
  sudo udevadm trigger
  
 +
:or, else, you can make the nodes yourself by running mas_mknodes.
 +
*install the mas logging daemon script <code>/etc/init.d/mas</code> init script.  The driver can then be started/restarted as desired through this script:
  
== Install MAS config files ==
+
/etc/init.d/mas restart
  
Hardware and binary config files live in /etc/mce/ (created above).
+
:The driver will automatically be set to load on boot.  To disable this, remove the symbolic link "/etc/rc2.d/S99mas".
 +
*install the hardware configuration file, <code>config2/mce.cfg</code>, and the MAS configuration file, <code>config2/mas.cfg</code> to <code>/etc/mce/</code>, assuming there aren't versions already there.
  
Make sure you use the hardware config (mce_*.cfg) file appropriate for your system.  Racks with 4 readout cards should use mce_v1.cfg; small sub-racks with readout card slots should use mce_v2.cfg. 
+
= Install mce_script =
  
cd ~/mas/config
+
Users have the option of running the MCE scripts from an svn working copy, or of running the MCE scripts from an "installed" copyTalk to your MAS technician about which option is best for you.
cp mce_v1.cfg /etc/mce/mce.cfg
 
  cp mas.cfg /etc/mce/mas.cfg
 
  
= Install mce_script =
+
== Running from an svn working copy ==
  
The mce_script files are designed so that users can fairly easily run a different set of scripts.  We will install a system default set in /usr/mce/mce_script
+
Checkout the tree directly into /usr/mce:
  
 
  cd /usr/mce
 
  cd /usr/mce
  svn checkout svn://e-mode.phas.ubc.ca/mce_script/branch/{your_experiment} mce_script
+
  svn checkout svn://e-mode.phas.ubc.ca/mce_script/trunk mce_script
  
Current experiments include ACT and SPIDER.
+
== Running from an installed copy ==
  
== mas_env.bash ==
+
Checkout the tree into your code folder; then make and install:
  
To set up the environment and path to use these scripts and idl codes, a user should do "source mas_env.bash". (This file used to live in mas/config, but has been moved into mce_script/template.)  Non-developer users can source /usr/mce/mce_script/template/mas_env.bash directly; advanced users may want to keep their own copy (or several different copies) in their home folder.
+
  cd code
 +
svn checkout svn://e-mode.phas.ubc.ca/mce_script/trunk mce_script
 +
make
 +
sudo make install
  
Note that MAS/mce_script scripts should *not* source mas_env.bash!  The whole point of it is that paths should be flexible.
 
  
 
== .bashrc ==
 
== .bashrc ==
  
To have bash start up with the MAS variables defined, and the paths ready, add the following lines to .bashrc :
+
Add a few lines to .bashrc to update your PATH, PYTHONPATH, and to define the MAS_* variables.  The new way, using [[mas_var]], is:
 +
eval `/usr/mce/bin/mas_var -e -s`
  
 +
The old way, which will probably still work for a while:
 +
 
  export MAS_ROOT=/usr/mce/mce_script/
 
  export MAS_ROOT=/usr/mce/mce_script/
 
  source $MAS_ROOT/template/mas_env.bash
 
  source $MAS_ROOT/template/mas_env.bash
 
  export IDL_PATH="<IDL_DEFAULT>:$MAS_IDL/mas"
 
  export IDL_PATH="<IDL_DEFAULT>:$MAS_IDL/mas"
  
While you're in there, you may want to define a few aliasesIn particular, I always uncomment the alias ll='ls-l' line.
+
== Configuration data ==
 +
 
 +
Example configuration files (especially [[experiment.cfg]]) are kept in mce_script/template.  MAS, by default, expects user configuration data to be in /usr/mce/config.  Users should copy the template/ files to /usr/mce/config/, and then make configuration adjustmentsAfter install mce_script, you can copy the template config from it with:
 +
 
 +
sudo cp -r /usr/mce/mce_script/template /usr/mce/config
 +
sudo chown -R mce /usr/mce/config
 +
 
 +
[[Category:MAS]]

Latest revision as of 14:05, 26 September 2019

Related topics:

Supported operating systems

We use Ubuntu.

  • We only support LTS releases. Currently, we support:
    • 18.04
    • 16.04
    • 14.04

Ubuntu 16.04 and later

The removal of the bigphysarea requirement from the kernel module means it's much easier to install MAS now. Because you don't need to rebuild your kernel, it should be possible to simply checkout the MAS trunk. Start by skipping down to the Download (checkout) MAS and mce_script step, and then continue with installing MAS and MCE script.

Ubuntu 14.04

The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of sync. It's worth a shot though.

After installing Ubuntu 14.04, get the install tarball:

wget http://e-mode.phas.ubc.ca/mce/pc_install/install_tools/mce_install_ubuntu_14.04.tar.gz
tar -xzf ubuntu_14.04_install.tar.gz
cd install/

Install additional ubuntu packages

From that install folder, run

bash install.bash

It can't hurt to run this a couple of times to make sure all dependencies are resolved.

Bigphysarea kernel patch

You can either download the compiled kernels or build them from scratch.

From install folder, run EITHER

bash kernel_download.bash

or

bash kernel_build.bash

Compiled kernels currently exist for the x64 architecture.

Then when one or the other of those has succeeded, install them:

bash kernel_install.bash

You can now proceed to the section below titled "Configure the system for MCE users".

Ubuntu 12.04 and earlier

See MAS OS setup on obsolete systems

Configure the system for MCE users

Setup environment for MCE user

We tend to assume that a single user and group will have dominion over the MCE software, scripts, and data. We often assume that this user will be called "mce". But it doesn't need to be. Even if multiple users are running things through their own accounts it is likely useful to have a single group that can be used to manage access to the data.

Anyway, to set up a reasonable MCE user, see MAS user setup.

All users using the MCE will need to define some environment variables to use the scripts. See the above link for lines to add to your .bashrc.

System umask

You may want to set the system umask to make for a system where it's easier to share Set the umask for all users to give write access for their group by default.

Edit /etc/profile and change the "umask 022" line to

umask 002

Edit /etc/login.defs and find the line that start "# UMASK" and change it to

UMASK           002

Folders

mce_script assumes that /data/cryo/ exists and can be manipulated. To create something reasonable:

MCE_USER=mce
MCE_GROUP=mce
sudo mkdir /data
sudo chown $MCE_USER:$MCE_GROUP /data
sudo chmod g+ws /data
mkdir /data/cryo/


Download (checkout) MAS and mce_script

See MAS svn repository.

Compile and install MAS

The following procedure outlines the default situation, where MAS is being installed on a computer containing only one fibre card. For information on running MAS with multiple fibre cards in one computer, see Multicard MAS.

Makefile.svn

MAS uses autoconf for some basic configuration stuff. After checking out MAS from the SVN repository the first time, you need to bootstrap the autoconf process. To simplify this, the Makefile.svn file will automate the process. From the MAS source folder run

 make -f Makefile.svn

If successful, this will create the "./configure" script. This step is only required on fresh check-outs of the repository. If you already have a ./configure script, even if it's out of date, you can skip this step. (After having been bootstrapped the first time, the build system is smart enough to know when it needs to regenerate itself.)

Note: this procedure requires autoconf. If it's not installed, install it with:

 sudo apt-get install autoconf

./configure

Once the configure script exists, run it to generate the build system (ie. the Makefiles). The biggest thing you usually need to tell it is what the basic username and group should be for mce data. Also, there are a few options for the driver and some stupid python stuff.

From the MAS source folder, run

./configure

Some useful options:

 --disable-driver        suppress driver compilation/installation
 --disable-bigphysarea   compile driver without bigphysarea support
 --disable-config2       suppress mas.cfg and mce.cfg generation/installation
 --enable-multicard      build a version of MAS which can drive multiple fibre cards.  (See Multicard MAS for specifics.)
 --with-user=USER        set default MCE user
 --with-group=GROUP      set default MCE group
 --with-kernel-dir=DIR   set kernel build directory (typically automatically determined)

Run

./configure --help

for a full list. When running, configure will complain if it cannot find something, and even suggest what package you need to install.

mce.cfg

After running configure, but before running make, you must specify a template file (mce.cin) which will be used to generate the hardware configuration file (mce.cfg). Full details of this procedure are given in the mce.cfg page, but briefly:

  1. copy an appropriate template from config2/templates to config2/mce.cin
  2. edit the config2/mce.cin file to describe your MCE.

The configuration file will be installed automatically when make install is run below. This entire step can be skipped if you passed --disable-config2 to configure above, but note that MAS will not function without mce.cfg and mas.cfg installed.

make

This often works.

make clean; make

Troubleshooting

Sometimes after doing an SVN update make doesn't work but instead returns the cryptic message:

*** No rule to make target `defaults/masdefault.m4', needed by `aclocal.m4'.

In this case, it's necessary to force a rebuild of the build system manually by running

make -f Makefile.svn
./configure

See the Makefile.svn section above for further details.

Test the driver

It is wise to test that the driver does not kill your machine before installing it to load on boot. After compiling do:

cd driver
sudo ./reload

This will load the driver, which should then try to talk to the SDSU PCI card if it is installed. Note that since "reload" first unloads the driver if it is present, and then loads the driver from the current folder, it may report an "ERROR" message if the first step fails, even though the driver is successfully loaded. The definitive way to check that the driver is loaded is

 cat /proc/mce_dsp

If this file does not exist, the driver isn't loaded. If the cat prints out a bunch of low-level driver information, you're in good shape.

sudo make install

If you're satisfied that the driver works, install the whole thing. Go back up to the MAS base folder and run

sudo make install

This will do the following:

  • install the kernel driver, driver/mce_dsp.ko, into /lib/modules/$(uname -r)/kernel/drivers/misc/, and re-scan the module dependencies.
  • install the MAS binaries from applications/ and the scripts from script/ into /usr/mce/bin
  • install the MAS udev ruleset scripts/91-mas.rules into /etc/udev/rules.d/. These udev rules will ensure that the mce_dsp module is loaded and the MAS device nodes are created at boot time. You can get udev to run these rules immediately, which will result in /dev being populated with the mce devices, by running:
 sudo udevadm trigger
or, else, you can make the nodes yourself by running mas_mknodes.
  • install the mas logging daemon script /etc/init.d/mas init script. The driver can then be started/restarted as desired through this script:
/etc/init.d/mas restart
The driver will automatically be set to load on boot. To disable this, remove the symbolic link "/etc/rc2.d/S99mas".
  • install the hardware configuration file, config2/mce.cfg, and the MAS configuration file, config2/mas.cfg to /etc/mce/, assuming there aren't versions already there.

Install mce_script

Users have the option of running the MCE scripts from an svn working copy, or of running the MCE scripts from an "installed" copy. Talk to your MAS technician about which option is best for you.

Running from an svn working copy

Checkout the tree directly into /usr/mce:

cd /usr/mce
svn checkout svn://e-mode.phas.ubc.ca/mce_script/trunk mce_script

Running from an installed copy

Checkout the tree into your code folder; then make and install:

cd code
svn checkout svn://e-mode.phas.ubc.ca/mce_script/trunk mce_script
make
sudo make install


.bashrc

Add a few lines to .bashrc to update your PATH, PYTHONPATH, and to define the MAS_* variables. The new way, using mas_var, is:

eval `/usr/mce/bin/mas_var -e -s`

The old way, which will probably still work for a while:

export MAS_ROOT=/usr/mce/mce_script/
source $MAS_ROOT/template/mas_env.bash
export IDL_PATH="<IDL_DEFAULT>:$MAS_IDL/mas"

Configuration data

Example configuration files (especially experiment.cfg) are kept in mce_script/template. MAS, by default, expects user configuration data to be in /usr/mce/config. Users should copy the template/ files to /usr/mce/config/, and then make configuration adjustments. After install mce_script, you can copy the template config from it with:

sudo cp -r /usr/mce/mce_script/template /usr/mce/config
sudo chown -R mce /usr/mce/config