Category Archives: Linux

Run bitbake in Virtual Box with Shared Folder

I just had to update the build host for the embedded operating system of the AMiRo Autonomous Mini Robot to Ubuntu 16.04. Since the old-fashioned Yocto 1.7 only bakes on Ubuntu 14.04 I had to virtualize the machine. But since the downloads and builds take up a huge amount of space, my approach was to keep the virtualized build distribution (aka guest) as slim as possible and make use of the vast amount of super fast SSD_PCIE space of the Virtual Box host. So there are two possibilities:
APPROACH 1: Make use of Virtual Box Shared Folder so that the guest accesses a folder on the SSD_PCIE drive as  a network drive
APPROACH 2: Physically mounted the SSD_PCIE disk inside the guest distribution

To bypass any long readings: APPROACH 1 does not work due to unsupported hard links between host and guest and second, it is horribly slow. APPROACH 2 is the way to go and runs super fast. For didactical reasons, both approaches are listed.

Tested on the following configuration

  • Host: Ubuntu Xenial 16.04, VBox 5.2.2 + GuestAdditions
  • Guest: Ubuntu Trusty 14.04

APPROACH 1: Shared Folder

Used acronym: VB_SF – VirtualBox Shared Folder

Shared folder settings

  • Location on host (Choose any location you like): /mnt/ssd_pcie/yocto_build_root
  • Name: yocto_build_root
  • Shared folder settings: Read only, [ ] Automount, [x] Permanent
  • Add necessary users to groups
    • /etc/group on host: vboxusers:x:<gid>:<host_user>
    • /etc/group on guest: vboxsf:x:<gid>:<guest_user>

Issue 1: Symlinks are disabled for security reasons in VB_SF

Courtesy: https://ahtik.com/fixing-your-virtualbox-shared-folder-symlink-error/

Enable Symlinks in Virtual Box by entering the following commands on your host machine:

Example:

Issue 2: Correct permission on VB_SF to fix issues like “tar wants to set utime”

Courtesy: http://redwarrior.org/blog/?p=61

For some reason, uid and gid are not correctly set in Virtual Box guests, so it needs to be done manually. Add to /etc/rc.local on the guest system (mount yocto_build_root to /media/yocto_build_root):

Issue 3: Hard links are not allowed in shared folders

Only allow Symlinks adding a script (alias won’t work) that fakes the native ln command. Execute the following line on the guest system:

Issue 4: Insufficient inods on VB_SF (can be inspected by ‘df -i’)

If you execute bitbake on the guest, it will complain about insufficient inods. So you have to decrease the numbers of available inods in the sanity check of the bitbake configuration in ./build/conf/local.conf from 100k/1k to 999:

Issue 5 UNSOLVED: If tar contains hard links, they cannot be extracted

Don’t know how to fix this, so APPROACH 2 is the way to go!

APPROACH 2: Physically mounted disk

Courtesy: https://superuser.com/questions/495025/use-physical-harddisk-in-virtual-box

  • Add user to ‘disk’ group on host: usermod -a -G disk <host_user>
  • Create a vmdk file of the hard drive (not partition): VBoxManage internalcommands
  • createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/<disk>
  • Add vmdk file to mountable discs
  • Set mode: File -> Virtual Media Manager -> Choose disc -> Type: WriteThrough

Prepare guest for bitbake

Courtesy: http://www.yoctoproject.org/docs/1.7.3/ref-manual/ref-manual.html

 

Running ipython notebook on a remote (outdated) ubuntu system

Note: Jump to the end of this post to install a basic ipython-notebook environment.

ipython notebook is one of the most impressive things I’ve seen the last few years. You can reache outstanding results wich are documented and calculated on the same page. So no more paper war and mixed solutions for my problems anymore ;). Continue reading Running ipython notebook on a remote (outdated) ubuntu system

bad IPs

After nmap-ing my on of my servers, I found some ugly IPs trying to bruteforce my SSH accounts.
After writing a script for my SSH deamon which logs bad IPs and add them to hosts.deny, I thought about all the other deamons on my server.

Not willing to write fancy scripts for all the others, I installed the nice tool fail2ban which add bad IPs to a local banlist.
It works like a charm and the best of all: There is a nice frontend call bad IPs.
A nice visualization for every server owner 😉

Using vncviewer without typing in the password

Hi,

it is more convenient to use vncviewer without typing in the password all the time.
To do so, just create an own password-file in the following way:

After you typed in the password twice in plain text, just use the created file to connect to the server:

Greetz!

Building a wireless router for a wireless network with a Raspberry Pi

Hi there,

there is a lack of detailed information about to building a system, that shares it’s wireless connection which has internet (like eduroam or any other network) via an own wireless AP with it’s own setup configuration. Because of this, I’ll publish the manual how to do so with an RPI (or any other Debian system). To have a system like this can be really helpfull if you have an old system which only supports WEP, to connect with an AP which only allows devices wia WPA or certain cerificates to connect.

So what I literally want to do is the following

The setup

  • Raspberry Pi (256 MB SDRAM) with “2012-12-16-wheezy-raspbian”
  • 2GB Kingston microSD card with Kingston microSD-to-SD adapter
  • DeLOCK powered USB 2.0 HUB (B/N61393)
  • 2x LogiLink W-LAN USB with a Ralink RT5370 chipset

The Manual

I will devide the manual into three parts, while in the first part I will describe how to Continue reading Building a wireless router for a wireless network with a Raspberry Pi

Tuning the Linux history

Ever wondered why the Linux history only has a few entries, or why history is always overwritten, when you use more than one shell? Just append this few lines to the ~/.bashrc to realy save every entry you ever have made to your shell:

Here is also a nice post for working with the Linux history.

 

Running ‘cd’ && ‘ls’ from a shell

I wanted to write a script, so that I can change the directory and list the content with only one command. Like cd ~/Downloads; ls -la

so I wrote the following script called cdl, and copied it to /usr/local/bin to make it accessable from everywhere:

The problem is here, that when I run the script, the commands in the script wont be run in the active shell. To do so, it has to be run with the dotsource, like . cdl ~/Downloads,  but this suxxs. To run the script without the dotsource, there needs to be an alias in the ~/.bashrc:

Now I can access an folder and list the content with cdl ~/Downloads.

 

Debian etch = repository-Problem

Da die neue WordPress-Oberfläche 3.2 erschienen ist, muss nun unbedingt mindestens php 5.2.4 installiert sein. Als ich dann heute updaten wollte merkte ich das die standart-repositories von “etch” alle tot sind, weil es seit 2010-02 nicht mehr unterstützt wird :-(. Es gibt jedoch noch ein repository welches die letzten updates führt. Man geht wie folgt in der “shell” vor: nano /etc/apt/sources.list
nun fügt die beiden Zeilen hinzu:

deb http://archive.debian.org/debian-archive/debian/ etch main

und

deb-src http://archive.debian.org/debian-archive/debian/ etch main

Nun kann man wieder wie gewohnt die letzten paar updates die es noch gibt, ziehen. Dies löst aber leider nicht das Problem bzgl. WordPress, da nur “php 5.2.0-8 etch16” installiert wird :-(. Falls also jemand eine Idee hat, wie man unter etch auch “php 5.2.4” updaten kann…. immer her damit 😉

Edit: Da hilft wohl nur ein major-Update.