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