]> git.donarmstrong.com Git - neurodebian.git/blob - sandbox/schroot-fslview.rst
DOC: minor -- untabified for consistency
[neurodebian.git] / sandbox / schroot-fslview.rst
1 :date: 2011-12-09 16:08:00
2 :tags: debian, neuroscience, software, FSL, fslview, chroot, virtualization
3
4 .. _chap_schroot_fslview:
5
6 "Install" fslview on recent systems
7 ===================================
8
9 Preamble
10 --------
11
12 Sometimes research software projects start to lag behind recent
13 developments in the libraries they rely upon because it might require
14 considerable effort, and thus time, to adapt them.  That leads to
15 inability to build those tools using up-to-date versions of libraries
16 available on the system due to the change in their API, and thus those
17 tools get removed from the archive.
18
19 That is the situation which happened with fslview_ tool from FSL_
20 suite.  At the moment it still relies on Qt library version 3 and VTK
21 GUI support for it.
22
23 .. note::
24
25    Last version of Qt3, 3.3.8, was released in February 2007, with
26    official support by Trolltech terminated later that year.
27
28    Qt4 was first released in 2005, and current stable series 4.7
29    released appeared in September 2010).
30
31 Because of the age and discontinued upstream support, Qt3 was
32 deprecated in Debian, and tools relying on it were encouraged to
33 migrate to use Qt4.  As a result, although Qt3 itself is still present
34 in Debian (and thus Ubuntu), VTK GUI support for Qt3 (package
35 `libvtk5.4-qt3`_) which fslview uses, was removed from Debian due to
36 Qt3 deprecation.  Once again, it was not removed just to annoy people,
37 but rather because it became unfeasible to maintain robust building
38 and system functioning.  As the result, fslview_ package is currently
39 present only in the releases of Debian and Ubuntu which carry
40 libvtk5.4-qt3 library.  Those are -- Debian squeeze (stable), Ubuntu
41 nutty and maverick.  If you upgraded your system from one of those
42 releases, good chance is that you still have fslview (and required
43 libraries) installed although not available from the archive.  They
44 might even work.  But fresh systems installations will not have them.
45
46 .. _`libvtk5.4-qt3`: http://packages.debian.org/search?keywords=libvtk5.4-qt3
47
48 Workaround
49 ----------
50
51 While everyone is waiting for fslview_ to become compatible with Qt4
52 there are possible workarounds meanwhile to keep research going on
53 bleeding edge releases.  The first, obvious choice for a FOSS
54 enthusiast, is to build fslview_ from source by first building VTK Qt3
55 bindings.  While it might be educationally valuable and exciting, we
56 are afraid in the end it might be more frustrating than useful.
57
58 Therefore we would like to suggest another, much more straightforward
59 and painless approach -- lightweight virtualization, or chroot_
60 jailing.  In this exercise in **4 simple steps** we will install a
61 complete (minimalistic) installation of Debian stable which has
62 fslview available into a directory, and provide convenience wrapper to
63 run fslview as it was installed on the "main" system.  Moreover, in
64 case of security or critical fixes to fslview, such chroot
65 environment, while being Debian installation, would be upgradeable as
66 easily as your main system, thus guaranteeing robust performance.
67
68 Although demonstrated here on the example with fslview, such approach
69 is generally useful for various use cases.  E.g. we have used it in
70 the opposite situation -- on stable Debian systems we needed to run
71 some software available only from Debian unstable or testing, and
72 backporting of all required dependencies was either cumbersome or just
73 impossible without sacrificing stability of the system.
74
75 .. _chroot: http://en.wikipedia.org/wiki/Chroot
76 .. _fslview: http://www.fmrib.ox.ac.uk/fsl/fslview
77 .. _FSL: http://www.fmrib.ox.ac.uk/fsl
78
79
80 Prerequisites
81 -------------
82
83 For this exercise you would need
84
85 - 3--20 minutes depending on the bandwidth to the Debian mirror and
86   efficiency in cut/paste operations
87
88 - root access to the system while performing this setup, although
89   end-users of fslview would not need it to use it
90
91 - tools to install Debian in a directory (called debootstrap_) and
92   convenience utility to "enable" such a chroot-ed environment (called
93   schroot_)
94
95 .. _debootstrap: http://wiki.debian.org/Debootstrap
96 .. _schroot: http://packages.debian.org/sid/schroot
97
98
99 Procedure
100 ---------
101
102 - Install the tools::
103
104    sudo apt-get install debootstrap schroot
105
106 - Choose a location with enough space (around 400 MB) and install a
107   complete Debian squeeze installation with fslview::
108
109    sudo debootstrap --include=fslview squeeze /srv/chroots/squeeze http://ftp.us.debian.org/debian
110
111   .. note::
112      You might like to adjust URL to the archive to use some closer
113      closer to you `Debian mirror`_
114
115 .. _`Debian mirror`: http://www.debian.org/mirror/list
116
117 - Create schroot_ configuration file ``/etc/schroot/chroot.d/squeeze``
118   with following content::
119
120    [squeeze]
121    description=Debian squeeze (6.x stable)
122    type=directory
123    location=/srv/chroots/squeeze
124    users=YOURLOGIN
125    aliases=debian,default
126
127   Replace YOURLOGIN with a comma separated list of users who should be
128   allowed to access this chroot environment (see ``man schroot.conf``
129   for more options, e.g. how to specify the groups etc.)
130
131 - At this point you should already be ready to invoke any command
132   within the chroot environment, so just create a little shell script
133   ``/usr/local/bin/fslview``, make it executable and be all set::
134
135    echo -e '#!/bin/sh\nschroot -p -c squeeze /usr/bin/fslview' > /usr/local/bin/fslview
136    chmod a+x /usr/local/bin/fslview
137
138   .. note::
139      You might need to become root for above operations, or not
140      depending either you are a part of ``staff`` user group.
141
142 Optional steps
143 --------------
144
145 Although at this point you are all set to run fslview from the
146 chroot-ed environment, we would suggest a few additional steps you
147 would need to perform within the chroot-ed environment, so just enter
148 it with using ``schroot -c squeeze -p``, become root (via ``su``
149 command, root password should be the same as on the main system):
150
151 - `Enable NeuroDebian repository <http://neuro.debian.net/#how-to-use-this-repository>`_
152
153 - Enable security and functionality updates::
154
155    sed -e 's,squeeze,squeeze-updates,g' /etc/apt/sources.list > /etc/apt/sources.list.d/updates.list
156    echo 'deb http://security.debian.org/ stable/updates main' > /etc/apt/sources.list.d/security.list
157    apt-get update
158    apt-get upgrade
159
160 - Read ``man schroot`` on how to enable persistent sessions so that
161   chroot initiation could be done ones during boot instead of per each
162   fslview invocation
163
164 If you have any comments (typos, improvements, etc) -- feel welcome to
165 leave a comment below, or just email `us@NeuroDebian`_ .
166
167 .. _us@NeuroDebian: http://neuro.debian.net/#contacts