Wednesday, June 24, 2009

Localapps on Jaunty -- if it doesn't work...

One of the main reasons I upgraded to Jaunty from the LTS Hardy was that localapps--running applications of your choice on the 'thin client'--is almost built into this version. However, like most things that are trivial to someone who really knows Linux, it can be an ordeal for one who doesn't. Thanks to pmatulis who first started answering my questions and then a huge thanks to alkisg who worked with me for over 3 hours to successfully get firefox running as a localapp!

I'm going to recreate the directions alkisg provided which supplement the fine directions at https://wiki.edubuntu.org/LTSPLocalAppsJaunty. In other words, do the instructions on that page first and if it doesn't work, then use these additional instructions, here. These directions are a 20-20 hindsight version, of course, not exactly as they happened.

I followed the directions at this above address, booted my client, opened firefox and wondered, how do I know if firefox is running in localapp mode? I now know that when firefox is working as a localapp it will say "Mozilla Firefox (on ltsp20)" or something similar, on the title bar of the window. However, one can also 'log into the client' (open console mode) and check there. If you have intrepid or jaunty you can do this:
  • open terminal on the thin client, type 'ltsp-localapps xterm' which gives a local xterm.
  • type, 'ps ax | grep fire' and check the output--a list of 'processes' that are currently running on the local client that have the text string, 'fire' in them. It will always show the, 'grep fire' process or whatever you 'grepped'. In my case, it showed that firefox was not running locally. What to do?
To try to open firefox as a localapp alkisg said to go back to the regular terminal window in GNOME and type:
  • ltsp-localapps firefox
I did and it opened up firefox as a localapp! However, the goal is to be able to just open firefox from the GNOME menu to launch it as a localapp. Since it didn't do that there must have been a problem in the lts.conf file I had earlier made. alkisg found the error--the top line of the /var/lib/tftpboot/ltsp/i386_w_localapps/lts.conf file needs to be exactly like this:
[Default]
Upon adding this, saving and rebooting the client, firefox booted from the menu!!! I've added this info to the ubuntu wiki page mentioned above.

The next step was getting firefox to be able to access the internet. Now that firefox was being run on client instead of on the server I had to set up NAT on the server to act as the 'middle man' between the client and the internet. (How does Squid/SquidGuard fit in here?) Now, alkisg had written a script that sounded pretty robust which would do all this stuff. However, since it has parts in Greek and well, Greek is unfortunately greek to me I couldn't avail myself of this help. I typed in the following commands at the terminal prompt on the server as root. (note this interrupts network access but is re-established. It did break my NX access :( and haven't been able to get it to work since)
  • invoke-rc.d dhcp3-server stop
  • invoke-rc.d NetworkManager stop
  • invoke-rc.d networking stop
  • sed -i -e 's/192\.168\.0\.254/192.168.0.1/g' /etc/network/interfaces
  • invoke-rc.d networking start
  • invoke-rc.d NetworkManager start
  • invoke-rc.d dhcp3-server start
(for further info on the 'sed' lines if you want, check out this page in the section: iptables Masquerading)
then I ran:
  • sed -i -e "s/^# By default this script does nothing\./# By default this script does nothing\.\n\niptables -t nat -A POSTROUTING -j MASQUERADE/" /etc/rc.local
  • sed -i -e 's/^[[:space:]]*##*[[:space:]]*net.ipv4.ip_forward[[:space:]]*=[[:space:]]*1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
  • sysctl -p
  • iptables -t nat -A POSTROUTING -j MASQUERADE
  • ltsp-update-sshkeys
  • ltsp-update-image -a i386_w_localapps
--actually, I typed this last command as: ltsp-update-image which updated the original chroot, not the copy I had made per the instructions on: https://wiki.edubuntu.org/LTSPLocalAppsJaunty and that resulted in issues--I still couldn't log into my client after restart. to help troubleshoot the problem I added the following 2 lines right under the line that said [Default] in the above-mentioned lts.conf file:
  • SCREEN_02=shell
  • SCREEN_07=ldm
This allows me to open the console on the thin client by pressing Alt+Ctrl+F2 and back to normal screen by pressing Alt+Ctrl+F7.
After doing the "ltsp-update-image -a i386_w_localapps" command mentioned above, everything would have worked. I *would* have been able to get to the internet on firefox at this point but, upon opening the app, firefox automatically opened a saved tabs with Flash video content. Since the localapp doesn't have much in the way of plugins, firefox crashed. When I quickly closed all open tabs and went to Google.com it worked!!!

4 comments:

  1. Hi which should I follow this guide or this one?

    https://help.ubuntu.com/community/UbuntuLTSP/LocalAppsResolvConf

    Thanks for your blog.

    ReplyDelete
  2. Hi ltsp_maniac,

    Not sure exactly where you are in the process of getting localapps to run on your LTSP system. Definitely go for the wiki solutions over this post. This post was useful when I made it, but since then the (mainly) Edubuntu community--including myself--has continued to improve/refine those instructions.

    I would do the instructions in this order:
    https://help.ubuntu.com/community/UbuntuLTSP/LTSPLocalAppsJaunty (I personally ended up skipping the first stage and didn't make the chroot copy)
    https://help.ubuntu.com/community/UbuntuLTSP/LTSPLocalAppsFirefox
    https://help.ubuntu.com/community/UbuntuLTSP/LocalAppsResolvConf
    https://help.ubuntu.com/community/UbuntuLTSP/ThinClientHowtoNAT/

    Upon completing these things your techno-condition should be pretty rosy. There's plenty of overlap on the pages, not a bad thing if you are new to localapps and thin clients. If you need help, try the irc #edubuntu: the people there are the ones who got me through this. Good luck and let me know how it goes!

    David

    ReplyDelete
  3. Hi, I did what you said putting [Default} on top of my sudo gedit /var/lib/tftpboot/ltsp/i386/lts.conf

    But everytime, I need to type ltsp-localapps openoffice.org

    If I just select it from the menu it doesn't appear in the ltsp-localapps xterm

    ps ax | grep office

    What am I doing wrong?

    Thanks.

    ReplyDelete
  4. Hi--Just saw your post. A couple of things. Did you actually put on the top line of the .lts file, as you said: [Default} or as said above: [Default]?

    Also, if I get what you are saying, you are saying that when you select the launcher (the menu item or icon of) openoffice it won't open as a localapp, that to get it to open as a localapp you need to do the command, ltsp-localapps openoffice.org.

    Did you try adding this command (ltsp-localapps openoffice.org) to the launcher?

    Good luck! also, try going on the irc #edubuntu on freenode.

    David

    ReplyDelete