1 :date: 2011-12-09 16:08:00
2 :tags: debian, neuroscience, software, FSL, fslview, chroot, virtualization
4 .. _chap_schroot_fslview:
6 Chroot workaround for fslview (HOWTO)
7 =====================================
12 Sometimes research software projects start to lag behind recent
13 developments in the libraries they rely upon because necessary changes
14 to the code might require
15 considerable effort, and thus time. That leads to
16 inability to build those tools using up-to-date versions of libraries
17 available on the system due to incompatible API, and sooner or later
18 because of that those tools get removed from the repository.
20 That is what happened with fslview_ tool from FSL_ suite. Today, at
21 the end of 2011, it still relies on Qt library version 3 and VTK GUI
26 Last version of Qt3, 3.3.8, was released in February 2007, with
27 official support by Trolltech terminated later that year.
29 Qt4 was first released in 2005, and current stable series 4.7
30 released appeared in September 2010.
32 Because of the age and discontinued upstream support, `Qt3 was
33 orphaned`_ in Debian, and tools relying on it were encouraged to
34 migrate to use Qt4. As a result, although Qt3 itself is still present
35 in Debian (and thus Ubuntu), VTK GUI support for Qt3 (package
36 `libvtk5.4-qt3`_) which fslview uses, was removed from Debian due to
37 Qt3 deprecation. Once again, it was not removed just to annoy people,
38 but rather because it became unfeasible to maintain its robust building
39 and functioning. So nowadays fslview_ package is
40 present only in the previous releases of Debian and Ubuntu which carry
41 libvtk5.4-qt3 library. Those are -- Debian squeeze (stable), Ubuntu
42 nutty and maverick. If you upgraded your system from one of those
43 releases, good chance is that you still have fslview (and required
44 libraries) installed although not available from the APT repository
46 might even work. But fresh systems installations will not have them.
48 .. _`Qt3 was orphaned`: http://lists.debian.org/debian-devel/2011/05/msg00236.html
49 .. _`libvtk5.4-qt3`: http://packages.debian.org/search?keywords=libvtk5.4-qt3
54 While everyone is waiting for a new release of fslview_ compatible with Qt4
55 there are possible workarounds to keep research going on
56 bleeding edge Debian-based releases. The first, obvious choice for a FOSS
57 enthusiast, is to build fslview_ from source by first building VTK Qt3
58 bindings. While it might be educationally valuable and exciting, we
59 are afraid in the end it might be more frustrating than useful.
61 Therefore we would like to suggest another, much more straightforward
62 and hopefully painless approach -- lightweight virtualization, or chroot_
63 jailing, which exists in Unix-land since 1970s.
64 With this exercise in **4 simple steps** we will install a
65 complete (minimalistic) installation of Debian stable into a separate
66 directory. We will provide a convenience wrapper to
67 run fslview as if it was installed on the "main" system. So your
68 system will stay intact while you would enrich it with additional
69 installation of stable Debian. Moreover if
70 security or critical fixes to any components of that installation
71 become available, this chroot
72 environment, being a complete Debian installation, could be as
73 easily upgraded as your main system, thus guaranteeing robust performance.
75 Although we demonstrate this setup with fslview in mind, such approach
76 is generally useful for various use cases. E.g. we have used it in
77 the opposite situation -- on stable Debian systems we needed to run
78 some software available only from Debian unstable or testing, and
79 backporting of all required dependencies was either cumbersome or just
80 impossible without sacrificing stability of the system.
82 .. _chroot: http://en.wikipedia.org/wiki/Chroot
83 .. _fslview: http://www.fmrib.ox.ac.uk/fsl/fslview
84 .. _FSL: http://www.fmrib.ox.ac.uk/fsl
90 For this exercise you would need
92 - 3--20 minutes depending on the bandwidth to the Debian mirror and
93 efficiency in cut/paste operations
95 - root access to the system while performing this setup, although
96 end-users of fslview would not need root access after everything
99 - 2 additional tools -- debootstrap_ to install Debian in a directory
100 and a convenience utility schroot_ to "enable" such an environment
102 .. _debootstrap: http://wiki.debian.org/Debootstrap
103 .. _schroot: http://packages.debian.org/sid/schroot
109 - Install the tools::
111 sudo apt-get install debootstrap schroot
113 - Choose a location with enough space (600 MB should be enough) and
114 install a complete Debian squeeze installation with fslview::
116 sudo debootstrap --include=fslview squeeze /srv/chroots/squeeze http://ftp.us.debian.org/debian
119 You might like to adjust URL to the archive to use some closer
120 to you `Debian mirror`_
122 .. _`Debian mirror`: http://www.debian.org/mirror/list
124 - Create schroot_ configuration file ``/etc/schroot/chroot.d/squeeze``
125 with the following content::
128 description=Debian squeeze (6.x stable)
130 directory=/srv/chroots/squeeze
132 aliases=debian,default
134 Replace YOURLOGIN with a comma separated list of users who should be
135 allowed to access this chroot environment (see ``man schroot.conf``
136 for more options, e.g. how to specify the groups etc.)
138 - At this point you should be able already to invoke any command
139 within the chroot environment, so just create a little shell script
140 ``/usr/local/bin/fslview``, make it executable and be all set::
142 echo -e '#!/bin/sh\nschroot -p -c squeeze /usr/bin/fslview "$@"' > /usr/local/bin/fslview
143 chmod a+x /usr/local/bin/fslview
146 You might need, or not, to become root for above operations
147 depending either you are a part of ``staff`` user group.
152 Although at this point you can run fslview from the chroot-ed
153 environment, we would suggest a few additional steps. For some of
154 them (marked with **chroot-root**) you would need to become root in a
155 chroot environment via following steps:
157 - enter chroot using ``schroot -c squeeze -p``
159 - become root (via ``su`` command, root password should be the same as
162 So here are recommended optional additions:
164 - **chroot-root**: `Enable NeuroDebian repository
165 <http://neuro.debian.net/#how-to-use-this-repository>`_. Choose
166 ``squeeze`` release and mirror of preference (remove ``sudo`` from
169 - **chroot-root**: Enable security and functionality updates::
171 sed -e 's,squeeze,squeeze-updates,g' /etc/apt/sources.list > /etc/apt/sources.list.d/updates.list
172 echo 'deb http://security.debian.org/ stable/updates main' > /etc/apt/sources.list.d/security.list
176 - Make fsl atlases accessible within the chroot environment. There
177 are two ways and you must choose only **one** of them, otherwise
178 you might damage your "main" system installation.
180 - **chroot-root**: Install atlases packages in the chroot-ed environment::
182 apt-get install fsl-atlases
184 Although this is the best/correct way it would require additional 200MB of
185 space, possibly duplicating what you already have installed in the
186 main system. Also it requires `enabling of NeuroDebian repository
187 in chroot environment
188 <http://neuro.debian.net/#how-to-use-this-repository>`_.
190 - Alternatively you can bind-mount those directories with atlases installed on the "main"
191 system within chroot. For that edit (as root on the "main"
192 system) ``/etc/schroot/default/fstab`` and add following entries::
194 /usr/share/fsl/data/atlases /usr/share/fsl/data/atlases none rw,bind 0 0
195 /usr/share/data /usr/share/data none rw,bind 0 0
198 Similarly you can bind-mount any other directory you would like
199 to make visible in chroot. Just be careful to not "overlap"
200 with system directories in chroot which already carry something.
202 Also you might like to read ``man schroot`` on how to enable
203 persistent sessions so that chroot initiation could be done ones
204 during boot instead of per each fslview invocation
206 If you have any comments (typos, improvements, etc) -- feel welcome to
207 leave a comment below, or just email `us@NeuroDebian`_ .
209 .. _us@NeuroDebian: http://neuro.debian.net/#contacts