Skip to content
Snippets Groups Projects
Name Last commit Last update
doc
files
README.md
bootstrap.sh
local.yml

MPS/RA VM - StudentVersion

What is different compared to the official VM?

  • Based on current Debian buster (10.7) instead of Ubuntu 14.04 from 2014
  • New more modern Texteditor / lightweight IDE "geany" as replacement for snavigator. More info below
  • The newer OS allows for easy customization with current applications if needed
  • Preconfigured with icons and theme for a more modern look and feel
  • Better startmenu (whiskermenu)
  • Automatic login to desktop (The login doesn't add any security in this case and only takes more time)
  • No automatic screensaver / logout
  • More lightweight and optimized for use in a VM and for the specific tasks required
  • Less than 50 tasks after boot compared to more than 90 on the original VM
  • Much more diskspace inside the VM with 19GB total instead of only 8GB (the disk is dynamic so it takes only actually used space from the host)
  • Much less diskspace used inside the VM with only ~2.5GB used instead of ~5.6GB
  • Much smaller image size with less than 1GB instead of ~2.7GB
  • In case Source Navigator is still used, it is preconfigured to use the modern utf-8 textencoding instead of iso8859-1 from 1987.
  • When mounting LabDisk and h-da user homedirectory, the username is automatically saved and reused
  • The full VPN is replaced by sshuttle, which acts in the same way but tunnels all traffic through ssh
  • With sshuttle the VPN can also use passwordless authentication when it is configured
  • The VM is configured automatically ontop of a minimal debian server installation using ansible
  • The ansible config shows exactly what steps have been used to setup the VM as it is and provide a comprehensible log of what was changed
  • By using the ansible configuration, future updates (e.g. installing additional packages, changing binaries, ...) could be applied with one command inside the VM instead of needing to setup and configure a completely new VM image

Get the VM Image

As this is an unofficial project, the download is provided as an external link. Since it is likely that sensitive data (st-account information + passwords) is present at some point inside the VM, caution is advised. The provided VM image contains nothing that is not specified in the ansible playbook.

It is advised to calculate the SHA256 hash of the downloaded image file and check if it is the same as below to prevent installing a modified or broken version of the image.

Downloads

ra_mps-vm-sv-1.0.ova

SHA256: 00049DE630682904B0633B6B1D617E8B7F8D72285EAFD7F7818DC0C7F3AE31F6

Geany as replacement for SourceNavigator

In our usecase snavigator just acts as a plain texteditor with mediocre syntax highlighting and as a launcher for the insight debugger. Technically any program can be used to write the code and the compilation can be done with a simple make command. The actual heavy lifting is done by the insight debugger (in our case arm-elf-insight).

While the debugger is harder to replace, snavigator can be fully replaced by the much newer lightweight IDE "Geany". The provided configuration has geany set up to build/debug the code with only one click using the makefile located in the same directory as the codefile.

A short selection of some advantages geany has in Comparison to SourceNavigator (in our usecase):

  • No need to create, recreate or open projects. Geany can work directly on the codefiles. Just rightclick "open with geany"
  • Line numbers (idk why this is not a thing in snavigator)
  • Simple autocomplete
  • Automatic closing for ()[]{}""''
  • Integrated file explorer view
  • Remembers open files
  • Optional integration with git (actions from IDE + highlighting changes in files)
  • Code minimap
  • Generally faster
  • Generally more modern and better user experience
  • Support for actual theming with a large selection of themes available online
  • Highly customizable and extensible with many settings and and a sizable selection plugins

How to use geany with the tasks from RA & MPS labs

Rightclick the codefile and select "Open with geany"

To build the code, click the refresh button in the toolbar or select Build->Make. This will execute make build in the same directory as the currently selected code file. The output can be viewed in the compiler log at the bottom.

To change the main code file that is compiled, the makefile has to be changed, just just like with snavigator.

To run the debugger, click the double gear icon in the toolbar or select Build->Debug. This will execute make debug in the same directory as the currently selected code file. If the makefile is setup correctly, the insight debugger will start and can be treated just like with snavigator.

Note: The makefile has to include the debug target:

debug:
	arm-elf-insight $(FILE).elf

How to use the hda-util.sh (Desktop shortcuts)

A custom bashscript is installed to /home/fs/hda-util.sh which provides easy access to mounting h-da network shares, opening the VPN connection and more. This script is used in the desktop launcher shortcuts to provide 1-click actions for the most important functions.

On the first run the script will ask for the st-account username and stores it into /home/fs/.hda-username. On each following call, the username stored in that file will be used automatically. To change the username the file can either be deleted (rm ~/.hda-username) or modified to contain the right username. When calling the script manually, you have to specify -y in the beginning if you want to automatically use the stored username.

Mounting the Network shares

The script can mount the LabDisk and the homedir network shares. This uses the filemanager thunar with sftp.

Mount LabDisk by hand:

hda-util.sh -m labdisk

Mount homedir by hand:

hda-util.sh -m homedir

Connecting the VPN

The script uses sshuttle to tunnel all traffic through ssh. This has pretty much the same effect as a real VPN would have and should not make a difference in this usecase. The word "VPN" is used in most locations to avoid confusion, even though this is not a VPN connection.

Connect the VPN by hand:

hda-util.sh --vpn

Virtualbox Guest Additions (Automatic resize, shared disks)

The virtualbox guest additions should always be installed from the VirtualBox host to avoid compatibility issues. This can be done with the following steps:

  1. Start the VM
  2. Mount the guest additions
  3. Open the guest addition directory in the terminal
  4. Enter sudo sh VBoxLinuxAdditions.run
  5. Unmount the guest additions from the VM
  6. Reboot the VM
  7. Add the fs user to vboxsf group sudo usermod -G vboxsf -a fs

Building the VM from scratch

The VM is built ontop of the 32-bit version of debian 10.7.0 .

Using the following steps the VM Image can be recreated from scratch:

  1. Download the netinstall ISO for 32 bit Debian 10.7.0 (debian-10.7.0-i386-netinst.iso)
  2. Install debian in the VM while using the following settings:
    1. Create the default user with name fs and password fs
    2. Leave the root password empty to automatically configure sudo
    3. Install only the standard system utilities from the software selection, no GUI
    4. Finish the installation
  3. Boot into the new system and log into the terminal with the fs user
  4. Use the bootstrap command to install ansible+git and then execute the ansible playbook using ansible-pull:
$ wget -O /tmp/bs.sh https://code.fbi.h-da.de/vm/sv/-/raw/master/bootstrap.sh
$ sudo sh /tmp/bs.sh
  1. If everything went as planned the GUI, toolchain and other programs should be installed configured. So just reboot the VM and you should see the desktop

Optionally the VM image can be compressed for the smallest possible image size:

  • Inside the VM
$ sudo apt clean
$ sudo rm -r /var/lib/apt/lists/*
  • To overwrite all free space with 0 for better compression, access from outside of the VM OS is needed. This can be accomplished for example using a live stick or recovery mode. The root_partition is the partition where / was installed to, e.g. sda1
$ sudo zerofree -v /dev/[root_partition]
  • Optionally to compress the actual VM disk the following command must be exectued on the host:
$ vboxmange modifyhd --compact /path/to/the/vm/disk.vdi
  • When exporting the VM now the image file should be as small as possible without removing further components

Further notes

The tasks for RA and MPS labs are not included to prevent license and copyright issues. Since the toolchain consists of binaries and is provided as is, there should be no such issues there.

Known issues

System volume is on 0 by default

  • Workaround: Just turn it up

Random screenshots