Skrevet av Emne: Getting started with LTSP and Blackbox  (Lest 19252 ganger)

Utlogget Floyd-ATC

  • Livstidsdiktator
  • Administrator
  • Guru
  • *****
  • Innlegg: 542
  • Karma: +12/-0
    • MSN Messenger - floyd@atc.no
    • Vis profil
    • floyd.atc.no
    • E-post
Getting started with LTSP and Blackbox
« på: 27. November 2015, 14:00 pm »
  • [applaud]0
  • [smite]0
  • The LTSP - Linux Terminal Server Project home page can be found here:
    http://www.ltsp.org/

    I recommend starting with the newest Ubuntu LTS Desktop version. Download and install, then make sure you assign a static ("manual") IP address. Simply click on the network icon and use "edit connection" to accomplish this. The change should take effect immediately, you can open a terminal and use the command "ifconfig" to confirm this.

    (Note: The reason we're using the Desktop edition and not the Server edition is because all the X client software will actually be running on this Ubuntu machine.)

    Installing LTSP is as simple as this:
    Kode: [Velg]
    sudo apt-get install ltsp-server-standalone
    Next, build the initial client file system and boot image using this command:
    Kode: [Velg]
    sudo ltsp-build-client --arch i386
    Note: If you will only be using 64bit thin clients then read "i386" as "amd64" throughout this document. Note that this will mean NO 32bit clients will be able to work with your terminal server.

    Now you have to configure your DHCP server to offer PXE clients a way to boot off your thin client boot image. If you already have a DHCP server which can be configured for this, you need to add the following options:
    Kode: [Velg]
    next-server <YOUR SERVER IP HERE>;
    filename "/ltsp/i386/pxelinux.0";

    Alternatively, LTSP comes with a DHCP server on its own. In fact, it comes with both "isc-dhcp-server" and "dnsmasq" and this can be a little confusing because we won't be using any of those init scripts or configuration files. Instead, we will use one that's part of LTSP itself:
    Kode: [Velg]
    sudo joe /etc/ltsp/dhcpd.conf
    It's important not to interfere with the "official" DHCP on your network if one exists, that's why I recommend the following setup:
    Kode: [Velg]
    not authoritative;

    subnet 192.168.0.0 netmask 255.255.255.0 {
        min-secs 3; 
        range 192.168.0.100 192.168.0.200;
        option domain-name "your.domain.name";
        option domain-name-servers 8.8.8.8;
        option broadcast-address 192.168.0.255;
        option routers 192.168.0.1;
        option subnet-mask 255.255.255.0;
        if substring( option vendor-class-identifier, 0, 9 ) = "PXEClient" {
            filename "/ltsp/i386/pxelinux.0";
        }
    }
    Remember to carefully substitute the IP addresses for your own. Notice that we do not need a "next-server" here because the clients will default to using the DHCP server as their TFTP boot server.

    You will probably spend some time getting this configuration file just right for your environment.

    You can check the syntax using the following command:
    Kode: [Velg]
    sudo dhcpd -t -cf /etc/ltsp/dhcpd.conf
    To restart the DHCP server, use the following command:
    Kode: [Velg]
    sudo service isc-dhcp-server restart
    Now it's time to try booting your first thin client. The PXE boot loader should pick up the configuration after a few seconds, download the initial boot image via TFTP and then boot it. What happens next is the boot image requests a new IP address and mounts the thin client operating system via the Linux Network Block Device (nbd-server) service running on your terminal server. If all goes well, you should get a login screen after a few moments.

    The login screen is running on your thin client, but beyond that everything you see is actually running on the Ubuntu server. Try opening an "xterm" window and notice the host name in the prompt.

    If you have a very thin client, that is one with very little RAM and/or CPU, you will notice that things are running very slowly. In fact, when using the default Gnome 3 interface on my HP T5720 clients, the user experience is actually quite useless. Troubleshooting it, I found that the SSH process responsible for tunneling the X traffix between the server and client was using more than 80% of the CPU time on my thin client. Do NOT be discouraged by this, we've only just started!

    The first thing we will do is tweak LTSP a bit. Create a configuration file for this:
    Kode: [Velg]
    sudo joe /var/lib/tftpboot/ltsp/i386/lts.conf
    Here is the config file I'm using:
    Kode: [Velg]
    [Default]
    SCREEN_02=shell
    SCREEN_07=ldm

    # Limit the RAM allocated by X client applications on the thin client
    X_RAMPERC=80

    # Use custom login theme under '/opt/ltsp/i386/usr/share/ldm/themes'
    LDM_THEME=ltsp

    The main reason Gnome 3 is so slow is because it uses bitmap images, animations and sound effects everywhere. This can hardly be noticed when running it locally but it is killing the thin client CPU and display adapter.

    We will solve this by installing "blackbox" on your terminal server. To do so, use the following command:
    Kode: [Velg]
    sudo apt-get install blackbox
    We will also need "blackbox" installed on the thin client, so execute the following commands on the server as well:
    Kode: [Velg]
    sudo ltsp-chroot
    apt-get install blackbox
    exit
    sudo ltsp-update-image

    Huh, what did we just do?? The command "ltsp-chroot" lets you perform maintenance directly on the file system which will be running on your thin client. We installed "blackbox" into that file system, then asked LTSP to update the image file that will be presented to the thin clients via nbd-server.

    On your thin client, log out now. You should be prompted with a message saying that a new version of the system is available and the thin client will reboot automatically.

    You should get the same login screen again, but don't log in just yet. Instead, click "Preferences" in the lower left corner, then select "Session" and change from "Default" to "Blackbox". Now log in.

    You should now see a grey screen with only a small toolbar at the bottom. Congratulations, this is the "blackbox" window manager. By default it is extremely bare-bone, in fact if you rightclick on the desktop you only get three options.

    Just as Blackbox is extremely small and simple but contains everything you actually need, so does the documentation:
    Kode: [Velg]
    man blackbox
    The first thing you will want to do is edit the menu file to get easy access to the programs you need:
    Kode: [Velg]
    sudo joe /etc/X11/blackbox/blackbox-menu
    Here's a sample menu file to get you started:
    Kode: [Velg]
    # Sample blackbox menu file created by floyd@atc.no
    [begin] (Main menu)

      [submenu] (Applications) {Applications}

        [submenu] (Development) {Development}
          [exec] (Arduino) {arduino}
          [exec] (Eclipse) {eclipse}
          [exec] (Fritzing) {Fritzing}
        [end]

        [exec] (Gimp image manipulation) {gimp}

        [submenu] (LibreOffice) {LibreOffice}
          [exec] (Calc) {localc}
          [exec] (Draw) {lodraw}
          [exec] (Impress) {loimpress}
          [exec] (Writer) {lowriter}
        [end]

      [end]

      [submenu] (Internet) {Internet}
        [exec] (Firefox web browser) {firefox}
        [exec] (Thunderbird mail) {thunderbird}
      [end]

      [submenu] (Tools) {Tools}
        [exec] (Calculator) {gnome-calculator}
        [exec] (Disk usage) {baobab ~}
        [exec] (File explorer) {xfe ~}
        [exec] (gFTP) {gftp}
        [exec] (Text editor) {gnome-text-editor}
        [exec] (Xterm) {xterm}
      [end]

      [nop]

      [submenu] (Preferences) {Preferences}
        [stylesmenu] (Custom styles) {~/.blackbox/styles}
        [stylesmenu] (Predefined styles) {/usr/share/blackbox/styles}
        [reconfig] (Reload configuration)
        [restart] (Restart desktop)
        [exec] (System settings) {unity-control-center}
        [config] (Window settings)
        [workspaces] (Workspaces)
      [end]

      [exit] (Log off)

    [end]

    Remember that these menu options will only work if the actual program is installed on your terminal server. For instance, to install the Eclipse IDE, simply run this command in Ubuntu:
    Kode: [Velg]
    sudo apt-get install eclipse
    Referring to the blackbox man page, you should see a lot of ways that Blackbox can be tweaked to look and feel pretty much the way you want by adding the bells and whistles needed.

    Another thing you may want to look into if you have a decent display adapter on your thin clients is turn off "image dithering" which is on by default and tries to use the CPU to compensate for lack of color depth. (In my blackbox-menu, it's under "Preferences", "Window settings", "Image Dithering")

    Using Blackbox and firefox, I can browse the web and run YouTube videos on that very same HP T5720 which couldn't even handle the Gnome desktop.

    Yes, it's really that simple! Have fun and please let me know how it works for you :-)


    -Floyd.

    --
    Det finnes 10 typer mennesker;
    de som forstår binærtall, de som ikke gjør det, og de som forstår Grey code.

    Utlogget Cybersyn

    • n00b
    • *
    • Innlegg: 2
    • Karma: +1/-0
      • Vis profil
      • localhost
    Sv: Getting started with LTSP and Blackbox
    « Svar #1 på: 16. Januar 2016, 16:32 pm »
  • [applaud]0
  • [smite]0
  • Why does blackbox vs Gnome have an impact on thin client performance? Doesn't the terminal server handle graphics? If it does, is it able to utilize a GPU?



    Utlogget Floyd-ATC

    • Livstidsdiktator
    • Administrator
    • Guru
    • *****
    • Innlegg: 542
    • Karma: +12/-0
      • MSN Messenger - floyd@atc.no
      • Vis profil
      • floyd.atc.no
      • E-post
    Sv: Getting started with LTSP and Blackbox
    « Svar #2 på: 16. Januar 2016, 17:55 pm »
  • [applaud]0
  • [smite]0
  • Why does blackbox vs Gnome have an impact on thin client performance? Doesn't the terminal server handle graphics? If it does, is it able to utilize a GPU?

    In short, no.

    The X protocol only sends meta information ("window Foo here, widget Bar there") from the X client application (running on the terminal server in this case) and to the X server (running on the thin client). Remember, the terms client/server are kind of opposite when dealing with X, see https://en.wikipedia.org/wiki/X_Window_System#Purpose_and_abilities

    I think the problem is actually too much meta information (gradients, bitmaps, animations etc) being transmitted over the encrypted network connection for the thin client to handle properly. If you open the shell on SCREEN_02, "top" will show that the CPU utilization is stuck at 100% with Gnome and about 3/4 of that is the ssh process. With blackbox, it nearly drops to zero. Maybe disabling the encryption would free up enough cycles to make Gnome usable, I spent a few days trying to do this but couldn't get it to work.

    Anyway, the Gnome UI is just for eye candy. Just about every Gnome or KDE application can be used just fine in blackbox (or any other window manager) as long as they don't violate the X protocol by reaching into the Gnome UI itself. I have not yet found a useful application that doesn't work. Here's a few I'm using without problems: Wireshark, GIMP, OpenOffice, Firefox, Arduino, Eclipse and Audacity. Even VLC and flash video works, except the framerate becomes useless I try to go fullscreen.


    -Floyd.

    --
    Det finnes 10 typer mennesker;
    de som forstår binærtall, de som ikke gjør det, og de som forstår Grey code.

    Utlogget Cybersyn

    • n00b
    • *
    • Innlegg: 2
    • Karma: +1/-0
      • Vis profil
      • localhost
    Sv: Getting started with LTSP and Blackbox
    « Svar #3 på: 16. Januar 2016, 23:10 pm »
  • [applaud]0
  • [smite]0
  • That's interesting! I thought it was more like VNC.
    How does it handle SDL and OpenGL (read: games)?
    And in the case of VLC, is the video decoded by the client or the server? What limits the framerate in your case? The thin client hardware or the network bandwidth?
    « Siste redigering: 17. Januar 2016, 01:04 am av BrutalOst »



    Utlogget Floyd-ATC

    • Livstidsdiktator
    • Administrator
    • Guru
    • *****
    • Innlegg: 542
    • Karma: +12/-0
      • MSN Messenger - floyd@atc.no
      • Vis profil
      • floyd.atc.no
      • E-post
    Sv: Getting started with LTSP and Blackbox
    « Svar #4 på: 17. Januar 2016, 10:11 am »
  • [applaud]0
  • [smite]0
  • That's interesting! I thought it was more like VNC.
    How does it handle SDL and OpenGL (read: games)?
    And in the case of VLC, is the video decoded by the client or the server? What limits the framerate in your case? The thin client hardware or the network bandwidth?

    The X protocol works with both 2D and 3D (openGL) but the thin client would have to use software rendering and would be useless for gaming. That having been said, it is ofcourse possible to use a thick client with a GPU as an X server (remember: where the user sits), but the X protocol isn't built for gaming so I doubt it would work well. A typical use case for terminal servers and 3D is CAD modeling, design, maps etc where the heavy lifting is done by a huge server with tons of RAM and CPU not suitable for an office environment. Gaming OTOH is not a viable use case for terminal servers, you need low latency bidirectional streaming for that.

    VLC, including the codec, runs on the terminal server so that's where the media streams are decoded. The audio and/or video is then encoded and transmitted using the X protocol. Physical network bandwidth is not a concern in my case (gigabit ethernet) but the X connection is encrypted using ssh which means the thin client CPU has to deal with both the decryption and the media. This is why live video really is a worst case scenario for this kind of setup.

    Completely unrelated to LTSP: In an enterprise you would use Citrix HDX technology for this, where the Citrix terminal server offloads the video stream decoding to special-purpose hardware in the thin client. In real life, HDX is a configuration nightmare as soon as you have more than one type of thin clients because you have to deal with firmware revisions, media players and codecs that keep changing all the time. Do you know what codecs YouTube.com support at the moment? What Wyse or HP models require what firmware for the software you have installed on your TS farms and what are your users' actual requirements? Is it using HDX right now or did it silently fall back to server-side rendering? HDX is fantastic when it works; users can stream 1024p content in fullscreen and the terminal server sits almost idle.

    I don't think anything similar to HDX exists for X Window System but I would love to be wrong.


    -Floyd.

    --
    Det finnes 10 typer mennesker;
    de som forstår binærtall, de som ikke gjør det, og de som forstår Grey code.

    Utlogget Cybersyn

    • n00b
    • *
    • Innlegg: 2
    • Karma: +1/-0
      • Vis profil
      • localhost
    Sv: Getting started with LTSP and Blackbox
    « Svar #5 på: 17. Januar 2016, 11:46 am »
  • [applaud]0
  • [smite]0
  • The X protocol works with both 2D and 3D (openGL) but the thin client would have to use software rendering and would be useless for gaming.

    Bummer. But I stumbled upon something called VirtualGL which seems to hook the X client to process graphics on the client and only send the resulting 2D bitmap to the server.

    But what exactly does LTSP do? I'm not very fond of Debian. Do you think the same can be accomplished with dnsmasq and systemd?



    Utlogget Floyd-ATC

    • Livstidsdiktator
    • Administrator
    • Guru
    • *****
    • Innlegg: 542
    • Karma: +12/-0
      • MSN Messenger - floyd@atc.no
      • Vis profil
      • floyd.atc.no
      • E-post
    Sv: Getting started with LTSP and Blackbox
    « Svar #6 på: 17. Januar 2016, 13:14 pm »
  • [applaud]0
  • [smite]0
  • But what exactly does LTSP do? I'm not very fond of Debian. Do you think the same can be accomplished with dnsmasq and systemd?

    AFAIK, there's no reason to think it can't be done.

    LTSP is just a small collection of scripts; a shrink-wrapped solution to configuring X, building a bootable image and offering it to PXE capable clients. Debian/Ubuntu isn't my first choice either but my initial attempts to do it with CentOS were unsuccessful because I didn't have the time and skill to adapt those scripts to a slightly different environment.

    Obviously, in a complex client/server solution with lots of moving parts you have to get everything just right or nothing seems to work. Figuring out all the problems can be a frustrating and time consuming process. Maybe if I went back to it now that I have a working solution as reference... but then again, I already have a working solution so now there's lack of motivation :-)


    -Floyd.

    --
    Det finnes 10 typer mennesker;
    de som forstår binærtall, de som ikke gjør det, og de som forstår Grey code.