Skip to content
sspencerwire edited this page Nov 15, 2019 · 20 revisions

ltsp-info

This server command shows information about your LTSP installation, server packages, and related client packages from each chroot in $BASE.

Usage

root@server #``ltsp-info

Extensions

Retrieving package information is distro specific. For this command to fully work on a distro, some distro-specific functions have to written to retrieve this package information. These functions are server_packages(), chroot_packages() and chroot_release().

Example

/usr/share/ltsp/ltsp-info-functions

` # Debian-specific function overrides for ltsp-info`
 `server_packages() {`
    `echo server packages:`
    `COLUMNS=200 dpkg -l 'ltsp*' 'ldm*' | awk '/ltsp|ldm/{print ,,}'`
    `echo`
 `}`

 `chroot_packages() {`
    `chroot=`
    `if [ -f $chroot/var/lib/dpkg/status ]; then`
        `echo "packages in chroot: $chroot"`
        `COLUMNS=200 dpkg --root=$chroot -l 'ltsp*' 'ldm*' | awk '/ltsp-client|ldm|ltspfs/{print ,,}'`
        `echo`
    `fi`
 `}`

 `chroot_release() {`
    `if [ -x $chroot/usr/bin/lsb_release ]; then`
        `echo "chroot information: $chroot"`
        `ROOT=$chroot ltsp-chroot lsb_release --all`
        `echo`
    `fi`
 `}`

ltsp-build-client

Usage

commandline option config option description notes
arch ARCH set the target architecture
base BASE set the default base install directory preferably, set this config in ltsp-server.conf
chroot CHROOT set the name of the chroot if not set, the value for arch becomes the name
config - load a user specific configuration file
debug DEBUG enable debug support
exclude EXCLUDE exclude packages from the initial chroot
purge-chroot PURGE_CHROOT purge existing LTSP chroot if present think twice to set in config file

The possible full usage is different for each distribution, refer to your distro's installation page for those details. Also, the following command shows all distro specific options:

user@server $``ltsp-build-client --extra-help

The command is able to perform a distro specific client installation by making use of plugins. When starting, plugins are called by the "load_plugins" function. Common plugins are located in /usr/share/ltsp/plugins/ltsp-build-client/common, while vendor-specific plugins are defined in /usr/share/ltsp/plugins/ltsp-build-client/$DISTRO. If a distro plugin has the same filename as a common plugin, it will override the common plugin. The plugin code is used in different phases. A plugin typically only uses some of the available phases.

  1. commandline
  2. configure
  3. before-install
  4. install
  5. after-install
  6. finalization

Commandline

Any commandline options for ltsp-build-client are defined here. The commandline argument itself can be specified as well as the value type (string or boolean). Also a description and an "advanced" flag for display in the regular help section or the advanced help section. The syntax is as follows:

add_option "" "eval_gettext "<description>"" "<help section (advanced or regular)>" "<value type (false for string, true for boolean)>"

Configure

Any commandline or config file options can be processed here. The commandline options will be available as $option__value, where any dashes in the option name will be converted to underscores. The config file variables are available as is.

Install

In this phase the initial chroot is built. This will obviously vary greatly for each distro.

Finalization

In the finalization phase, you may want to install additional packages that needed custom configurations to other software before installing, such as a kernel (which may require certain initramfs tweaks). you may also want to copy the kernel images into a location accessible by tftp at this phase, or seed the chroot's /etc/ssh/ssh_known_hosts file with your server's public ssh keys.

Example

/usr/share/ltsp/plugins/ltsp-build-client/Gentoo/020-rootpath

 `case "$MODE" in`
    `commandline)`
        `add_option "purge-chroot" "`eval_gettext "purge existing LTSP chroot if present"`" "advanced" "false"`
        `;;`
    `configure)`
        `if [ "true" = "$option_purge_chroot_value" ]; then`
            `PURGE_CHROOT="true"`
        `fi`
        `;;`
    `before-install)`
        `export ROOT=$BASE/$CHROOT`
        `if [ -d $ROOT ] ; then`
            `if [ "true" = "$PURGE_CHROOT" ]; then`
                `# wipe it out, so we can try again`
                `rm --force --recursive --one-file-system "$ROOT"`
            `else`
                `echo "NOTE: Root directory $ROOT already exists, this will lead to problems, please remove it before trying again. Exiting."`
                `exit 0`
            `fi`
        `fi`
        `mkdir -p "$ROOT"`
        `;;`
 `esac`

ltsp-update-image

Usage

This command creates an nbd bootable squashfs image for the specified chroot name or architecture. By default this should be a directory in /opt/ltsp.

root@server #``ltsp-update-image <name or arch>

ltsp-update-sshkeys

Usage

This command updates the client chroots with the server's public ssh keys. Normally, when building a chroot with ltsp-build-client, this is done automatically. You have to use this command when your server changes its IP address.

root@server #``ltsp-update-sshkeys

ltsp-update-kernels

Usage

This command copies the boot/ directory from LTSP chroots to the TFTP directories in order to make them available to PXE clients. Copying kernels from inside NBD images is also supported. CHROOT can be a full path or a subdirectory of the /opt/ltsp base directory, and if it's unset, all available chroots are processed.

root@server #``ltsp-update-kernels i686

ltsp-config

Running an LTSP server requires certain other tools like a DHCP or NBD server, with specific configurations. With ltsp-config you can generate or update these configuration files based on your current setup.

Usage

The ltsp-config command accepts several options to generate the files: dnsmasq, isc-dhcp-server, lts.conf and nbd-server. The first three should be run manually, the configuration of nbd-server is called automatically at the end of ltsp-update-image. For instance, to generate a dnsmasq config file do:

root@server #``ltsp-config dnsmasq

Extensions

Updating or generating a configuration file for a service, requires the service to be restarted. Because the various distro's use different methods for initializing service scripts, the function to call a service can be distro specific.

Example

/usr/share/ltsp/ltsp-config-functions

` # Gentoo-specific function overrides for ltsp-config`
 `service() {`
    `if [ -x /sbin/rc-service ]; then`
        `rc-service "$@"`
    `fi`
 `}`

ltsp-chroot

When chrooting into the client, you don't have your package tree in the client chroot by default. In the installation, the server package tree (among others) is bind mounted in the client tree, which means the client chroot actually uses the server's copied package tree. The command ltsp-chroot can be used to chroot into a specified chroot.

Usage

By default it chroots into /opt/ltsp/ and mounts nothing. Default behavior can be changed by using the ltsp-chroot.conf file, or by using command line arguments. The following example mounts the package dirs and chroots into /opt/ltsp-dev/amd64.

root@server #``ltsp-chroot -a amd64 -b /opt/ltsp-dev --mount-package-cache

Extensions

Typically mounting the package cache is distribution specific. This function typically bind mounts the server directories containing the available packages. The mount_package_cache() function can be defined in the distro specific extension for ltsp-chroot.

Example

/usr/share/ltsp/ltsp-chroot-functions

 `# Gentoo-specific function overrides for ltsp-chroot`

 `mount_package_cache() {`
    `mark_mount --bind /usr/portage "$ROOT/usr/portage"`
    `mark_mount --bind "/usr/portage/packages/${ARCH}" "$ROOT/usr/portage/packages"`
    `# remove if ltsp ever in portage tree`
    `mark_mount --bind "/var/lib/layman" "$ROOT/var/lib/layman"`
 `}`

ltsp-localapps

Applications typically run on the server, and display their output on the thin client display. With LTSP, it is possible to run an application on the thin client, thereby utilizing more of the local resources and putting less of a load on the server. We call this Local Apps.

Usage

If you want apps to run on the client itself, a few changes need to be made. First of all, an extra line in your lts.conf.

lts.conf

LOCAL_APPS = True

Each application which has to run locally, needs to be installed in the client chroot. You can do this by updating your client chroot environment and installing the desired packages. It is also possible to combine this with your ltsp-build-client by adding the packages to the build client configuration. After rebooting the client you can now run any application which is installed in the chroot by issuing the following command:

user@server $``ltsp-localapps xterm