Saturday, September 9, 2017

Simple ICS Lab - Part 1 - Lubuntu VM Installation, Guest Additions, and Snapshots

UPDATED 2019-02-16 so that instructions match Lubuntu 16.04.5 LTS. (Originally written for Lubuntu 16.04.3.)  Also modified to use latest version of VirtualBox -> 6.0.4.

The first task to begin setting up the home ICS lab is the installation of a Lubuntu VM. The VM will be used to progress through additional tasks coming up in later blog posts. For an intro to the Simple ICS Lab refer to Simple ICS Lab - Intro and Prep. This is a very long post. However, the steps needed to be performed are simple. A lot of the post length is due to including many screenshots.


Let's get started!

Download the Lubuntu ISO
  • Open up a web browser and download Lubuntu 16.04.5 LTS 64-bit from http://lubuntu.me/downloads/
  • Scroll down the page to the section labeled "Version 16.04.5 LTS" and click on the "Desktop 64-bit" button. Ensure that your browser begins to download the ISO file.


  • Verify that the SHA-1 hash of the downloaded ISO file matches the documented SHA-1 hash. Open a command prompt and run certUtil to generate the SHA-1 hash of the downloaded file. The command is, certUtil -hashfile lubuntu-16.04.5-desktop-amd64.iso SHA1

  • Once the two SHA-1 values are verified to match we can be sure that the obtained ISO file is not corrupt and has not been tampered with.
Create the Virtual Machine in VirtualBox
  • If necessary, install VirtualBox on your computer using the instructions found at https://www.virtualbox.org/.
  • Click the "New" button located across the top.

  • A dialog window will open to begin the process of defining parameters for a new VM. If you see an "Expert Mode" button near the bottom of the window, click on it. We want to be working in Expert Mode while we setup the VM.

  • You should now see a "Create Virtual machine" dialog window similar to the screenshot below.

  • Enter a name for the VM. I specified "Lubuntu ICS" since this VM will be used to learn about Industrial Control Systems (ICS).
  • Verify that the "Type" changes to "Linux".
  • Verify that the "Version" is set to "Ubuntu (64-bit)".
  • Verify that the "Memory size" is set to "1024 MB".
  • Verify that the "Hard disk" option "Create a virtual hard disk now" is selected.
  • Your "Create Virtual Machine" window should now look like this:

  • Once you have reviewed the settings on the "Create Virtual Machine" dialog click the "Create" button.
  • The "Create Virtual Hard Disk" dialog window will display.
  • Leave the "File location" specified as "Lubuntu ICS" (or the VM name you chose).
  • Verify that the "File size" is set to "10.00 GB".
  • Verify that the "Hard disk file type" is set to "VDI (VirtualBox Disk Image)".
  • Verify that the "Storage on physical hard disk" is set to "Dynamically allocated".
  • Check that your window looks like the one below and then click on the "Create" button.

  • You should now be returned to the main VirtualBox window with the new Lubuntu ICS VM listed.


Modify Additional VM Settings
  • With the Lubuntu ICS VM selected click the "Settings" button.

  • The "Lubuntu ICS - Settings" dialog window should appear.
  • The "General" settings should be displayed. Click on the "Advanced" tab on the right side of the window.
  • Change the drop-down option for "Shared Clipboard" so that "Bidirectional" is selected. This allows you to copy and paste from the host computer to the guest, or guest to host, in order to make entering commands or moving data between systems easier.

  • Click on "Display" within the left set of items. The "Display" details will now show in the right side of the window.
  • Drag the "Video Memory" slider all the way to 128 MB.

  • Next click on "Network" within the left set of items. The "Network" details will now show in the right side of the window.
  • Modify the setting for "Attached to:" under "Adapter 1" by clicking on the drop-down menu. Select "Bridged Adapter" from the options.
  • The value for the "Name:" field will automatically populate with the active network adapter of the host computer. (You want this to be your Wi-Fi adapter.)

  • Now click on "Storage" within the left set of items. The "Storage" details will now show in the right side of the window.
  • Click "Empty" within the "Storage Tree" under "Controller: IDE".

  • To the right within "Attributes" next to "Optical Drive:" click the optical disk icon to display a drop-down menu. Select the option "Choose Virtual Optical Disk File..."

  • When the "Please choose a virtual optical disk file" dialog appears, navigate to the location on your computer where the previously downloaded Lubuntu ISO file exists. (Most likely this will still be in your Downloads folder.)
  • Once found, click on the name of the .iso file and click the "Open" button.
  • Updated information should now be displayed in the "Information" section underneath the "Attributes" section of the "Lubuntu ICS - Settings" dialog window.

  • Click on the "OK" button to return to the main VirtualBox window.
Start the Lubuntu ICS VM and Install the OS
  • With the Lubuntu ICS VM selected click on the "Start" button.

  • A new window will appear and show the Lubuntu ICS VM starting up.
  • When the "Language" selection appears in the new window, click in the window and use the arrow keys on your keyboard to select a language. When your desired language is selected, press "Enter" on your keyboard to continue. (I have selected English.)
  • NOTE: When you click in the VM window your mouse cursor and keyboard input will be captured. If you need to return to your normal desktop outside of the VM window, click the "Ctrl" key on the right side of your keyboard. This will release the mouse cursor and keyboard input from the VM window.

  • Next you should see a screen with installation options. Arrow down to select "Install Lubuntu" and then press "Enter" on your keyboard.

  • The Lubuntu installation now begins.
  • At the "Welcome" screen click "Continue"

  • Leave the check boxes unselected on the "Preparing to install Lubuntu" screen and click "Continue".

  • Accept the default to "Erase disk and install Lubuntu" on the "Installation type" screen and click "Install Now".

  • Click "Continue" when prompted about continuing by the "Write the changes to disks?" dialog.

  • On the "Where are you?" screen type your city in and select the correct option from the automatically displayed list and click "Continue".

  • On the "Keyboard layout" screen select the option that matches your keyboard and then press the "Enter" key on your keyboard. (You may not be able to see a "Continue" button due to the screen resolution of the install process, but pressing the "Enter" key on your keyboard should move the installation to the next screen.)

  • Enter the required information on the "Who are you?" screen. I've chosen variations based on the VM name and purpose. Be sure to specify a password you will remember!
  • Optionally, you can select "Log in automatically" for convenience if you are the only one using the VM.
  • The "Continue" button may not be displayed based on the installation screen resolution. Press the "Enter" key on your keyboard to move the installation process to the next step.

  • A screen showing installation progress should now be displayed. Wait as the progress bar moves to completion.

  • When the installation is completed a dialog will display prompting you to restart. Click the "Restart Now" button to finish.

  • If you get a screen stating "Please remove the installation medium, then press ENTER:" you can go ahead and press the "Enter" key on your keyboard as VirtualBox should have automatically handled removal of the ISO.

  • You will see various screens and output display as the new Lubuntu ICS VM restarts.
  • If you chose to login automatically you will be taken to the Lubuntu ICS desktop.
  • Otherwise you should see a login screen allowing you to enter the username and password you specified during installation. Upon successful login you will then see the Lubuntu ICS desktop.

  • When started for the first time you may find a "Software Updater" window minimized.
  • Clicking on the title in the taskbar at the bottom of the screen maximizes the window.
  • Click "Install Now" to download and install updates. (If prompted, enter your password to continue.)

  • If the "Software Updater" prompts to restart click the "Restart Now..." button.
Install VirtualBox Guest Additions
  • Installing the VirtualBox Guest Additions will improve the ease of use for the VM. Particularly, resizing of the display, or resolution, can be done by dragging the VM window's edges.
  • After the Lubuntu ICS VM restarts upon completion of the "Software Updater" you should be back to the desktop. If necessary, login with your username and password so the desktop is displayed.
  • From the VirtualBox VM menu select "Devices" and then "Insert Guest Additions CD Image..."

  • A dialog window should open on the desktop with an action of "Open in File Manager". Click on the "OK" button.
  • In the "File Manager" window that opens select the menu item "Tools" then click "Open Current Folder in Terminal".

  • In the new "Terminal" window type sudo sh ./VBoxLinuxAdditions.run and press "Enter" on your keyboard.

  • You will be prompted to enter your password after which the Guest Additions will be installed.
  • Return to the "File Manager" window and eject the VBOXADDITIONS CD by clicking on the eject icon.

  • You can now reboot the Lubuntu ICS VM so that the Guest Additions will be active.
  • In the bottom-right of the desktop in the taskbar click the power icon.

  • Next, click on the "Reboot" button.

  • When the Lubuntu ICS VM has restarted you should be back to the desktop. If necessary, login to reach the desktop screen.
  • Test that the screen can now be resized. First, in the VirtualBox window menu click on "View" and then click "Auto-resize Guest Display" if it is not already checked. (Look closely to see if a checkmark is already in the icon.)

  • Test the ability to resize by dragging the edges of the VirtualBox VM window and waiting a moment for the Lubuntu ICS VM desktop to resize.
  • Another test option is to choose a new screen size from the VirtualBox VM window menu item "View", "Virtual Screen 1" set of resize choices.

  • Also test that the mouse cursor now moves seamlessly between the Lubuntu ICS VM desktop and your host system without having to use the "Ctrl" key on the right of your keyboard.
  • Once testing is done, the installation of the VirtualBox Guest Additions is complete.
Lubuntu ICS VM Snapshots
  • Taking a VM snapshot at different points in time of the Lubuntu ICS VM can be a good idea. Now is one of those times since we have a clean install of our Lubuntu ICS VM with VirtualBox Guest Additions installed and working properly. Having a snapshot at this time allows us to return to a properly working VM in case something goes wrong in the future.
  • You can take snapshots of a VM while it is running or when it is shutdown. If your preference is to take a snapshot of the system when not in a running state, click the power icon in the lower-right of the Lubuntu ICS desktop screen and then click the "Shutdown" button.
  • Next, verify that the Lubuntu ICS VM is selected in the VirtualBox VM Manager window and then click on the "Take Snapshot" button near the top-middle.

  • A dialog window will appear allowing you to name the snapshot and provide a description.
  • Enter a meaningful name and a short description of the VM. Click the "OK" button to create the snapshot.

  • You should be returned to the main VirtualBox Manager screen. You can now see that the list of all the snapshots taken includes Ready OS.

  • If you ever wish to return to a specific snapshot, select it and click the "Restore selected snapshot" button.

  • There is no need to perform a snapshot restore at this time.

Part 1 of the Simple ICS Lab is now complete. We now have a VM configured and ready for use as needed for Simple ICS Lab tasks. Next up is Part 2 where Raspbian Stretch Lite will be installed and configured on a Raspberry Pi 3.