How to setup Kiosk using Raspberry Pi 4

There are many open-source and paid versions out there to set up Kiosk.  I have set this up on Raspberry Pi version 1, 2, 3 and now 4.  It’s a very simple setup, I am going to set website URL default to loading when Raspberry Pi 4 boots up, but you can change it to whatever you like, it could be a slide show, video, etc.….  You can even use it as Signage, there as some other out there are better for Signage.

What you will need:

  • Raspberry Pi 4 (you can use older version too, your settings may be different)
  • SD memory card 8GB or larger
  • Network connection LAN or WiFi
  • Terminal to SSH to Raspberry or run the command on the Raspberry
  • Unzip program and image burner software

Sections:

Update Raspberry Pi 4

Create a script file

Adding script file to auto-start when Raspberry Pi boots up

Enable SSH

common issues and solutions:

Download the “Raspbian Buster with desktop” or if you want the one with an application you can do so as well it’s Raspbian Buster with desktop and recommended software image, then you will need to unzip the download file.  If your computer doesn’t have the unzip program you can download the 7zip from https://www.7-zip.org/download.html

Next, you will need the image burner software, if you have one use it or download this one https://www.balena.io/etcher/, it supports many operating systems including Windows, Linux, macOS, and Portable.  Or https://sourceforge.net/projects/win32diskimager/ it’s a little outdated, but still works.

Download Raspbian Buster with desktop: https://www.raspberrypi.org/downloads/raspbian/

Once you have downloaded and used one of the image burner software to burn into SD card, then put in the Raspberry Pi 4 and start it up and if everything goes well you should see, click Next to go through basic settings

Welcome to Raspberry Pi

Set your local Country, Language and Timezone, then click Next

Set Country, Language and Timezone

Change Default Password, enter new password and click Next

Change Default password

Setup up screen settings, You may need this to enable or disabled, click Next

Set Up Screen

Select WiFi Network or click skip

Select WiFi Network

Update Software, you can skip or let it search and install

Update Software

Running very good even while searching for updates, see Task Manger

Task Manager

Once it’s finished searching, installing new updates or if you skipped you will see option to restart, click restart so all settings takes effects

Setup Complete

Once the Raspberry Pi 4 restarts, open the Chromium once so it creates the Default/Preferences automatic, then just close it

Update the Raspberry Pi 4:

sudo apt update && sudo apt upgrade

Create a script file:

Now setting up the script file, you can name it whatever you like: example StartApp.sh, inside copy and paste this code and change the URL to whatever you like

!/bin/bash
# If Chromium crashes (usually due to rebooting), clear the crash flag so we don't have the annoying warning bar
# waits for 10 seconds before opening URL
# To disable screen saver timeout
xset s 0
# To disabled Monitor going to sleep
xset -dpms
# clean up if the power or ssh in and poweroff or if hostname changes
rm -rf ~/.config/chromium/Singleton*
# Waits for 10 seconds before starting up
sleep 10
# Make sure to change the user name if it's not default pi
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/'  /home/pi/ .config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/'  /home/pi/.config/chromium/Default/Preferences
chromium-browser --kiosk --disable-restore-session-state --disable-session-crashed-bubble --noerrordialogs --disable-infobars http://YourURL.com

You can add other options –no-default-browser-check –no-first-run that you like to prevent from pop up

Now make the .sh file executable:

chmod +x name_of_file.sh

Adding script file to auto-start when Raspberry Pi boots up

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

@lxpanel –profile LXDE-pi
@pcmanfm –desktop –profile LXDE-pi
@xscreensaver -no-splash
# add the following, if your script file located other location then the root of the user, then you will need to put the path

sh StartAuto.sh

autostart

Other setting you may need to change so it runs smooth, without any issue:

If you want to enable SSH, so you can make changes via Remote:

sudo systemctl enable ssh
sudo systemctl start ssh

That’s it

common issues and solutions:

To remove the Mouse pointer:
sudo apt-get install unclutter

Preventing Sleep of Monitor:
it’s already included in the script file, but just in case you need to change it
sudo nano /etc/lightdm/lightdm.conf
In that file, look for:
[SeatDefault] or [Seat:*]
#uncomment and insert -s 0 dpms:
xserver-command=X -s 0 dpms

If you need to fill your screen, you will need to disable the Overscan:
raspi-config
once it loads, choose Advanced Options> Next, choose Overscan:

To Disable chromium update message:
sudo touch /etc/chromium-browser/customizations/01-disable-update-check;echo CHROMIUM_FLAGS=\”\${CHROMIUM_FLAGS} –check-for-update-interval=31536000\” | sudo tee /etc/chromium-browser/customizations/01-disable-update-check

To check the monitor resolution settings currently set to:

/opt/vc/bin/tvservice -s
Should display something like this:
state 0xa [HDMI CUSTOM RGB lim 16:9], 1920×1080 @ 60.00Hz, progressive

To check what’s available settings for your monitor:

/opt/vc/bin/tvservice -m DMT
You should see something like this:
Group DMT has 12 modes:
mode 4: 640×480 @ 60Hz 4:3, clock:25MHz progressive
mode 5: 640×480 @ 72Hz 4:3, clock:31MHz progressive
mode 6: 640×480 @ 75Hz 4:3, clock:31MHz progressive
mode 8: 800×600 @ 56Hz 4:3, clock:36MHz progressive
mode 9: 800×600 @ 60Hz 4:3, clock:40MHz progressive
mode 10: 800×600 @ 72Hz 4:3, clock:50MHz progressive
mode 11: 800×600 @ 75Hz 4:3, clock:49MHz progressive
mode 16: 1024×768 @ 60Hz 4:3, clock:65MHz progressive
mode 17: 1024×768 @ 70Hz 4:3, clock:75MHz progressive
mode 18: 1024×768 @ 75Hz 4:3, clock:78MHz progressive
mode 35: 1280×1024 @ 60Hz 5:4, clock:108MHz progressive
mode 39: 1360×768 @ 60Hz 16:9, clock:85MHz progressive

Or
/opt/vc/bin/tvservice -m CEA
You should see something like this:
Group CEA has 10 modes:
mode 1: 640×480 @ 60Hz 4:3, clock:25MHz progressive
mode 2: 720×480 @ 60Hz 4:3, clock:27MHz progressive
mode 3: 720×480 @ 60Hz 16:9, clock:27MHz progressive
mode 4: 1280×720 @ 60Hz 16:9, clock:74MHz progressive
mode 5: 1920×1080 @ 60Hz 16:9, clock:74MHz interlaced
mode 6: 720×480 @ 60Hz 4:3, clock:27MHz x2 interlaced
mode 7: 720×480 @ 60Hz 16:9, clock:27MHz x2 interlaced
(prefer) mode 16: 1920×1080 @ 60Hz 16:9, clock:148MHz progressive
mode 32: 1920×1080 @ 24Hz 16:9, clock:74MHz progressive
mode 34: 1920×1080 @ 30Hz 16:9, clock:74MHz progressive



How to upgrade Ubuntu 16.04 to 18.04

It’s always best to stay up to date with technologies that you are using these days, due to lots of data getting hacked because they are not updated.  I had written a post earlier on how to upgrade Ubuntu 14.04 to 16.04, the process is the same. Make sure you have a good backup and your backup is tested to be sure data you are backup are good. If you have an option you can do an upgrade on a test server and work out any issues, that way when you do upgrade on the production system it goes smooth.

Check list before starting upgrade process

  • Data backed up and verified, which includes configs, PHP, Databases, etc…
  • Make sure your application supports newer packages versions
  • List of application/services so it can be tested after the upgrade
  • Direct access to the server, remote session will give you an error
  • Stopping application/services, not required but if dealing with a database it’s safer
  • Double-check storage space for an upgrade to download/install, you will need about 10GB

To get list of packages:

dpkg -l | grep php | tee packages.txt

Current supported Ubuntu version: https://wiki.ubuntu.com/Releases

Login to the server directly to do the upgrade, also before the upgrade make sure you are up to date and don’t have any issues with your server or resources.

You can run following commands to check for any updates:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

To start the upgrade process

Run the following command it will go through a check of currently installed packages and give you the option to check and make sure you are ok to start to upgrade.  You should check and make sure your application support new version, so it does not break your application after the upgrade. You can press d to get detailed list, when done press q and it will bring you back to option to Continue or N to cancel. Press y and Enter when you ready

sudo do-release-upgrade

If you have apache installed you will get this prompt, which you can select option best fit your needs.

If you get option for sshd_config, select keep the local version currently installed

It will scan for any obsolete software and will give you option to remove it

Once that done, then it will ask to restart the server press y and Enter

Once the server comes back you should see Ubuntu 18.04.x

Total size was about 10.5 GB and it took about 2 hours, yours may be different based on server resources, an application installed, etc…

common issues and solutions:

Very common if you are using web server you might have issue with PHP:
To check PHP version: php -v

Re-enable PHP, if upgrade from older version:

sudo a2enmod php7.2
sudo service apache2 restart

To install full PHP packages you can run following command:

sudo apt install php php-cgi libapache2-mod-php php-common php-pear php-mbstring

If you run the upgrade via SSH session you will get this message, which is not recommended:

Find all PHP version installed on your system:

dpkg -l | grep ‘\(php\)’
or
php -i | grep ‘php.ini’
or
php -i | grep ‘Configuration File’

Find all mysql version installed:

dpkg -l | grep ‘(mysql)’

How to remove old PHP version:

Before running this command, make sure you have backup of your php.ini or any custom changes did. This command will wipe out everything
Sudo apt purge php5*



How to recover offline Ubiquiti Unifi cloud key Controller

For whatever the reason your Unifi cloud key goes offline or after the firmware upgrade it shows offline, then you will lose access to UniFi Management Dashboard https://unifi.ubnt.com. This happens when there are firmware updates that corrupted, network issues, config changes or just got stuck after normal re-boot. I have helped a few small businesses with this issue. Sometime re-booting fixes the issues, but sometimes it does not. So here is what I end up doing to get back online, without waiting for their “UniFi 24/7 live tech support” because it takes a long time depending on the time of the day, I had to wait between 30 minutes to up to 2 hours one time. Worse if you re-fresh browser it may kick you out and will have to restart session again. So here is what I have done it may help out some users.

Few things you should know, one you should have a backup of configuration if you don’t and for some reason, if you have still had access to cloud key via browser, ssh then download the backup to your local computer. The process I am using here sometimes it picks up auto backup and sometimes it does not. Next, make sure you are on the same network as the cloud key and other Unifi devices. The third thing you may need to use the UniFi discovery plugin, I am using within Google chrome, which helps find the Cloud key IP in case it’s changed, not required since you can find via DHCP server or smart switch or router would have MAC/IP info.

Backups: location of autobackup is /data/autobackup

Google Chrome Plugin: Ubiquity Device Discovery Tool

Here is the start of the process, if you have access to the device via browser or ssh, then do a factory reset. Otherwise, do hard reset using a paper clip small hole on the key, Hold for five seconds or so until it’s restarting then release it, which is reset to default state.

Option 1: via GUI web browser

go to IP address of cloud key and login with your user/password or default should be (user: ubnt and password: ubnt).  Once logged in click on Maintenance>Reset To Defaults

Option 2: via SSH

Login then run command: ubnt-systool reset2defaults

Once you done the factory reset process using option 1, 2 or hard reset

Then login back via browser, default login user/pass:
User: ubnt
Pass: ubnt

To restore you will need to stop the UNIFI service in order to restore (you will see Restore is Grayed out since the server is running)

Once the Unifi service is stopped you can click on the Restore from auto backup or file you have on your local computer.

You will get confirm dialog, click Confirm

Once finish with restore, then you may need to start the Unifi service or it will reboot automatically

Then go to URL of your Unifi cloud key

You will have 3 options:

  • 1 Restore from the backup file
  • 2.  List backup if it detects, then you just choose
  • 3.  Configure new setup

Once you choose your restore option, just click on confirm to restore your backup

You should see “The system is being restored.  The controller will be restarted soon

Once it’s restarted and you able to log back as normal.  You can check for the upgrade and install it.

Your Ubiquiti WiFi controller should be back online on UniFi Management Dashboard https://unifi.ubnt.com hope this helps some of you are having issues.



How to clean up temp files automatically on Windows 10

Many users ask if there is a way to clean up temp files automatically.  Well now you can with Windows 10, you can set it up to do for you.  Just be careful about what you select to clean up automatically.  I have taken screenshots here to give you an overview, but you can go to each category to see more details and settings options.  So make the selection that works for you and let the Windows 10 automatically clean up your temp files.  Many people don’t clean up.  The download folder is where you have download any files from the internet, it could anything like a photo, videos, software, etc… So you can choose to empty automatically or do it manually.  Also, emptying recycle bin, after you delete a file by default it does not empty recycle bit, you will have to do it manually or it will do for you automatically when you reach disk space low and will empty any files deleted over 30 days.

To get to storage settings:

Start>Settings (Gear Icon)>System>Storage

To configure Storage settings:

Click on Configure Storage Sense or run it now link

Choose the options that work for you, the screenshot shows you default settings.  If you want to make changes to Temporary Files take a look at the next screenshot

Start>Settings (Gear Icon)>System>Storage>click on Temporary Files

I had already run the clean up so don’t have much now, but I did have about 6 GB of Windows update, Temp files.  Select the options that work for you.  Common area people miss is the Download folder

That’s it, hope this helps out some people, each selection have many options you can choose the one that fits your needs, you can read little help sections about the selection to help you decide, if you should delete or keep some of the temp files.



How to manage your contacts on Android phone

Managing contacts are getting easier and it could also get confusing since there are many options to sync your contact with so many accounts types.  I am going to show you some options that might help you decide and manage contacts on your Android phone.  Make sure you have a good backup of your contact is a key because when you switch to a new phone/device or lose a phone/device and set up a new phone/device you will need to sync back your contacts.  How do you know which contacts are sync to which accounts?

How to see options to manage your contacts?

Open Contact app

Then click on Menu and select Manage Contacts

  • Merge contacts
    • Able to help you find duplicate contacts, you might see 3 options: Number, Email, or Name
  • Import/export contacts
    • Allows you to Import contacts from one location to another
    • Allows you to Export contacts from one location to another
  • Sync contacts
    • This normally happens automatic, unless you have turned off
  • Default storage location
    • This is where your contact gets saved when you create a new contact by default unless you choose to save to another location
    • You might have different accounts one for personal another for Work contacts

How to merge contacts?

Sometimes you might have more than one contact with the same phone number, email or name. 


When you click on the Menu>Manage Contacts>Merge contacts

Merge contacts

How to exporting Contacts:

Open Contact app

Then click on Menu and select Manage Contacts

Select the option Import/export contacts>click on Export

Select where you want to export to, based on storage location you may have one or more options

Once you have made your selection, you can click on the Export to start exporting

How to Import Contacts:

Open Contact app

Then click on Menu and select Manage Contacts

Select the option Import/export contacts

Select the location you want the contacts import from, this maybe different for you based on how many account you have on your phone

Then select where you want to import to, again this might be different based on accounts you have on your phone.

Once you made your selection, you can click on the Import to start the import process.

How to change the Default Location to save contact:

Open Contact app>Click Manage Contacts>Click on the Default storage location

You may see more or less options based on accounts you have on your phone.

That’s it, hope this helps out some people