Instructables

Setting Up Ubuntu as a Kiosk Web Appliance

Featured
At work we have the frequent need for a machine that will allow students to access the internet without having full access to a computer.  To accomplish this task we previously resorted to creating AutoHotKey scripts on a Windows XP machine.  Many of the students and the staff who monitored these computers took issue with the computer's slow boot and running speed.  To cope with this we started to explore alternatives to Windows.  This is where we combined Ubuntu (a fast operating system) with Chromium-browser (one of the fastest browsers).  Now we have really old machines running as web kiosks that boot in 20 seconds or less and are very responsive to clicks, typing, and even flash videos and animations.

Follow the steps in this Instructable to set up Ubuntu, and Chromium if you haven't already.

Some potential uses for this type of system:
    * Web Kiosk
    * Information Booth
    * Subsonic Guest Interface
    * X10 House Control
 
Remove these adsRemove these ads by Signing Up

Step 1: Add XScreensaver & Ubuntu Restricted Extras

On our systems we found that even LCD monitors got burnt in after time.  They are not supposed to be able to do this, but they were.  To remedy this, we tried to get the default screensavers to come up.  They were not great at running from a script.  Instead the best option for this is to install the xscreensaver packages.  I like to do this from the command line so click Applications, highlight Accessories, and click Terminal.  From there enter the command "sudo apt-get install xscreensav* -y" without the quotation marks.  The asterisk at the end allows aptitude to install all of the packages that start with xscreensav, thus installing all the additional screensavers available.
If you will be using flash you will need to install the plugin for it.  The best way I've found to do this is similar to adding xscreensaver.  In the terminal window enter "sudo apt-get isntall ubuntu-restricted-extras -y".  Once this is done close the Terminal window.
Hi, thanks for your reply natrinicle, i wish it was that easy, iv had a read through that site in my google travels and tried
opera %U -k -ScreenWidth 800 -ScreenHeight 600
opera %U -k /ScreenWidth 800 /ScreenHeight 600
and tried other combinations

here what im using:
#! /bin/bash
xscreensaver -nosplash &
While true; do opera %U --kioskresetstation --nomail --nomaillinks --nosave --nodownload --reseronexit --nocontectmenu --nomenu --noprint --nokeys ; sleep 2s; done

im having no luck at all, using ubuntu 10.04 LTS and opera 11.50
is there anyway to start xrandr so opera can pick the screen resolution and go actual full screen?
natrinicle (author)  matais2 years ago
Xrandr actually is just a command line utility that dumps a lot of info about the screena that xwindows are displayed on. You might be able to take a chunk out of the xrandr code I have and put it in $() which runs a command and uses the output for that section of input. It would look something like this below, filling in the xrandr command line portion of course.

Opera %U -k -screenwidth $(xrandr command line) -screenheight $(xrandr command line)
Tried that command line with no luck but managed to figure it out after many hours

Opera -geometry 1280x1024-1-1

thanks for you help, was a nice challenge, knew there would be a way
Hello!
thanks for your instructions. I also tried the Opera Kiosk Mode. Everything works fine but there is one small problem. As for the keyboard. There is no Polish fonts in kiosk mode. Where can I change the code page layout in kiosk mode?
natrinicle (author)  menuchin1 year ago
See if this helps you: https://help.ubuntu.com/community/LocaleConf
heymatias1 year ago
Hi! Great tutorial.

I have a litle problem, it works fine at first time, and others times too, but I haven't cursor, just this ugly cross.

I know it can be fixed, but I don't know how, can one of you help me?

For the record, Google Chrome haves a few extensions to make it more kiosk, ie you can put a timeout and go to the home page after 5 minutes of inactivity.

And yes, my natural languaje isn't english, sorry for my erros :)
natrinicle (author)  heymatias1 year ago
The ugly cross is the default X cursor. It should only show up when you're not over a Chrome window. If you have it maximized then you should only see the nicer cursor.

Can you post links to the extensions in question? When I made this tutorial they didn't have anything like that in the Chromium Store. Thanks
rledger1 year ago
I ended up adding entries for xmodmap to the chromiumKiosk.sh file to disable the ctrl keys. I used xev to kind the keycode first for both the left and right ctrl keys then added the following to the script right before the while loop:
xmodmap -e 'keycode = (num from xev for left ctrl) = NoSymbol'; xmodmap -e 'keycode = (num from xev for right ctrl) = NoSymbol';

This made the kiosk not be able to use ctrl-o, ctrl-t, ctrl+alt+1, etc...
cheng0012 years ago
I did all of the steps, but as soon as I restarted my computer. It didnt auto-login to the user. It brought up the log in screen and once I selected the user that should have been auto-login, the screen went black and back to the login screen....do you have any idea what I did wrong?
natrinicle (author)  cheng0012 years ago
I would double check your chrome-kiosk.sh script and make sure it's executable.
I had this working the first time around. Second time I had this problem, script was executable, any further suggestions on what would cause this?
natrinicle (author)  Grayski1 year ago
Unfortunately, there are so many different things that could be wrong that the best advice I can give is to go back through the 'ible and verify each of the steps. Most likely it was just an overlooked command.
harries852 years ago
Great tutorial so far, but fallen at the last hurdle.

When working on Step 6, i am unable to save the file usr/share/xsessions/chromiumKiosk.sh. The error says "you do not have the permissions necessary to save the file.

Any help would be greatly appreciated

Thanks
Wonderful tutorial. Unfortunately, I have a small problem with implementation. The site I need to access requires pop-ups. I've set up an exception for the site, and the pop-up opens, but the new window is too small to be usable. I tried disabling kiosk mode and then resizing the popup window, exiting and re-enabling kiosk mode, but the pop-up window reverts to the small size.

Any way to make this work so the pop-up windows are full screen as well?

Thanks!
j
natrinicle (author)  jbchristensen2 years ago
For this, you'll probably have to edit the site in question to code the pop up window size to be larger. Typically Chrome opens pop up windows to the size they specify that they want to be opened to.
tcguys20012 years ago
Really nice tutorial, this is just what I am looking for but I am having a few problems. One machine I loaded it on I get the Kiosk session with either the regular or restricted account, making it impossible to make any changes.

The second machine everything seems to go fine until step 7, when I go to set the default session to "Kiosk Mode" and that isn't one of my choices.

Any ideas would be appreciated (I am a newbie to Ubuntu).

Thanks in advance.
natrinicle (author)  tcguys20012 years ago
Did you set it to auto login to the regular account on the first machine? If so, you'll probably have to start over since you won't be able to select the gnome desktop.

On the second machine check to make sure that you set the permissions right and that the kiosk.desktop file and chromeKiosk.sh files are in the right places. These are what cause the option to be displayed on the login screen.
eyajudah2 years ago
Nice tutorial and i must commend you did a good job....thumbs up.....it worked like charm on a tiny less than 1Gb ram, 4GB Sandisk CF Card, ubuntu 10:04.3, VIA boad with About 1Ghz of memory and runs pretty smoothly, except for some twiking...i have two issues

1- I install florence virtual keyboard, its not running in kiosk mode, only in root mode, i edit the preference file to fix it, no way...what am i missing ?

2- will like to diable swap or better still direct swap to memory and use this to minimize writing to the CF drive.....will appreciate any help.

Thanks in advance
natrinicle (author)  eyajudah2 years ago
1 - To have an application come up, you could simply edit the ChromeKiosk.sh file and add it in just before or after the chromium command.

2 - If you want to disable swap, simply don't create a swap partition when installing Ubuntu.
Thanks for your help at all times. But will like to ask if it were to be possible to have the last line of the ChromeKiosk.sh file to look like this
while true; do chromium-browser %u --kiosk --start-maximized ;Florence virtual keyboard; sleep 5s; done

To enable the Florence virtual keyboard run at kiosk mode.

At present, if the system is started in to Gnome, the Florence virtual keyboard pops up, but not for kiosk mode.

Thanks.
natrinicle (author)  eyajudah2 years ago
You almost have it right, try:

Florence virtual keyboard &
while true; do chromium- browser %u -- kiosk -- start-maximized; sleep 5s ; done

The & tells bash to run that command and continue in the script without waiting for it to finish.
You are just fantastic....on (2), am not using a hdd, i installed straight into Sandisk CF, and found out that they are not too good for write operation for too long.....i was told, there is way, most writes can be redirected into memory..by editing fstab or something....cant figure it..any help will be appreciated....
natrinicle (author)  eyajudah2 years ago
If you do not create the swap partition, with the current configuration, there should not be too many write to the drive. To load a linux system completely out of ram, you would have to create a custom boot image that would load at startup.

It's completely out of the scope of this instructable, but for additional information check out the following website:

http://www.ibm.com/developerworks/linux/library/l-initrd/index.html
gonperes2 years ago
With this tutorial and the comments below I was able to apply this settings to Ubuntu 11.10. Thank you natrinicle :)
Some comments:

1) Step 6: chromium now stores everything in the preferences file (thank you "abjorn behrendt" and "noloco").

2) You can enable automatic login for the unprivileged user like "g33kco" says, but before that you should go to the login screen and manually change the login mode/session for this user. Ubuntu will remember this for this user. Even after reboot.

3) I needed users to navigate in chromium tabs, so --kiosk mode was out of question. The problem was if chromium gets minimized, it disappears, never to be seen (unless we press Alt+Tab, but users don't know that). I needed at least a Desktop where i could put a icon to open a new chromium, and also set a wallpaper (which could say "press Atl+Tab to go back to Chrome"). So in step 3, I set the wallpaper and add a icone (http://www.liberiangeek.net/2011/11/create-desktop-shortcuts-icons-in-ubuntu-11-10-oneiric-ocelot/) to re-open chrome, just in case. For this desktop to come up for this user i added "gnome-session --session=ubuntu &" to the chromeKiosk.sh script, before "xscreensaver -nosplash &"

4) If i need to change anything after applying step 7 (auto-login), i can minimize chromium, press "Ctrl+Atl+T" to load a terminal window and type "unity &" to go back to normal mode. That may be considered a backdoor, but if anyone knows a better way, please share.
jdarmanin2 years ago
Thanks for your tutorial, very informative and VERY detailed. I've got stuck in step 7 Autolog User into Kiosk Mode. Since I'm using the latest version of ubuntu (11.10) I haven't got System->Administration->Login Screen and therefore cannot set the user to autologin in kiosk mode. Any ideas how to get this screen in 11.10? thanks in advance
natrinicle (author)  jdarmanin2 years ago
I just did a quick Google search and found this page: www.liberiangeek.net/2011/09/enable-automatic-login-in-ubuntu-11-10-with-lightdm/

Let me know if it works.
Fast reply ;).. I've tried that already, unfortunately it logs in that account with the default mode "Ubuntu" not the one I had created "Kiosk Mode". To log into "Kiosk Mode" i'll have to log out of that user, then relogin and change the mode normally.
You should be able to go to "System Settings" either on the unity bar to the left, or by clicking the Ubuntu logo and they type "System" in the search. Once there, select "User Accounts". Now click the "Unlock" in the top right corner and enter your password. Next create your basic user by clicking the little plus at the bottom left. Make sure "standard" is selected. Once the user is created, click on the "Account Disabled" next to password, set the password to something. Once you have done that, just move the slider next to "Automatic Login" so that it says on. Close the window and restart.
natrinicle (author)  jdarmanin2 years ago
Hmm, I'm not sure... Haven't tried with the latest version of the os.
Chrome is not taking up the full screen even with the --maximize setting.
natrinicle (author)  abjorn behrendt2 years ago
You need to make sure that you have the following two lines in your XSessions chromekiosk.sh file. They detect the correct screen resolution and write it out to Chrome's settings file.

cat ~/.config/chromium/Local\ State | perl -pe "s/\"bottom.*/\"bottom\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f2),/" > ~/.config/chromium/Local\ State
cat ~/.config/chromium/Local\ State | perl -pe "s/\"right.*/\"right\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f1),/" > ~/.config/chromium/Local\ State
Apparently the Top and Left fields are no longer stored in the local state, but rather the preferences file.

cat ~/.config/chromium/Default/Preferences | perl -pe "s/\"bottom.*/\"bottom\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f2),/" > ~/.config/chromiumDefault/Preferences
cat ~/.config/chromium/Default/Preferences | perl -pe "s/\"right.*/\"right\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f1),/" > ~/.config/chromium/Default/Preferences

There is a maximize setting in the preferences now too, so my thought is that the above could be simplified if that line could be forced to be true, but I don't have the programming skill to make it work.
You missed a / in the first cat line between Default and Preferences.

Fixed:
cat ~/.config/chromium/Default/Preferences | perl -pe "s/\"bottom.*/\"bottom\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f2),/" > ~/.config/chromium/Default/Preferences
cat ~/.config/chromium/Default/Preferences | perl -pe "s/\"right.*/\"right\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f1),/" > ~/.config/chromium/Default/Preferences
natrinicle (author)  abjorn behrendt2 years ago
I have tried using the maximize setting and forcing it to be true, however this does not work on the systems I have tried it on. It actually doesn't surprise me that the location of that preference has changed. Chromium has been a little unstable at keeping things in the same spot over time.
This slightly modified script works for me.  Note - I am using google-chrome, not chromium:

#!/bin/bash
xscreensaver -nosplash &
perl -pi.orig -e "s/\"bottom.*/\"bottom\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f2),/" ~/.config/google-chrome/Default/Preferences
perl -pi.orig -e "s/\"right.*/\"right\": $(xrandr | grep \* | cut -d' ' -f4 | cut -d'x' -f1),/" ~/.config/google-chrome/Default/Preferences
perl -pi.orig -e "s/\"maximized\": false,/\"maximized\": true,/" ~/.config/google-chrome/Default/Preferences
while true; do google-chrome; sleep 5s; done
phillpgh2 years ago
This is great and just what I needed for a webform survey. However, our computer is located at a location that can't receive a wired connection and I must used wireless. I'm not broadcasting the SSID and I can get this to work for the admin user as well as the kiosk user in desktop mode. however, when i switch to kiosk mode for the kiosk user, it shows no connection. my guess is that the wireless settings are not initializing. any thoughts on a solution?
natrinicle (author)  phillpgh2 years ago
Your best bet is to configure it via the /etc/network/interfaces file. I know that's not the easiest, but it is the most sure way.
I have setup wireless manually in the interfaces file following this post: http://nixcraft.com/ubuntu-debian/13278-etc-network-interfaces-wireless-wifi-example.html

It still isn't showing a connection when I login as kiosk mode. Do I have to initialize the network settings in chromeKiosk.sh and how do I do that?
natrinicle (author)  phillpgh2 years ago
You'll want to remove the Gnome Network Manager to make sure it doesn't try to take over your settings. Then just see if the connection is made. It should be a systemwide setting so it should work for any user on the system. It may take a minute to connect after logging in, so make sure to give it some time if it doesn't seem to work at first.
mchang72 years ago
Great tutorial, I am currently testing this on a set of Internet kiosk stations at a local airport and is working really well except for instances where passengers visit sites that open pop-up windows with no way of closing them (often airline sites). When that happens, the only thing left open is the pop-up window and the terminal cannot be used anymore unless it is rebooted. I guess the chromekiosk.sh script is not triggered until all windows are closed. Is there any way to prevent pop-ups from opening or at the very least a method to close all open windows? Thanks again for the great tutorial.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!