paul@6 | 1 | Introduction
|
paul@6 | 2 | ------------
|
paul@6 | 3 |
|
paul@6 | 4 | The userinstall distribution consists of a number of scripts, together with a
|
paul@6 | 5 | short configuration file, which allows non-root users to set up and use their
|
paul@12 | 6 | own package and dependency management facilities and to download and install
|
paul@12 | 7 | Debian packages without having to obtain root privileges. The software within
|
paul@12 | 8 | installed packages may then be used, subject to certain constraints such as
|
paul@12 | 9 | program environments, library paths, and so on. In effect, userinstall
|
paul@12 | 10 | provides a personal package manager.
|
paul@6 | 11 |
|
paul@43 | 12 | In addition, userinstall also provides tools to manage conventional chroot
|
paul@43 | 13 | filesystem areas and User Mode Linux system images. Such capabilities are
|
paul@43 | 14 | useful when needing to run distributions that are sufficiently different from
|
paul@43 | 15 | the host system's distribution that the non-root approach no longer works,
|
paul@43 | 16 | due to system library or kernel incompatibilities.
|
paul@43 | 17 |
|
paul@46 | 18 | The following table summarises the capabilities and limitations of the
|
paul@46 | 19 | different modes of the software:
|
paul@46 | 20 |
|
paul@46 | 21 | Programs Unprivileged usage Same distribution Other versions
|
paul@46 | 22 | -------- ------------------ ----------------- --------------
|
paul@46 | 23 |
|
paul@46 | 24 | user-* Yes Yes Probably not
|
paul@46 | 25 | (sensitive to core
|
paul@46 | 26 | library versions)
|
paul@46 | 27 |
|
paul@46 | 28 | user-* No Yes Yes (subject to
|
paul@46 | 29 | (with --root option) kernel suitability)
|
paul@46 | 30 |
|
paul@46 | 31 | uml-* Yes (although Yes Yes
|
paul@46 | 32 | networking must be
|
paul@46 | 33 | set up by root)
|
paul@46 | 34 |
|
paul@6 | 35 | Contact, Copyright and Licence Information
|
paul@6 | 36 | ------------------------------------------
|
paul@6 | 37 |
|
paul@6 | 38 | The current Web page for userinstall at the time of release is:
|
paul@6 | 39 |
|
paul@6 | 40 | http://www.boddie.org.uk/paul/userinstall.html
|
paul@6 | 41 |
|
paul@6 | 42 | Copyright and licence information can be found in the docs directory - see
|
paul@6 | 43 | docs/COPYING.txt and docs/gpl-3.0.txt for more information.
|
paul@6 | 44 |
|
paul@17 | 45 | Thanks to Piotr Roszatycki, the maintainer of fakechroot, for helpfully fixing
|
paul@25 | 46 | system call coverage in that utility in order to attempt to support
|
paul@25 | 47 | cross-distribution bootstrapping.
|
paul@17 | 48 |
|
paul@6 | 49 | Dependencies
|
paul@6 | 50 | ------------
|
paul@6 | 51 |
|
paul@6 | 52 | fakeroot Tested with 1.5.10ubuntu2
|
paul@17 | 53 | fakechroot 2.8 or later required
|
paul@15 | 54 | debootstrap Tested with 0.3.3.2ubuntu3 on Ubuntu Hoary 5.04, 1.0.7~feisty1
|
paul@21 | 55 | on Ubuntu Feisty 7.04, 1.0.20~hardy1 on Ubuntu Hardy
|
paul@6 | 56 |
|
paul@22 | 57 | New in userinstall 0.2 (Changes since userinstall 0.1)
|
paul@22 | 58 | ------------------------------------------------------
|
paul@14 | 59 |
|
paul@21 | 60 | * Adopted lsb-release environment variables instead of new ones like
|
paul@22 | 61 | DISTNAME, exposing derivatives of these variables by default.
|
paul@21 | 62 | * Added explicit keyring package installation.
|
paul@25 | 63 | * Added -do scripts for configuring and entering the chroot.
|
paul@25 | 64 | * Removed specific apt- and dpkg-related scripts, replacing them with the
|
paul@25 | 65 | general -do scripts.
|
paul@25 | 66 | * Added --root options to certain scripts in order to support normal chroot
|
paul@30 | 67 | installations. Added --dev option for bind mounting of /dev in normal
|
paul@30 | 68 | chroot installations.
|
paul@27 | 69 | * Added support for UML instance construction from distribution
|
paul@43 | 70 | installations, along with networking support and a uml-net script. Also
|
paul@43 | 71 | added some support for booting from initrd files and installation media
|
paul@43 | 72 | image files.
|
paul@14 | 73 |
|
paul@6 | 74 | Configuration
|
paul@6 | 75 | -------------
|
paul@6 | 76 |
|
paul@12 | 77 | If the system defaults are not to be used, or if userinstall is not installed
|
paul@6 | 78 | as a system package, the userinstall-defaults file supplied with the
|
paul@12 | 79 | distribution may be edited to specify the nature and location of the personal
|
paul@22 | 80 | package manager.
|
paul@21 | 81 |
|
paul@22 | 82 | The following settings can be edited:
|
paul@21 | 83 |
|
paul@22 | 84 | USERINSTALL_ID This should reflect the distribution being used or, in
|
paul@22 | 85 | special cases, a different distribution. Examples
|
paul@22 | 86 | include Debian and Ubuntu.
|
paul@6 | 87 |
|
paul@22 | 88 | USERINSTALL_CODENAME This should reflect the version of the distribution
|
paul@22 | 89 | being used and need only be altered in special
|
paul@22 | 90 | situations (such as the creation of a sandbox for
|
paul@22 | 91 | testing other distributions).
|
paul@15 | 92 |
|
paul@22 | 93 | Examples of codenames include hardy and jaunty for
|
paul@22 | 94 | Ubuntu and lenny and squeeze for Debian. Note that the
|
paul@22 | 95 | setup process may not work with different distributions
|
paul@22 | 96 | due to library incompatibilities.
|
paul@22 | 97 |
|
paul@22 | 98 | PACKAGEROOT The location of the personal package manager in the
|
paul@22 | 99 | filesystem.
|
paul@22 | 100 |
|
paul@22 | 101 | See the /etc/lsb-release file for example values describing your own system,
|
paul@22 | 102 | with the DISTRIB prefix used instead of the USERINSTALL prefix for each of the
|
paul@22 | 103 | settings.
|
paul@6 | 104 |
|
paul@6 | 105 | If a completely new userinstall-defaults file is created, it is essential that
|
paul@6 | 106 | the above variables be defined so that the scripts know where to create or to
|
paul@12 | 107 | find the personal package manager.
|
paul@6 | 108 |
|
paul@12 | 109 | Creating a Personal Package Manager
|
paul@12 | 110 | -----------------------------------
|
paul@6 | 111 |
|
paul@6 | 112 | In order to install packages as a non-root user, first invoke the user-setup
|
paul@6 | 113 | script; this will create and initialise a basic Debian system with a basic set
|
paul@6 | 114 | of packages installed. For example, with userinstall installed as a system
|
paul@12 | 115 | package, using the system defaults:
|
paul@6 | 116 |
|
paul@6 | 117 | user-setup
|
paul@6 | 118 |
|
paul@12 | 119 | It is possible to override the "template" for the system by specifying a
|
paul@6 | 120 | "mirror" location. This is useful if you have the CD or DVD image for the
|
paul@12 | 121 | distribution already mounted in the filesystem. For example:
|
paul@6 | 122 |
|
paul@6 | 123 | user-setup file:///cdrom
|
paul@20 | 124 |
|
paul@20 | 125 | sudo mount -o loop /home/me/downloads/kubuntu-7.04-alternate-i386.iso /tmp/cdrom
|
paul@20 | 126 | user-setup file:///tmp/cdrom
|
paul@6 | 127 |
|
paul@34 | 128 | A URL must be specified as the "mirror" location, not a normal filename.
|
paul@6 | 129 |
|
paul@22 | 130 | Once the installation is complete, some post-installation is necessary:
|
paul@22 | 131 |
|
paul@22 | 132 | user-postsetup
|
paul@22 | 133 |
|
paul@22 | 134 | If a different distribution is being used for the package manager than that
|
paul@22 | 135 | being run on the system, it might be necessary to specify a country code so
|
paul@22 | 136 | that the configuration of package repositories can be performed successfully.
|
paul@22 | 137 | For example, for repositories mirrored in the United Kingdom (UK):
|
paul@22 | 138 |
|
paul@22 | 139 | user-postsetup uk
|
paul@22 | 140 |
|
paul@22 | 141 | At this point, the package manager should be ready to use.
|
paul@22 | 142 |
|
paul@12 | 143 | Adding Package Repositories to the Package Manager
|
paul@12 | 144 | --------------------------------------------------
|
paul@12 | 145 |
|
paul@12 | 146 | To get access to repositories of packages beyond those provided by the basic
|
paul@12 | 147 | distribution, edit the /etc/apt/sources.list file inside the system. The
|
paul@6 | 148 | user-path script can help you find the exact location of the file:
|
paul@6 | 149 |
|
paul@7 | 150 | user-path /etc/apt/sources.list
|
paul@6 | 151 |
|
paul@6 | 152 | And you can edit the file directly with a text editor (such as vi) as follows:
|
paul@6 | 153 |
|
paul@7 | 154 | vi `user-path /etc/apt/sources.list`
|
paul@6 | 155 |
|
paul@6 | 156 | Installing Packages
|
paul@6 | 157 | -------------------
|
paul@6 | 158 |
|
paul@25 | 159 | To install packages from other repositories, invoke the user-do script and
|
paul@25 | 160 | specify the apt-get program together with options expected by that program.
|
paul@25 | 161 | For example:
|
paul@15 | 162 |
|
paul@25 | 163 | user-do apt-get --help
|
paul@25 | 164 | user-do apt-get update
|
paul@15 | 165 |
|
paul@25 | 166 | Packages can then be installed. For example:
|
paul@15 | 167 |
|
paul@25 | 168 | user-do apt-get install python-cmdsyntax
|
paul@6 | 169 |
|
paul@6 | 170 | Provided that the specified packages are known and their dependencies can be
|
paul@12 | 171 | met, they will be installed into the system.
|
paul@6 | 172 |
|
paul@6 | 173 | Installing Single Packages
|
paul@6 | 174 | --------------------------
|
paul@6 | 175 |
|
paul@25 | 176 | To install individual package files, first copy them into the package manager
|
paul@25 | 177 | directory hierarchy. For example:
|
paul@6 | 178 |
|
paul@25 | 179 | cp python-cmdsyntax_0.91-0ubuntu2_all.deb `user-path /tmp`
|
paul@6 | 180 |
|
paul@25 | 181 | The invoke the dpkg program through the user-do script as follows:
|
paul@25 | 182 |
|
paul@25 | 183 | user-do dpkg -i /tmp/python-cmdsyntax_0.91-0ubuntu2_all.deb
|
paul@7 | 184 |
|
paul@7 | 185 | Using Packages
|
paul@7 | 186 | --------------
|
paul@7 | 187 |
|
paul@7 | 188 | Unlike most packages installed in the usual way by the root user, the installed
|
paul@7 | 189 | packages will not reside within a directory hierarchy rooted at / - the top of
|
paul@7 | 190 | the filesystem. Instead, they will reside in a location such as the following:
|
paul@7 | 191 |
|
paul@7 | 192 | /home/me/.userinstall
|
paul@7 | 193 | /tmp/packages
|
paul@7 | 194 |
|
paul@7 | 195 | (The precise location may be found by running the user-path script.)
|
paul@7 | 196 |
|
paul@7 | 197 | Consequently, to make use of the installed software, it may be necessary to
|
paul@7 | 198 | edit your environment in a number of ways so that it may be located and
|
paul@7 | 199 | correctly loaded, initialised and executed.
|
paul@7 | 200 |
|
paul@7 | 201 | Using Python Packages
|
paul@7 | 202 | ---------------------
|
paul@7 | 203 |
|
paul@7 | 204 | Installed Python packages may be made available to Python by defining the
|
paul@7 | 205 | PYTHONPATH to include the directories usually searched by Python, but which
|
paul@12 | 206 | are actually located within the personal package management environment. For
|
paul@12 | 207 | example, with the Python 2.5 site-packages directory:
|
paul@7 | 208 |
|
paul@11 | 209 | PYTHONPATH=`user-path /usr/lib/python2.5/site-packages/` python2.5
|
paul@11 | 210 |
|
paul@11 | 211 | More complicated extension modules may require further adjustments to the
|
paul@11 | 212 | LD_LIBRARY_PATH and PYTHONPATH variables:
|
paul@11 | 213 |
|
paul@25 | 214 | export LD_LIBRARY_PATH=`user-path /usr/lib`
|
paul@25 | 215 | export PYTHONPATH=`user-path /usr/lib/python2.5/site-packages/`
|
paul@25 | 216 | export PYTHONPATH=${PYTHONPATH}:`user-path /var/lib/python-support/python2.5`
|
paul@22 | 217 |
|
paul@22 | 218 | Entering the Package Manager
|
paul@22 | 219 | ----------------------------
|
paul@22 | 220 |
|
paul@22 | 221 | It is also possible to administer the package manager from within the
|
paul@22 | 222 | installation:
|
paul@22 | 223 |
|
paul@25 | 224 | user-do
|
paul@22 | 225 |
|
paul@22 | 226 | This should provide a "root" prompt which can then be used to issue commands
|
paul@22 | 227 | within the package manager environment. For example:
|
paul@22 | 228 |
|
paul@39 | 229 | apt-get update && apt-get upgrade
|
paul@22 | 230 |
|
paul@29 | 231 | Creating and Entering a Package Manager in Root Mode
|
paul@29 | 232 | ----------------------------------------------------
|
paul@29 | 233 |
|
paul@29 | 234 | The user-setup, user-postsetup and user-do scripts also support a --root
|
paul@29 | 235 | option which sets up a package manager for a user with root privileges. To
|
paul@31 | 236 | set up such an installation, the following commands can be used:
|
paul@29 | 237 |
|
paul@34 | 238 | user-setup --root
|
paul@34 | 239 | user-postsetup --root
|
paul@29 | 240 |
|
paul@29 | 241 | Entering the installation is done using the user-do script:
|
paul@29 | 242 |
|
paul@34 | 243 | user-do --root
|
paul@29 | 244 |
|
paul@29 | 245 | Note that in root mode, the /proc and /sys filesystems are mounted within the
|
paul@29 | 246 | installation. Care must be taken not to delete the contents of these
|
paul@29 | 247 | directories within the installation while the above command is running;
|
paul@29 | 248 | otherwise, this can potentially damage the main operating system installation
|
paul@29 | 249 | on your computer.
|
paul@29 | 250 |
|
paul@30 | 251 | Using the Host's Device Filesystem
|
paul@30 | 252 | ----------------------------------
|
paul@30 | 253 |
|
paul@30 | 254 | In root mode, the /dev filesystem on the host can be mounted by using the
|
paul@30 | 255 | --dev option with user-do:
|
paul@30 | 256 |
|
paul@34 | 257 | user-do --root --dev
|
paul@30 | 258 |
|
paul@30 | 259 | Note that care must be taken not to delete the contents of this directory
|
paul@30 | 260 | within the installation while the above command is running.
|
paul@30 | 261 |
|
paul@30 | 262 | Enabling Audio in Root Mode
|
paul@30 | 263 | ---------------------------
|
paul@30 | 264 |
|
paul@30 | 265 | Together with the --root and --dev options, audio can be enabled for
|
paul@30 | 266 | applications within an installation by adding users to the audio group in
|
paul@30 | 267 | /etc/group. In addition, it may be necessary to run an audio manager daemon
|
paul@30 | 268 | depending on the system used to manage the audio on the host.
|
paul@30 | 269 |
|
paul@30 | 270 | For example, the artsd package may need installing in order to make the
|
paul@30 | 271 | corresponding artsdsp program available to applications within the package
|
paul@30 | 272 | manager.
|
paul@30 | 273 |
|
paul@22 | 274 | Constructing UML Instances
|
paul@22 | 275 | --------------------------
|
paul@22 | 276 |
|
paul@22 | 277 | For some applications, it can be desirable to provide a completely isolated
|
paul@22 | 278 | environment for package installation and testing. This can be performed using
|
paul@22 | 279 | the User Mode Linux (UML) software.
|
paul@22 | 280 |
|
paul@31 | 281 | Since UML needs to see its filesystems as images, not directories within an
|
paul@31 | 282 | existing filesystem, the uml-make-image script needs to create these image
|
paul@39 | 283 | files. For example, to create a root filesystem 4GB in size, along with a swap
|
paul@31 | 284 | file 512MB in size:
|
paul@22 | 285 |
|
paul@31 | 286 | uml-make-image 4 512
|
paul@22 | 287 |
|
paul@31 | 288 | This will create a UML instance from an existing package manager installation.
|
paul@22 | 289 |
|
paul@31 | 290 | Building User Mode Linux
|
paul@31 | 291 | ------------------------
|
paul@22 | 292 |
|
paul@31 | 293 | To make a User Mode Linux executable, run the uml-build-linux script.
|
paul@22 | 294 |
|
paul@27 | 295 | Enabling Networking for UML Instances
|
paul@27 | 296 | -------------------------------------
|
paul@27 | 297 |
|
paul@27 | 298 | To enable networking for a UML instance, use the uml-net script:
|
paul@27 | 299 |
|
paul@27 | 300 | sudo uml-net --start $USER
|
paul@27 | 301 |
|
paul@27 | 302 | Here, $USER should be expanded to the name of the user running the above
|
paul@27 | 303 | command, not the root user.
|
paul@27 | 304 |
|
paul@27 | 305 | To stop networking, use the same script:
|
paul@27 | 306 |
|
paul@27 | 307 | sudo uml-net --stop
|
paul@27 | 308 |
|
paul@22 | 309 | Entering or Starting UML Instances
|
paul@22 | 310 | ----------------------------------
|
paul@22 | 311 |
|
paul@29 | 312 | To enter a UML instance, use the uml-do script, specifying an amount of memory
|
paul@29 | 313 | to allocate to the instance:
|
paul@22 | 314 |
|
paul@29 | 315 | uml-do 512M
|
paul@34 | 316 |
|
paul@34 | 317 | Specifying the --net option allows networking to be used by the instance, if
|
paul@34 | 318 | set up as described above:
|
paul@34 | 319 |
|
paul@34 | 320 | uml-do 512M --net
|
paul@35 | 321 |
|
paul@43 | 322 | Booting into UML from Installation Media
|
paul@43 | 323 | ----------------------------------------
|
paul@43 | 324 |
|
paul@43 | 325 | Instead of populating a filesystem image for User Mode Linux from an existing
|
paul@43 | 326 | distribution installation, blank images can be created as follows:
|
paul@43 | 327 |
|
paul@43 | 328 | uml-make-image --do-not-populate 4 512
|
paul@43 | 329 |
|
paul@43 | 330 | Then, an initrd file can be used together with installation media - typically
|
paul@43 | 331 | an ISO file that would usually be burned onto a CD or DVD - such that a UML
|
paul@43 | 332 | instance can be booted and a distribution then installed into the blank images
|
paul@43 | 333 | from the installation media.
|
paul@43 | 334 |
|
paul@43 | 335 | The initrd file is typically extracted from an ISO file (for example,
|
paul@43 | 336 | installer.iso) as follows (with superuser privileges):
|
paul@43 | 337 |
|
paul@43 | 338 | mkdir installer
|
paul@43 | 339 | mount -o loop installer.iso installer
|
paul@43 | 340 | cp installer/initrd.gz .
|
paul@43 | 341 | umount installer
|
paul@43 | 342 |
|
paul@43 | 343 | This assumes that initrd.gz is found at the top level of the installation
|
paul@43 | 344 | media's filesystem.
|
paul@43 | 345 |
|
paul@43 | 346 | The UML instance is then booted as follows:
|
paul@43 | 347 |
|
paul@43 | 348 | uml-do 512M --net --initrd initrd.gz installer.iso
|
paul@43 | 349 |
|
paul@43 | 350 | The blank images will appear as /dev/ubda and /dev/ubdb devices in the
|
paul@43 | 351 | instance, not merely as partitions, and so installers may ask you if you would
|
paul@43 | 352 | like to partition these devices still further.
|
paul@43 | 353 |
|
paul@35 | 354 | Issues with Shared Memory
|
paul@35 | 355 | -------------------------
|
paul@35 | 356 |
|
paul@35 | 357 | It is possible for User Mode Linux to just crash having exhausted the host
|
paul@35 | 358 | system's shared memory. This can be worked around by remounting tmpfs with
|
paul@35 | 359 | more space. For example:
|
paul@35 | 360 |
|
paul@35 | 361 | sudo mount -t tmpfs tmpfs /dev/shm -o remount,size=805306368
|
paul@35 | 362 |
|
paul@35 | 363 | This allocates 768MB (the figure is given in bytes) to tmpfs.
|
paul@35 | 364 |
|
paul@35 | 365 | One bug related to User Mode Linux and Debian exists:
|
paul@35 | 366 |
|
paul@35 | 367 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=388128
|
paul@35 | 368 |
|
paul@35 | 369 | And this Debian installer bug may be related to experiences with pbuilder and
|
paul@35 | 370 | other package installation activities:
|
paul@35 | 371 |
|
paul@35 | 372 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239758
|