December 11, 2016

Orange Pi PC - Armbian build

I am doing the armbian build process on my up to date Fedora 24 desktop.

Install Virtual Box

The first thing is to install virtual box.
su
cd /etc/yum.repos.d
wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
dnf update
uname -a
  Linux trona 4.8.12-200.fc24.x86_64 #1 SMP Fri Dec 2 18:45:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
dnf install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms
  (I already had all of these, except dkms)
dnf install VirtualBox-5.1
  (note that just asking for VirtualBox does not work)
/usr/lib/virtualbox/vboxdrv.sh setup
  vboxdrv.sh: Building VirtualBox kernel modules.
  vboxdrv.sh: Starting VirtualBox services.
usermod -a -G vboxusers tom
  (this just adds me to the end of the line in /etc/group)
exit
After this I can start vitual box as user tom by typing "VirtualBox".

Set up a virtual machine

Two questions arise immediately. One is how to get virtual box to boot from an ISO image. The other is that virtual box shows only 32 bit guest operating system choices.

My processor is an "Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz". You would think it would support 64 bit virtualization. It does, but I need to get into the BIOS and enable them (who would have known). So, we shutdown linux, and hit the DEL key during the reboot, get into the BIOS and find a setting "Intel Virtualization Technology" and indeed it is disabled. We change the setting to enabled, save and reboot. Voila! now Virtual Box shows 64 bit options!

I see the "vmx" flag now in /proc/cpuinfo, but for all I know it was there before enabling the feature in the BIOS.

Now, how do we get Virtual box to install from /home/tom/mini.iso ? This is tricky, and not obvious. The thing to do is to start the new virtual machine. This brings up a "start wizard" and if you look really close there is a tiny folder icon next to the menu (with only one entry for my physical DVD drive). You fuss around trying to select this microscopic thing, and once you get it, you can navigate to the desired iso file.

Virtual box has weird buggy mouse issues. It seems like the mouse position is offset down and right from the actual screen position. Once I figure this out I can manage to get it to do what I want; sort of.

amd64 -- but I have an Intel i7 !!

Everything is OK. Fedora calls the same thing x86_64, but Debian thinks it is giving credit where credit is due to call it amd64. Be that as it may, selecting amd64 is the right thing for an Intel i5 or i7, so don't worry and get a good nights sleep.

Set up Ubuntu Xenial inside Virtual Box

I am following Igor Pecovnik's instructions to the letter for now. I can try doing this "native" on Fedora after getting some experience. So I use his link to fetch the ISO for Ubuntu Xenial 16.04 x64.

I manage to get a virtual machine "Xenial" set up with a 32G virtual hard drive. And I manage to get it to boot from "mini.iso" and run the Ubuntu installer.

The fies for this are in /home/tom/VirtualBox VMs/Xenial

I select hostname "xenial". It does successful DHCP.
I select the ubuntu mirror us.archive.ubuntu.com
It actually figures out my timezone as America/Phoenix !

I select "basic Ubuntu server" along with "standard system utilities".

The install finishes and reboots, and now we confront the next problem. It wants to run the installer again!

How to shut this darn thing down

Under Devices -- Optical Drive there is a "remove disk from virtual drive" but it refuses to let me use this unless I "force unmount", so I do. Then using the virtual reset button gets it to boot Xenial and I get a prompt. I can log in as "tom", but what the heck is the root password?

Once I get past the root password issue, I use sync; halt to halt the machine, then power down via File -- Close, which gives me a dialog that includes "power down". Who would have known?

Ubuntu root password

Ubuntu is one of these brain damaged systems that disables the root account and expects you to use sudo all the time. Fat chance of that. So set a root password in the usual way via:
sudo passwd

Ubuntu static IP address

For some inscrutable reason, it has set a static IP of 10.0.2.15. This is "as it should be" and is all about virtual box, not Ubuntu. This is how the virtual machine accesses the internet to get updates and such. It is working as a bridged adapter and is using NAT.

To allow access from the host machine, you can switch this to a "host only" setup (thus loosing your access to the internet), or you can add a second adapter that is host only. I do the latter. With the machine shut down, I go to Settings -- Network -- Adapter 2 and set it up as host only.

When I try to do this I get the error (no host only adapter was selected). I go to File -- Preferences -- Network and select "host only adapter". A button to the right will add one (it calls it vboxnet0). This is 192.168.56.1. After this I can set a host only adapter for my virtual machine.

I thought I was going to have to use this old trick on the linux host:

ip addr add 192.168.56.5/24 brd + dev en01 label eno1:vbox
But a look via ifconfig -a shows:
vboxnet0: flags=4163  mtu 1500
        inet 192.168.56.1  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::800:27ff:fe00:0  prefixlen 64  scopeid 0x20
        ether 0a:00:27:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 126  bytes 20030 (19.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
So virtual box has already set up all the host side stuff just right. I just need to setup a static IP in Ubuntu by editing the file /etc/network/interfaces as follows:
# The host-only network interface
auto enp0s8
iface enp0s8 inet static
address 192.168.56.13
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255
Now I can ping 192.168.56.13 from the host. And I can add an entry "xenial" to /etc/hosts and do:
ssh xenial
Well actually we have to install the ssh server first:
apt-get install openssh-server
service ssh restart
systemctl enable ssh.socket
They say the "enable" should not be required, but there it is for the record.


Have any comments? Questions? Drop me a line!

Tom's electronics pages / [email protected]