Tips and Tricks/Maintenance

From LTSPedia
Jump to: navigation, search

Some maintenance and management tasks are shown below.

Contents

Update Server IP

When the server IP adress has changed, you should update the client ssh keys with ltsp-update-sshkeys.

root@server #ltsp-update-sshkeys

When using NBD, you should also update your images with ltsp-update-image.

root@server #ltsp-update-image

Update a Client Image

You can perform any kind of maintenance on a client install, for instance upgrade some are all of the installed packages or add new ones for ltsp-localapps. Basically, you chroot into the environment, do the maintenance and exit.

root@server #ltsp-chroot --arch i386 -m

When using NBD, you should also update your images with ltsp-update-image.

root@server #ltsp-update-image i386

Upgrade Client Kernel

Install the new kernel

   $ sudo ltsp-chroot -m
   $ sudo apt-get install linux-image-??? linux-headers-???

Edit the /opt/ltsp/i386/etc/ltsp/update-kernels.conf file

           # Default boot options
           # Use a menu for booting
           #PXELINUX_DEFAULT=menu
           
           # Set default timeout to 10 seconds (hundreths of a second)
           TIMEOUT=100
           
           # Set default boot item on timeout
           ONTIMEOUT=ltsp-NFS-4.9.0
           
           # Use ifcpu64.c32 to detect 64-bit, PAE or 32-bit machines.
           #PXELINUX_DEFAULT=ltsp-ifcpu64-NFS
           PXELINUX_DEFAULT=ltsp-NFS-4.9.0
           #IFCPU64=true

Update kernel (first exit chroot section)

          sudo ltsp-chroot /usr/share/ltsp/update-kernels
          sudo ltsp-update-kernels

This should affect the /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default file.

Now to test, boot a thin client, login and check

          ltsp-localapps xterm
          uname -a

Moving an NFS Chroot

You might want to move the client chroot installation on the server. This can be easily done with the following command. Don't forget to change to NFS entry in /etc/exports and reload it on the server prior to booting the client again.

root@server #find /opt/ltsp/i686/. -depth -print | cpio -pdm /path/to/new/dir/.
root@server #exportfs -r

Backup/Restore Chroot

If you want to copy the client installation to another computer or make a backup, you can archive it with tar. Remember that after copying a client installation, you will also want to ltsp-update-kernels, ltsp-update-sshkeys and ltsp-update-image if you are running NBD.

To create a tar gzip archive of a chroot, run the following command:

root@server #tar -cvzf ltsp_chroot.tgz --one-file-system --exclude=/lost+found /opt/ltsp/<arch>

To restore a chroot from a tar gzip image, run the following command:

root@server #tar -xvzf ltsp_chroot.tgz -C /opt/ltsp/

Show Connected Clients

Quick lookup

If you're interested to view the machines currently logged onto the server you have several options. The first is the arp command. This shows the machines that are connected to your server:

root@server #arp

While arp shows all connected machines, the following command only shows the ips of connected LTSP clients:

user@server $ps ax | grep -o LTSP_CLIENT='[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | awk -F '=' '{print $2}'

Bash script

But if you want a solution that makes it easy to check who is online and from which machine, you should write your own bash script.

First we save this as /usr/local/bin/whoison.awk

      BEGIN {
    	format = "%s %-10s %-6s   %-5s   %-13s  %-20s\n"
      }
      
      # on every line...
      /LTSP_CLIENT/ {
      	user       = $1
      	PID        = $2
      	login_time = $9
      	ip_address = $13
      	hostname   = $14
      	sub(/LTSP_CLIENT=/,"",ip_address)
      	sub(/LTSP_CLIENT_HOSTNAME=/,"",hostname)
      	printf(format, "    :", user, PID, login_time, ip_address, hostname)
      }

Then we save this as /usr/local/bin/whoison (remember to chmod both files to 755)

      echo "Users:"
      echo "================================================================="
      ps aux | awk -f /usr/local/bin/whoison.awk

With this done you have your very own look up command

user@server $whoison | less
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox