]> git.donarmstrong.com Git - neurodebian.git/blob - sandbox/schroot-fslview.rst
DOC: minor editing
[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 into a directory, and provide convenience wrapper to
62 run fslview as if it was installed on the "main" system.  Moreover, in
63 case of security or critical fixes to fslview, such chroot
64 environment, while being Debian installation, would be upgradeable as
65 easily as your main system, thus guaranteeing robust performance.
66
67 Although we demonstrate this setup with fslview in mind, such approach
68 is generally useful for various use cases.  E.g. we have used it in
69 the opposite situation -- on stable Debian systems we needed to run
70 some software available only from Debian unstable or testing, and
71 backporting of all required dependencies was either cumbersome or just
72 impossible without sacrificing stability of the system.
73
74 .. _chroot: http://en.wikipedia.org/wiki/Chroot
75 .. _fslview: http://www.fmrib.ox.ac.uk/fsl/fslview
76 .. _FSL: http://www.fmrib.ox.ac.uk/fsl
77
78
79 Prerequisites
80 -------------
81
82 For this exercise you would need
83
84 - 3--20 minutes depending on the bandwidth to the Debian mirror and
85   efficiency in cut/paste operations
86
87 - root access to the system while performing this setup, although
88   end-users of fslview would not need root access after everything
89   is setup
90
91 - 2 additional tools -- debootstrap_ to install Debian in a directory
92   and a convenience utility schroot_ to "enable" such an environment
93
94 .. _debootstrap: http://wiki.debian.org/Debootstrap
95 .. _schroot: http://packages.debian.org/sid/schroot
96
97
98 Procedure
99 ---------
100
101 - Install the tools::
102
103    sudo apt-get install debootstrap schroot
104
105 - Choose a location with enough space (400 MB should be enough) and
106   install a complete Debian squeeze installation with fslview::
107
108    sudo debootstrap --include=fslview squeeze /srv/chroots/squeeze http://ftp.us.debian.org/debian
109
110   .. note::
111      You might like to adjust URL to the archive to use some closer
112      closer to you `Debian mirror`_
113
114 .. _`Debian mirror`: http://www.debian.org/mirror/list
115
116 - Create schroot_ configuration file ``/etc/schroot/chroot.d/squeeze``
117   with following content::
118
119    [squeeze]
120    description=Debian squeeze (6.x stable)
121    type=directory
122    location=/srv/chroots/squeeze
123    users=YOURLOGIN
124    aliases=debian,default
125
126   Replace YOURLOGIN with a comma separated list of users who should be
127   allowed to access this chroot environment (see ``man schroot.conf``
128   for more options, e.g. how to specify the groups etc.)
129
130 - At this point you should already be able to invoke any command
131   within the chroot environment, so just create a little shell script
132   ``/usr/local/bin/fslview``, make it executable and be all set::
133
134    echo -e '#!/bin/sh\nschroot -p -c squeeze /usr/bin/fslview' > /usr/local/bin/fslview
135    chmod a+x /usr/local/bin/fslview
136
137   .. note::
138      You might need to become root for above operations, or not
139      depending either you are a part of ``staff`` user group.
140
141 Optional steps
142 --------------
143
144 Although at this point you are all set to run fslview from the
145 chroot-ed environment, we would suggest a few additional steps you
146 would need to perform within the chroot-ed environment:
147
148 - enter chroot using ``schroot -c squeeze -p``
149
150 - become root (via ``su`` command, root password should be the same as
151   on the main system)
152
153 - `Enable NeuroDebian repository <http://neuro.debian.net/#how-to-use-this-repository>`_
154
155 - Enable security and functionality updates::
156
157    sed -e 's,squeeze,squeeze-updates,g' /etc/apt/sources.list > /etc/apt/sources.list.d/updates.list
158    echo 'deb http://security.debian.org/ stable/updates main' > /etc/apt/sources.list.d/security.list
159    apt-get update
160    apt-get upgrade
161
162 Also you might like to read ``man schroot`` on how to enable
163 persistent sessions so that chroot initiation could be done ones
164 during boot instead of per each fslview invocation
165
166 If you have any comments (typos, improvements, etc) -- feel welcome to
167 leave a comment below, or just email `us@NeuroDebian`_ .
168
169 .. _us@NeuroDebian: http://neuro.debian.net/#contacts