SCHROOT-SETUP(5)

πŸ“¦
version 1.6.13 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– SCHROOT-SETUP(5) β€” the schroot chroot setup scripts situation πŸ’–

okay bestie, welcome to the schroot-setup manual page ✨ β€” it lives in the Debian sbuild neck of the woods and it's all about the lil scripts that set up (and then politely tear down) your chroot environment. no cap.


🌸 NAME 🌸

schroot-setup β€” schroot chroot setup scripts. that's it, that's the name 🫢


✨ DESCRIPTION ✨

so schroot uses scripts to set up the chroot environment and then clean up after itself. the directory /etc/schroot/setup.d is where these scripts live, and they get run whenever a chroot is created and destroyed. πŸ’…

while the scripts are running, a whole bunch of environment variables get set, which lets you customise their behaviour depending on stuff like β€” for example β€” which type of chroot is in use. the way that it's customisable? obsessed. 😌

the scripts run in name order, exactly like the ones run by init(8), using the same style of execution as run-parts(8). periodt.

every setup script gets invoked with two options:

  1. The action to perform.

when a session is first started, the chroot gets set up by running the scripts in /etc/schroot/setup.d with the setup-start option. and when the session is ended, those same scripts in /etc/schroot/setup.d get run in reverse order with the setup-stop option. πŸ¦‹

  1. The chroot status.

this is either ok if there are no problems, or fail if something went wrong. like, for example, particular actions may be skipped on failure. πŸ™ˆ

⚠️ bestie, listen: the scripts should be idempotent. they must be idempotent during the setup-stop phase, because they may be run more than once β€” for example on failure. not me warning you twice. πŸ’€

🌈 ENVIRONMENT 🌈

πŸŽ€ General variables

  • AUTH_USER β€” the username of the user the command in the chroot will run as. πŸ‘‘
  • CHROOT_NAME β€” the chroot name. note that this is the name of the original chroot before session creation β€” you probably want SESSION_ID instead, bestie. fr fr.
  • LIBEXEC_DIR β€” the directory under which helper programs are located.
  • MOUNT_DIR β€” the directory under which non-filesystem chroots are mounted (e.g. block devices and LVM snapshots).
  • PID β€” the process ID of the schroot process.
  • PLATFORM β€” the operating system platform schroot is running upon. this may be used to introduce platform-specific behaviour into the setup scripts where required. note that the HOST variables are probably what are actually required. in the context of schroot, the platform is the supported configuration and behaviour for a given architecture, and may be identical between different architectures. πŸ€”
  • SESSION_ID β€” the session identifier. this is the one you want, remember? πŸ’…
  • VERBOSE β€” set to quiet if only error messages should be printed, normal if other messages may be printed as well, and verbose if all messages may be printed. previously called AUTH_VERBOSITY. (glow-up, honestly ✨)
  • CHROOT_SESSION_CREATE β€” set to true if a session will be created, otherwise false.
  • CHROOT_SESSION_CLONE β€” set to true if a session will be cloned, otherwise false.
  • CHROOT_SESSION_PURGE β€” set to true if a session will be purged, otherwise false.
  • CHROOT_SESSION_SOURCE β€” set to true if a session will be created from a source chroot, otherwise false.
  • CHROOT_TYPE β€” the type of the chroot. this is useful for restricting a setup task to particular types of chroot (e.g. only block devices or LVM snapshots). 🧚
  • CHROOT_NAME β€” the name of the chroot. this is useful for restricting a setup task to a particular chroot, or set of chroots. (yes, it's here again β€” two different flavours of the same name, iconic behaviour honestly)
  • CHROOT_ALIAS β€” the name of the alias used to select the chroot. this is useful for specialising a setup task based upon one of its alternative alias names, or the default chroot name. for example, it could be used to specify additional sources in /etc/apt/sources.list, such as a stable-security alias for a stable chroot, or an experimental alias for an unstable chroot. πŸ”₯
  • CHROOT_DESCRIPTION β€” the description of the chroot.
  • CHROOT_MOUNT_LOCATION β€” the location to mount the chroot. it is used for mount point creation and mounting.
  • CHROOT_LOCATION β€” the location of the chroot inside the mount point. this is to allow multiple chroots on a single filesystem. set for all mountable chroot types.
  • CHROOT_PATH β€” the absolute path to the chroot. this is typically CHROOT_MOUNT_LOCATION and CHROOT_LOCATION concatenated together. this is the path which should be used to access the chroots. πŸ“

🌼 Plain and directory chroot variables

these chroot types use only general variables. simple, clean, minimal, we love her. πŸŽ€

πŸ“ File variables

  • CHROOT_FILE β€” the file containing the chroot files.
  • CHROOT_FILE_REPACK β€” set to true to repack the chroot into an archive file on ending a session, otherwise false.

πŸ’œ Mountable chroot variables

these variables are only set for directly mountable chroot types.

  • CHROOT_MOUNT_DEVICE β€” the device to mount containing the chroot.
  • CHROOT_MOUNT_OPTIONS β€” options to pass to mount(8).
  • CHROOT_LOCATION β€” the location of the chroot inside the mount point. this allows the existence of multiple chroots on a single filesystem.

πŸ¦‹ Filesystem union variables

  • CHROOT_UNION_TYPE β€” union filesystem type.
  • CHROOT_UNION_MOUNT_OPTIONS β€” union filesystem mount options.
  • CHROOT_UNION_OVERLAY_DIRECTORY β€” union filesystem overlay directory (writable).
  • CHROOT_UNION_UNDERLAY_DIRECTORY β€” union filesystem underlay directory (read-only).

⭐ Block device variables

  • CHROOT_DEVICE β€” the device containing the chroot root filesystem. this is usually, but not necessarily, the device which will be mounted. for example, for a LVM snapshot this will be the original logical volume. 🀯

🧚 LVM snapshot variables

  • CHROOT_LVM_SNAPSHOT_NAME β€” snapshot name to pass to lvcreate(8).
  • CHROOT_LVM_SNAPSHOT_DEVICE β€” the name of the LVM snapshot device.
  • CHROOT_LVM_SNAPSHOT_OPTIONS β€” options to pass to lvcreate(8).

πŸ‘‘ Custom variables

custom keys set in schroot.conf will be uppercased and set in the environment as described in schroot.conf(5). main character energy for your own variables, honestly. πŸ’…


πŸŽ€ FILES πŸŽ€

πŸ“ Setup script configuration

the directory /etc/schroot/default contains the default settings used by setup scripts.

  • config β€” main configuration file read by setup scripts. the format of this file is described in schroot-script-config(5). this is the default value for the script-config key. note that this was formerly named /etc/schroot/script-defaults. the following files are referenced by default: πŸ‘‡
  • copyfiles β€” a list of files to copy into the chroot from the host system. note that this was formerly named /etc/schroot/copyfiles-defaults.
  • fstab β€” a file in the format described in fstab(5), used to mount filesystems inside the chroot. the mount location is relative to the root of the chroot. note that this was formerly named /etc/schroot/mount-defaults.
  • nssdatabases β€” system databases (as described in /etc/nsswitch.conf on GNU/Linux systems) to copy into the chroot from the host. note that this was formerly named /etc/schroot/nssdatabases-defaults.

πŸ› οΈ Setup scripts

the directory /etc/schroot/setup.d contains the chroot setup scripts. say hi to the whole squad πŸ‘‹

  • 00check β€” print debugging diagnostics and perform basic sanity checking. the vibe check script. βœ…
  • 05file β€” unpack, clean up, and repack file-based chroots.
  • 05fsunion β€” create and remove union filesystems.
  • 05lvm β€” create and remove LVM snapshots.
  • 10mount β€” mount and unmount filesystems.
  • 15binfmt β€” sets up the QEMU user emulator using binfmt-support. this permits a chroot for a different CPU architecture to be used transparently, providing an alternative to cross-compiling or whole-machine emulation. absolutely ate. πŸ”₯
  • 15killprocs β€” kill processes still running inside the chroot when ending a session, which would prevent unmounting of filesystems and cleanup of any other resources. (sorry to those processes but it's necessary 😭)
  • 20copyfiles β€” copy files from the host system into the chroot. configure networking by copying hosts and resolv.conf, for example.
  • 20nssdatabases β€” configure system databases by copying passwd, shadow, group etc. into the chroot.
  • 50chrootname β€” set the chroot name (/etc/debian_chroot) in the chroot. this may be used by the shell prompt to display the current chroot. 🐚

πŸ’– AUTHORS πŸ’–

Roger Leigh. that's the one. 🫢


Copyright Β© 2005-2012 Roger Leigh <rleigh@codelibre.net>

schroot is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. πŸ›οΈ


πŸ‘€ SEE ALSO πŸ‘€

schroot(1), fstab(5), schroot.conf(5), schroot-script-config(5), run-parts(8).


and that's the whole page, bestie!! this is Version 1.6.13 from 14 Aug 2022 β€” go forth and set up chroots, you absolute icon πŸ’…βœ¨πŸŒΈπŸ¦‹πŸ’–

πŸ“¦ where this page comes from