Hardware: Acer Aspire One D270 with Atom N2600, 2GB RAM, 1TB harddisk, only bios boot mode

Software:

  • Ubuntu 14.4 64bit: runs out of the box (has been installed after the installation of windows)
  • Windows 8.1 pro 64bit: only partly supported (video runs only with generic vga driver)

Installation notes: Windows:

  • Update bios for model AOD270 (a freedos usb stick may be used to run the dos bios installer: boot with option 3 ‘xms’)
  • Clean install of Windows 8.1 with a Windows 8 update product key:
    – needs dvd iso of Windows 8.1
    – iso to usb: use windows diskpart to create a primary ntfs formatted partition on the usb stick (compare with this post)
    and copy iso to usb with Windows 7 usb/dvd download tool; run bootsect.exe /nt60 X: /mbr  to make the stick bios bootable
    – run install with generic windows 8.1 key : XHQ8N-C3MCJ-RQXB6-WCHYG-C9WKB (installation only; cannot be updated)
    – after installation activate windows and enter your personal key; (might show error message (wrong key)  but updates anyway);
    windows 8 update keys are valid for windows 8.1.
  • Install updates (2014-05): KB2919355 does not install if Ubuntu has been installed. Workaround:
    – Run ubuntu and save first sectors of disk: fdisk -l /dev/sda displays in my case that sda1 beginns at sector 2048
    dd if=/dev/sda bs=512 count=2048 of=sectors_sda.bin (this saves bootloader grub)
    – Boot from Windows 8.1 install media, choose repair, extended, command line and run
    bootrec /fixmbr
    bootrec /rebuildbcd
    – now update kb2919355 should install (with disabled windows defender the update runs faster); then install all pending updates
    – boot from ubuntu install media, save windows mbr with dd and restore bootloader grub with dd (any error here might destroy all harddisk data!)
  • Install drivers: intel inf-drivers for chipset, realtek pci-express card reader, synaptics touchpad (see this reference)
  • after installation of ubuntu 14.4 the system has dual boot with grub2. But booting with grub2 into windows 8.1 breaks hibernate and shutdown from windows. So the boot menu of Windows 8.1 has to be used (as described here):
    – boot into Ubuntu and run dpkg-reconfigure grub-pc (reference 1, reference 2)
    (this allows to change location of grub boot code from sda to sdaN (=linux partition)
    – use dd to save the bootsector of sdaN (dd if=/dev/sdaN bs=512 count=1 of=sdaN.bin) and copy file sdaN.bin to a device
    which can be accessed from Windows
    – boot into Windows and copy sdaN.bin to the root of drive C:
    – now use bcdedit from admin console to create the Windows boot menu ({I} is a shortcut of the id returned by bcdedit /create)
    bcdedit /create /d “Ubuntu 14.04” /application BOOTSECTOR
    bcdedit /set {I} device partition=c:
    bcdedit /set {I} path \sdaN.bin
    bcdedit /displayorder {I} /addlast
    bcdedit /timeout 10
    bcdedit /default {I} (if Ubuntu should be the default boot menu entry)

Installation notes: Ubuntu 14.4

  • internet access by iPhone tethering:
    – by usb cable: install ipheth-utils
    – by bluetooth: install blueman and use usb bluetooth dongle (only some aspire one d270 models have builtin bluetooth).
    Pairing works with builtin bluetooth apple of ubuntu 14.4; connecting to network (pan) works only with blueman.

Skolelinux installation with workstations instead of thin clients. Hardware equipped with intel celeron 1007u (2×1.5 ghz) gives better performance if used as workstation and not as thin client. Below are some notes describing this setup.

Because these workstations replace a thin client setup, the workstations are placed in 192.168.x.0 subnets (x=0, 1, 2) and ip forwarding is enabled on tjener (/etc/sysctl.conf); tjener is installed without ltspserver packets. On the gateway (10.0.0.1) a static route has to be set (route add -net 192.168.0.0 netmask 255.255.252.0 gw 10.0.2.2; e.g. for ipfire in /etc/sysconfig/rc.local). On tjener every 192.168.x.0 network needs its own statically configured NIC (/etc/network/interfaces). And the dhcp server has to listen on all interfaces (/etc/default/isc-dhcp-server).

To add subnet02.intern ldap has to be edited with phpldapadmin:
systems / servers / tjener: zoneName=subnet0x.intern (x=0, 1, 2); inside this ldap entry there are further zoneName entries which have to be edited as well.
(bug: default config uses a trailing dot here which should be removed to make equal to zoneName intern;
with trailing dot the nis netgroup triple with fqdn name gets a trailing dot when added by GOsa
and command innetgr -f myhost.subnet00.intern fails. )
and
systems / servers / tjener / dhcp: cn=subnet0x.intern (x=0, 1, 2)

/etc/bind/named.conf.ldap2zone:
replace existing zone “subnet00.intern.” by “subnet00.intern” (without trailing dot, same for zone file name)
add subnet01.intern and subnet02.intern

/usr/sbin/ldap2bind (runs automatically every hour)
/etc/init.d/bind9 restart (maybe not required)
/etc/init.d/isc-dhcp-server restart

To add a workstation to tjener use GOsa, set name, ip-address and mac-address, enable dhcp, add tjener as time server
and enable dns (using the zone which matches the ip-address) and add the workstation to nis netgroup workstation-hosts.

Enable auto update on workstations: /etc/apt/apt.conf.d/50unattended-upgrades:
uncomment MinimalSteps and InstallOnShutdown

Install plymouth on the workstation to get a nice splash animation:
apt-get install plymouth plymouth-drm plymouth-x11 plymouth-themes-all
edit /etc/initramfs-tools/modules (intel_agp drm i915 modeset=1)
edit /etc/default/grub: GRUB_GFXMODE=1280×1024 and GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
copy a background png image to /boot/grub, unpack AzenisSkole.tar.gz (based on AzenisBuntu) inside
/usr/share/plymouth/themes/ and then run
update-grub2 and select a theme with
plymouth-set-default-theme –list; plymouth-set-default-theme AzenisSkole
preview the theme with
plymouthd;  plymouth –show-splash; sleep 15; plymouth quit
and put the theme to initramfs with
update-initramfs -u

Use grub.pxe to boot from network. This allows to keep pxe boot always on for the workstations which makes it easier to use clonezilla server.
The pxe boatloader grub.pxe can be created with grub-mkimage (details, embedded config and binary grub.pxe). In GOsa
systems / tjener / services / dhcp /subnet0x.intern (x=0, 1, 2): Bootup Filename: has to be changed (from default pxelinux.0) to
“/var/lib/tftpboot/ltsp/i386/grub.pxe” and grub.pxe has to be copied to this directory.
(This setting gets active after clicking on Save / Save / Apply and running /etc/init.d/isc-dhcp-server restart)

Bugfix: sometimes freshly booted workstation do not allow login. What seems to help is:
/etc/rc.local: /etc/init.d/nscd restart

Configure workstations for classroom use: chmod -R o-rwx  ()and smae for /skole/tjener/home0) to get private home directories
and add to /etc/skel: ./kde/share/config/dolphinrc:
[General]
ShowSelectionToggle=false
and add to /etc/skel: ./kde/share/config/kwalletrc:
[Wallet]
Enabled=false

Install apache-openoffice because libreoffice coming with debian wheezy is outdated and buggy (crashes). Install google chrome to get its builtin flash and pdf support.

If tjener runs in xen /etc/fstab needs the option nobarrier. (This avoids I/O errors in domU.)

Clonezilla server (DRBL): Install minimal system of debian-edu and drbl. Then run drblsrv -i (no drbl or system install images; clonezilla box mode). Save and restore with drbl-ocs -j2 -q2 startdisk save; drbl-ocs stop; drbl-ocs -j2 startdisk multicast_restore; restore with -icds if the target disk is smaller than the source disk and if the source partitions fit on the target disk. – To “plug”/”unplug” network cables of xen vm machines use brctl addif/delif for vif-interfaces (displayed by xm network-list domU_name).

Administration of windows workstations: add existing admin user with GOsa /groups to domain-admins group. On tjener use commands
net -S 10.0.2.2 rpc group …; net -S 10.0.2.2 rpc user …
to display groups and users (as described here). Use smbpasswd to set samba password for user root. Samba user Administrator can be enabled with
smbpasswd -e Administrator.

Update to debian jessie and ipfire 2.19-110

Tjener: update as described on skolelinux.org. Workstation: new install from usb with debian-edu1 image as “workstation” (guided harddisk setup, whole disk, maybe use console to mkfs.ext4 because automatic formatting might error out when previous filesystem exists, bootloader to /dev/sda); manually instal: apt-get install myspell-de-ch); after cloning with drbl: adjust hostname using mcedit /etc/hostname. (step by step: drbl-ocs -j2 -sc0 –clients-to-wait 5 startdisk multicast_res; ssh 10.1.0.[1 or 2 … 6]; then on client mount /dev/sda1 /mnt; mcedit /mnt/etc/hostname; poweroff) – Updated ipfire: static route on ipfire to 192.168.x.0 subnets does not work; instead use nat on tjener:
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.0.0/24
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.1.0/24
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.2.0/24

 

 

The raspberry pi (rpi) is perfect to drive home built hardware. The lego mindstorms ev3 set with its LabVIEW based software is perfect to create simple controlling programs. And this software allows to send and receive messages by bluetooth. This lead to the idea to attach a bluetooth dongle to the raspberry pi and to add some software to receive and send ev3 bluetooth messages.

Reference 1 is the LEGO® MINDSTORMS® EV3 Communication Developer Kit mentioned in this blog post (download second (smaller) file). Reference 2 is a C# project for bluetooth communication from windows pc to ev3 brick. Reference 3 is a python script to receive ev3 bluetooth messages on the raspberry pi. Reference 4 is a blog post giving a summary of the format of the ev3 bluetooth messages (which is also found in pdf of reference 1 on page 21; comment in capitals is result from sniffing; official documentation is not correct here):
bb bb mm mm tt ss ll aa aa … LL LL pp pp … with

bb bb = bytes in the message (excluding the two size bytes), little endian (2 bytes long)
mm mm = message counter
tt = 0×81 (type of message: reply not required)
ss = 0x9E (system command: write to mailbox)
ll = mailbox name length INCLUDING the \0 terminator
aa aa … = mailbox name, should be terminated with a \0
LL LL = payload length INCLUDING the , little endian
pp pp … = payload: either logical: 1 byte; or number: 4 byte, single precision float; or text: should be terminated with the \0

This tutorial shows how to manually pair bluetooth devices using the linux command line (some additional details can be found here). On the ev3 brick side the labVIEW based software has ‘bricks’ to switch bluetooth on or off and to create or delete a bluetooth connection to a named device; create and delete should not be used! See below. (If your pi has hostname mypi then it’s default bluetooth name is mypi-0). To pair use first the menu on the ev3 brick: Turn bluetooth on; (no need to turn the iPhone/iPad variant of bluetooth on); set bluetooth to visible. Then run on the raspberry pi:

bluetooth-agent 1234 &; hcitool scan; rfcomm connect hci0 aa:bb:cc:dd:ee:ff (using address displayed by hcitool scan).

The rfcomm connect command should trigger a pairing key popup on the ev3 brick display, where the number given to bluetooth-agent has to be entered. (Key 1234 should be used because time to enter the key is limited and 1234 is the default key in the ev3 brick menu.) After successful pairing visibility can be switched off again.

On the rpi /var/lib/bluetooth/…./ contains the settings for the bluetooth dongle. File config defines the bluetooth device name.

For a simple test run the program shown below on the ev3 brick and use receive.py on rpi.
(hostname of my rpi is rpico; so bluetooth-name is rpico-0; Hello … is the message and EV3Test is the ‘mailbox name’). First activate bluetooth on ev3. Then (re)start bluetooth on rpi (/etc/init.d/bluetooth restart). Now run:

receive.py  -a aa:bb:cc:dd:ee:ff test1.bin (receive.py can be edited to set the bluetooth address of the ev3 brick as default)

 Then start the program on the ev3 brick.

This writes the message to test1.bin; (use mc to view the file):

To send the message test1.bin back to the ev3 brick: first run the program shown below; on rpi then run send.py:

send.py  -a aa:bb:cc:dd:ee:ff test1.bin (send.py can be edited to set the bluetooth address of the ev3 brick as default)

This displays Hello world! on the screen of the ev3 brick.

Important: Bluetooth only works if connections are always initiated from rpi and never from ev3 (brick or software: do not use the bluetooth ‘software brick’ of the ev3 software to connect or disconnect!) This is the result of current testing (firmware 1.03H or unofficial firmware 1.04H with support for edimax ew-7811un wifi dongle). – Initiating the connection from ev3 brick seems to change something in the bluetooth configuration of the ev3 brick which causes errors. A  possibility to get rid of these errors is to delete the directories /var/lib/bluetooth/AA:BB:CC:DD:EE:FF on both devices. (Either needs shell access to ev3 brick; possible with wifi adapter and telnet: user root with empty password. Or use the ev3 software on your  computer, open the memory browser of ev3 brick and download reset_bluetooth.rbf (source: reset_bluetooth.lms)  to ev3 brick and use the ev3 brick menu to run reset_bluetooth.rbf) Then reboot the ev3 brick, restart bluetooth on rpi and do again the pairing process described above. Afterwards reboot the ev3 brick again.

Instead of sending messages to the ev3 brick it is possible to use send.py to send commands (as described in reference 1 mentioned above).

send.py led9.bin; sleep 20; send.py led0.bin (the ledN.bin files, N=0,1,2…9, can be found here)

As documented here the LED on the ev3 brick is controlled by a byte pattern. For instance the file led9.bin containing the hex values
08 00 00 00 80 00 00 82 1B 09
makes the LED pulse orange and led0.bin (with 0 instead of 9 as last byte) switches the LED off; (byte code reference 1: search for LED 2 : search for opUI_WRITE, 3: page 96 of firmware development pdf).

It is even possible to transfer command sequences of byte codes with send.py. First the program has to be written in “ev3 byte code assembler language” (helloworld.lms). This has to be compiled (helloworld.rbf). Second the trailing 0x0A byte has to be removed and the header (28 bytes) has to be replaced (nn NN 00 00 80 00 00; nn = lower byte and NN = higher byte of  L-2; L = size of file): helloworld.bin. A good reference for the first step is here. All files required to create the example program hello world are here (sources 1, 2, byte codes.h). The second program in this archive which allows to run a linux program from sd card has its origin here. Examples for the second step are on pages 26-31 of the LEGO® MINDSTORMS® EV3 Communication Developer Kit (mentioned in this blog post;download second (smaller) file)

Raspbian (current version, 2014-03) on raspberry pi comes preinstalled with oracle jdk. Using a lightweight replacement for Eclipse
java programs for lego mindstorm ev3 with lejos firmware can  be developed on the raspberry pi.

This tutorial was used to get started. More about IDE Geany can be found on www.geany.org.

apt-get install geany

apt-get install ant

apt-get install libjsch-java

cd /usr/share/ant

ln -s /usr/share/java/jsch-0.1.42.jar jsch.jar

 

assuming ev3 classes are installed with eclipse as described in lejos.org wiki:

On raspberry pi create a subdirectory ev3 in your geany projects folder (e.g. /home/pi/Projekte/ev3 in german localized version of geany)

cd into this directory and use scp to copy DBusJava and ev3classes from eclipse ev3 folder on your computer with eclipse:

scp -r your_ip_address:/your_eclipse_ev3/folder/DBusJava .
scp -r your_ip_address:/your_eclipse_ev3/folder/ev3classes .

Open geany and create a new project ev3. Open the file ev3/DBusJava/build.xml. Then open the Terminal tab at the bottom of the geany window.
Use cd to change into your projects folder; then cd into ev3/DBusJava
Run ant jar
If the command did complete successfully use cd to change into ev3classes directory and open the file ev3/ev3classes/build.xml from geany menu.
Run ant jar
Use scp to copy some example project from eclipse to geany. Create a new geany project with the same name.
Use command ant jar in geany Terminal to compile the project. Finally use ant copy to transfer the jar archive to raspberry pi.

Result on iPad with bluetooth keyboard (using the steps described here):

Mathematica comes preinstalled on raspbian and is free for personal use. Adding a vnc or rdp server to a raspberry pi running raspbian allows to display and control Mathematica with an iPad. If the raspberry pi is configured as wlan access point you get a free and rather mobile installation of Mathematica.

Required hardware: raspberry pi model B, 16 GB sd(hc) card (at least 4 GB), ew-7811un wireless usb adapter; device running a vnc or rdp  viewer (e.g. iPad with RD Client app).

  1. Installation of raspbian to sd card:
    download raspbian image http://downloads.raspberrypi.org/raspbian_latest
    unzip the file
    copy it to the sd card (linux: dd if=your_file of=/dev/sdX bs=1M; sdX is the device name of the sd card)
  2. Configuration of raspbian on raspberry pi:
    for the first run plug monitor, keyboard, lan and usb current source into raspberry pi;
    raspi-config gets started automatically on first boot
    resize raspbian partition to full size of sd card (using the menu of raspi-config)
    set hostname, keyboard, language, timezone, password; enable ssh server; boot into console
    login as user pi and become root with sudo su. Run apt-get update and then apt-get upgrade
  3. Add software to raspbian (as root user)
    apt-get install mc (I cannot live without)
    apt-get install xrdp
    apt-get install tightvnc-server
    apt-get install hostapd dnsmasq
  4.  The xrdp server works with the default configuration. Alternatively use tightvnc-server as described here:
    with  VNC_USER=”pi”, HOME=”/home/pi”,FOO_ID=1
    and set as user pi a password for vnc with vncpasswd;
    after reboot the vnc server will listen on port 5901
  5. Configure the wlan router function as described here, but make the following changes:
    the program /usr/bin/hostapd installed by raspian has to be replaced by  a self compiled version (mine is here – having used these instructions); (or you might use this file mentioned in this note)
    add dns server 8.8.8.8 to /etc/dnsmasq.conf: dhcp-option=6,8.8.8.8
    (ios clients seem to be picky about non standard network masks. So configure wlan0 with 255.0.0.0 and adapt dnsmasq.conf.
    dhcp-range=interface:wlan0,10.0.0.2,10.0.0.20,10.254.254.20,255.0.0.0,infinite)
    add modules to /etc/modules (one per line):
    nf-conntrack-ipv4 iptable-nat ipt-MASQUERADE (optional iptable-filter )
    do not create the file /etc/network/ifup.d/router.sh, but add the 2 lines of this file to /etc/rc.local
    ifup wlan0
    iptables –table nat -A POSTROUTING –out-interface eth0 -j MASQUERADE
    #optional: iptables -A FORWARD –in-interface wlan0 -j ACCEPT
    #optional: iptables -I INPUT -i wlan0 -p udp –dport 67:68 –sport 67:68 -j ACCEPT
    (and make sure that the newly added lines are above the line “exit 0”)
    Remark: long iptables options have — which tends to get displayed as unicode long hyphen; (has to be replaced manually when using copy and paste):
    To test hostapd and/or dnsmasq run it on the console: hostapd /etc/hostapd/hostapd.conf
    and/or dnsmasq -u dnsmasq –conf-file=/etc/dnsmasq.conf -d
  6. Plug the mini wlan adapter ew-7811un into the raspberry pi and reboot
    try to join wlan Himmbeerhacks and try to connect with rdp to 10.0.0.1 or open 10.0.0.1:5901 with a vnc viewer (like  RD Client or Remoter VNC on iPad).

Further trial and error shows that with a bluetooth keyboard rdp works better than vnc. Especially square brackets (alt+5, alt+6) do not work well with vnc – at least in my setup with locale swiss german. That is why I started to use xrdp and the free microsoft remote desktop client for iOS.

Installation notes:

DebianEdu wheezy uses 10.0.0.0/8 with gateway 10.0.0.1
(e.g. spblinux with ifconfig eth1 10.0.0.1; cfg_nat start;
in vbox eth0 bridged, eth1 internal connected to tjener)

Installation of ltsp-server:

  • only non automatic partitioning (using guided partitioning) works (21.8.13)

phpldapadmin (https://10.0.2.2/phpldapadmin/)

  • apt-get install phpldapadmin
  • changes in /etc/phpldapadmin/config.php
    Uses tls which starts with default port 389 (not ssl, 636, ldaps):
    – $servers->setValue(‘server’,’host’,’ldap‘)
    //$servers->SetValue(‘server’,’port’,’636′)
    Login with ou=ldap-access (with password of unix system user root)
    – $servers->setValue(‘login’,’bind_id’,’cn=admin,ou=ldap-access,dc=skole,dc=skolelinux,dc=no’)

Add ltspserver in gosa (https://10.0.2.2/gosa/
(login as user which has been created during installation of tjener)

  • Systems: Action Add
    Generic:
    – Server name: ltspserver00
    – Mode activated
    – Base /
    – IP-address 10.0.2.10
    – MAC_address: 12:34:ab…
    (might be looked up by first booting ltspserver:
    and dhcp gives name auto-mac-12-34-ab…)
    – Enable DHCP true and parent node (tjener) dhcp
    – Enable DNS true and Zone TJENER/intern
    Apply.
    Services:
    – add Terminal service
    Apply and start the service.
    NIS Netgroup:
    Add group ltsp-server-hosts
    – seems to get set in ldap directory, but does not display in gosa
    (netgroup/ltsp-server-hosts/nisNetgroupTriple)
    netgroup gets used as nfs4 authentication.

Nagios (https://10.0.2.2/nagios3/):

  • Add ltspserver00 to nagios by running sitesummery-update-nagios
  • Set password for user nagiosadmin with
    htpasswd /etc/nagios3/htpasswd.users nagiosadmin
    (and apache2ctl graceful)

Thin clients:

  • when used with vbox: needs vbox extension pack

 

JavaFX: java-jdk + SceneBuilder + eclipse + e(fx)clipse

  • download current java 7 jdk from oracle
    (java.com / Developers / JDK download / 64 bit)
  • unpack into /usr/lib/jvm and
    ln -s jdk1.7.0_xx java-7-oracle-amd64
  • update-alternatives –install /usr/bin/java java /usr/lib/jvm/java-7-oracle-amd64/bin/java 1
  • update-alternatives –install /usr/bin/javac javac /usr/lib/jvm/java-7-oracle-amd64/bin/javac 1
  •  update-alternatives –config java (select java-7-oracle-amd64)
  • update-alternatives –config javac (select java-7-oracle-amd64)
  • download Scenebuilder (64 bit) from java.com
    (currently http://www.oracle.com/technetwork/java/javafx/downloads/devpreview-1429449.html)
    and unpack it into /opt
  • download eclipse (64bit, standard edition, tar archive) from eclipse.org
    und unpack it into /usr/lib
  • run (alt+F2) kdesu /usr/lib/eclipse/eclipse
    – Help / Install new software / Add
    Name: e(fx)clipse
    Location: http://download.eclipse.org/efxclipse/updates-nightly/site
    – select e(fx)clipse Kepler

A generic rescue system should boot in bios mode and in (u)efi mode. It should boot from usb and it should use the same boot menu config file for bios and for efi boot mode. Grub2 has a nice boot menu and supports bios and efi boot mode.

Because the installation scripts of grub2 might have side effects and might affect installed systems, only grub images (=files) are created.
(Installation for efi boot, if secure boot is disabled: copy grub core image to EFI/BOOT; bios boot: chainload from syslinux + ldbsd.com.)

Steps to create such an usb stick using linux (e.g. ubuntu or opensuse): bios boot and efi boot with disabled secure boot
(it is possible to use clonezilla stable (=debian version): choose run shell; sudo su; ifconfig eth0 YOURIP netmask YOURMASK; route add default gw YOURGATEWAYIP; use mc to edit /etc/resolv.conf: nameserver 8.8.8.8; apt-get update; apt-get install grub-efi; use wget to fetch other files)

  • backup existing data because the usb stick will be repartitioned (erasing existing data)
  • run linux and use gdisk to create a gpt partition table with one fat32 partition
    (which will be marked bootable for bios boot). Run gdisk as root user:
    gdisk /dev/sdX (X=your usb stick; ensure that you use the intended usb stick – and not an existing hard disk)
    – p (prints existing partition table)
    – o (creates a new empty partition table)
    – n (create partition: use default start and end sectors, set type to 0700)
    – x (switch to expert menu)
    – a (add flags:  use 2 = “legacy BIOS bootable”)
    – w (writes the new partition table to the usb stick)
  •  format the new partition with fat32 (and set partition label name to SPB2; this label will be used by grub2 to identify the partition)
    mkfs.msdos -n SPB2 /dev/sdX1 (X=your usb stick)
  • mount the new partition and create some directories:
    – mkdir mnt
    – mount /dev/sdX1 mnt (X=your usb stick)
    – mkdir -p mnt/EFI/BOOT
    – mkdir -p mnt/grub/fonts
    – mkdir syslinux
    – mkdir mnt/grub/i386-pc (optionally for additional grub2 modules, bios mode)
    – mkdir mnt/grub/x86_64-efi (optionally for additional grub2 modules, efi mode)
  • install syslinux (has to be version <5.0, binaries here: syslinux.zip) to the new partition /dev/sdX1 and copy the sylinux boot loader gptmbr.bin to /dev/sdX
    – umount /dev/sdX1 (X=your usb stick)
    – syslinux -d syslinux /dev/sdX1 (X=your usb stick)
    –  dd if=/usr/lib/syslinux/gptmbr.bin of=/dev/sdX
    or
    dd if=/usr/share/syslinux/gptmbr.bin of=/dev/sdX
    – mount /dev/sdX1 mnt
  • contents of configuration file for grub core image in bios boot mode embed.cfg:
    search.fs_label SPB2 root
    set prefix=($root)/grub
    configfile $prefix/grub.cfg
  • the  configuration file for grub core image in efi boot mode embed_efi.cfg currently has the same contents as embed.cfg.
  • both configuration files, embed.cfg and embed_efi.cfg are stored in mnt/grub/
  • install grub2 (needs installed grub2 packets for i386-pc and for x86_64-efi;
    e.g. apt-get install grub-pc and apt-get install grub-efi-amd64; older debian based linux calls grub2 grub and grub-1.x grub-legacy).
    This step creates only grub image files (given by “-o”).
    – cp /usr/share/grub/unicode2.pf2 mnt/grub/fonts/
    or
    cp /usr/share/grub2/unicode.pf2 mnt/grub/fonts
    –  grub-mkimage -O i386-pc -p /grub -c mnt/grub/embed.cfg -o mnt/grub/core.img configfile fat part_gpt part_msdos biosdisk cat echo test search search_label search_fs_uuid boot chain linux reboot halt normal vbe font gfxterm
    or
    grub2-mkimage ….
    –  grub-mkimage -O x86_64-efi -p /grub -c mnt/grub/embed_efi.cfg -o mnt/EFI/BOOT/bootx64.efi configfile fat part_gpt part_msdos cat echo test search search_label search_fs_uuid boot chain linux reboot halt normal efi_gop efi_uga font gfxterm
    or
    grub2-mkimage ….
  • in bios boot mode syslinux is used to chainload core.img of grub2 (with an intermediate ldbsd.com from grml project which does only work with syslinux versions <5.0)
    – contents of syslinux.cfg (to be copied to mnt/syslinux/syslinux.cfg):
    default grub2
    timeout 1
    totaltimeout 3
    label grub2
    say using bsd4grml/ldbsd.com as loader
    kernel ldbsd.com
    append echo Loading GRUB2…`machine exec grub /grub/core.img
    – unpack ldbsd.com.zip and copy ldbsd.com to mnt/syslinux/ldbsd.com
  • finally we need grub.cfg (to be stored in mnt/grub/):
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    set default=0
    loadfont ($root)/grub/fonts/unicode.pf2
    if [ x$grub_platform = xefi ]; then
    set gfxmode=auto
    set gfxpayload=keep
    set boottype=efi
    else
    set gfxmode=800x600x16
    set gfxpayload=keep
    set boottype=bios
    fi
    terminal_output gfxterm
    menuentry “linux on sdb1 ($boottype; partition SPB2 on($root); $gfxmode)” {
    linux ($root)/vmlinuz root=/dev/sb1 …
    initrd ($root)/initrd
    }
  • the example assumes that linux kernel and ramdisk are copied to mnt/
    (that is, to the root directory of the usb stick)
  • both boot modes can be tested with virtualbox (>=4.2.12); system settings allow to switch to efi boot mode.
    Give access to usb device with
    VBoxManage internalcommands createrawvmdk -rawdisk /dev/sdX -filename raw_usb_sdX.vmdk

If the same virtual machines should be used on a multi boot system there are at least 3 choices:

  • A fat32 partition with virtual disk files. But disk size is limited to 4GB.
  • An iSCSI disk connected by network. Speed is limited by network throughput.
  • Direct access to hard disk partitions used as virtual disks. With windows a separate hard disk has to be used.

The third choice is described below. Thus a second hard disk only used with virtual machines is required. To allow hard disks with more than 2 TB capacity the disk is partitioned as gpt disk.

Warning: the commands described below can erase the whole data of your hard disks if a mistake is made. Do not continue unless you have a full backup of your system.

========================================

(Yes I am prepared to restore my system in case of a mistake …):

Attach an additional hard disk to your computer which is only used for virtual box images (tested with internal disk; should work with usb disk).
(At least the currently running (host) operating system must not be installed on the same disk).
Add a new partition to the additional hard disk. (If the new virtual disk has 25 GB then the size of the new partion is 25 GB.) In case of a gpt partioned disk up to 128 partitions can be created.

  • with a linux host using gdisk the type of the new partition can be set to 0x8301 (linux reserved)
    (internally translated by gdisk to 8DA63339-0007-60C0-C436-083AC8230908)

In case of windows 7 as virtual machine the hardware uuid of the vm must be the same
in the three hosts (linux, osx, windows). (Else the activation of windows 7 cannot be kept.)

  •  to display the hardware uuid of the activated vm (with name W7) use:
    VBOxManage showvminfo W7 |grep Hardware
  • to set the hardware uuid of a vm (with name W7_1) use the uuid displayed by showvminfo:
    VBoxManage modifyvm W7_1 –hardwareuuid 12345678-1234-abcd-0123-0123456789ab

 

Using this partition as virtual hard disk with a linux host:

  • determine the device name of the new partition, e.g. /dev/sdb7
    (cat /proc/partitions, gdisk -l /dev/sdb …)
  • either ad the current user to group disk to allow raw access to all disks
    (has only to be done once; is effective after re-login; but is potentially dangerous).
    Or change the group of /dev/sdb7 to vboxusers
    (to be repeated after reboot)
  • run as root user:
    VBoxManage internalcommands createrawvmdk -rawdisk /dev/sdb7 -filename my_filename.vmdk
    and change the ownership of this file to the current user
  • run VirtualBox and add my_filename.vmdk as hard disk to the virtual machine

 

Using this partition as virtual hard disk with a OS X host:

  • determine the device name of the new partition, e.g. /dev/disk1s7
    (ls -l /dev/disk* …)
  • ad the current user to group operator to allow raw access to all disks
    (is effective after re-login; is potentially dangerous):
    dseditgroup -o edit -a name_of_current_user -t user operator
  • Change permission of group from read access to write access
    sudo chmod g+w /dev/disk1s7
    (to be repeated after reboot)
  • run as root user:
    VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk1s7 -filename my_filename.vmdk
    and change the ownership of this file to the current user
  • run VirtualBox and add my_filename.vmdk as hard disk to the virtual machine
  • if OS X auto mounts partitions which should be used by virtualbox: try to deactivate them with disk utility; in case that does not work you can run disk arbitrator which blocks auto mount

Using this partition as virtual hard disk with a Windows 8 64 bit host:

  • requires to run VirtualBox with administrative privileges
  • determine the device name of the new partition, e.g. diskpart
    list disk
    select disk 1
    list partition
    select partition 7
    detail partition
  • windows blocks raw access to the hard disk if the disk is online; use diskpart to switch the disk offline:
    list disk
    select disk 1
    offline disk
  • if the disk is mbr partioned open a console window with administrative privileges and run:
    “C:\Program Files\Oracle\VirtualBox\VBoxManage internalcommands createrawvmdk -rawdisk \\.\PhysicalDrive1 -filename my_filename.vmdk -partitions 7
    if the disk is a gpt disk VBoxManage will crash (with VirtualBox 4.2.12) and you have to run this command using a linux host
    VBoxManage internalcommands createrawvmdk -rawdisk /dev/sdb -filename my_filename.vmdk -partitions 7
    (the resulting file my_filename.vmdk hast to be copied to the windows host)
  • use wordpad to edit the vmdk file, so that partition 7 is seen as a whole virtual disk:
    (once again a warning: an editing mistake might erase all data of your hard disks)
    change createType to “fullDevice”
    between the lines “# Extent description” and “# The disk Data Base”
    delete all lines except the one refering to partition 7 (e.g. RW 52428800 FLAT “\\.\PhysicalDrive1” 482756608)
    If the vmdk file has been created with linux then the linux device name (e.g. /dev/sdb) has to be replaced
    by the windows device name (e.g. \\.\PhysicalDrive1)
  • run VirtualBoxwith administrative privileges and add my_filename.vmdk as hard disk to the virtual machine

 

 

Harddisks with form factor 2,5 inch have capacities of 1 or 2 terabyte nowadays. And usb 3.0 connectors supply enough current to run these harddisks. If it is possible to boot from such a harddisk into the imaging program you get a very compact backup and recovery system. Useful for snapshots of installed operating systems (allowing bare metall recovery).

Example of such a system with WD my passport 2,5′ USB 3.0 harddisk and TrueImage home 2013:

– use trueimage media builder to create a bootable usb stick (1GB)
– use diskpart in windows to repartition the my passport harddisk (with mbr partition table): create 2 primary partitions, make the first 1000 MB big, make this partition active and (quick) format it with fat32. The second partition takes the rest of the harddisk.

– open trueimage (inside windows) backup the first partition of the usb stick which has been made bootable by media builder.

– restore this backup to the first partition of the my passport harddisk

– boot into linux (a live cd could be used), format the second partition of the my passport harddisk with ext3 filesystem and create a folder for backups on this partition.

– verify that file /usr/share/syslinux/mbr.bin exists. (Else install syslinux). Then check the device name of the my passport harddisk, e.g. sdb and run as root user
dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb
(Make sure that sdb is the my passport disk!).
In case of a gpt disk use gptmbr.bin and set the type of the second partition to 0700 (else trueimage does not save tib-files on this partition);
(additional remark: use gdisk /dev/sdb to set the legacy BIOS bootable flag on partition 1 (inside gdisk: p   x   a   1   2   <enter>   w);
this makes the gpt disk BIOS bootable, at least syslinux works as bootloader on this partition and syslinux may load trueimage …).

– now you should have a bootable harddisk with space for backups

– tested with mac mini (6.1 = ‘late 2012’). – In case of usb reset errors it might be worth to try another usb cable; the bootable version of trueimage uses linux.

installation snippets

goal: efi-bootable installation of OS X, Windows 8, Linux (opensuse 12.3)

backup harddisk:

  • unused 16 GB usb stick
  • use os x disk utility to create a guid partition table with two partitions (first with 1 GB size, formatted mac os extended journaled)
  • download os x recovery tool from apple here
  • run the recovery tool (in os x) and format the usb stick
  • use os x disk utility to create a second partition on the usb stick
  • use this second partition as time machine backup and let time machine create a full backup (might take some hours with usb 2 sticks);
    – needs about 12 GB to backup the preinstalled os x of mac mini;
    – change energy settings in system settings that this backup does not get interrupted by automatic sleep mode.
  • make sure that the usb stick is bootable:
    boot with pressed option/alt-key

reformat hard disk as gpt disk without (protective) mbr

  • warning: a backup is required because all data on the disk will be erased
  • in order to get as second os windows with efi boot the disk is formated with windows diskpart (following this helpful tutorial)
  • boot with some windows 8 install media (windows 7 or vista should work as well)
    – press shift+F10 to get a console window
    (it might be neccessary to enter repair options screen first)
    – run diskpart with

    • list disk
    • select disk 0
    • clean
    • convert gpt
      in case convert gpt fails with error write protected
      and attr dis shows read-only yes, then run
      attr dis clear readonly
      now convert gpt should work
    • create partition efi size=256
    • format fs=fat32 quick label=EFI
    • create partition primary size=51200 [size of your OS X partition in MB; Ex. 50GB = 51200]
    • list partition
    • create partition msr size=128
    • create partition primary size=30720 (desired size of your Windows partition; Ex. 30GB = 30720)
    • format fs=ntfs quick label=Windows
    • exit

    – reboot

restore os x

  • boot with pressed option/alt-key, select the usb stick with osx recovery tool
    – restore os x using the time machine backup
  • reboot into os x
    – run boot camp to download windows drivers
    (store the drivers in your os x home folder)
    – do not use boot camp to prepare your hard disk!
    – install rEFIt 0.14 boot loader from sourceforge
    -the configuration file of rEFIt allows to set os x as default os
    (/efi/refit/refit.conf on the os x system partition
    default_selection M)

prepare efi-bootable windows 8 install medium

  • warning: in bios-mode the installer does not accept the disk and windows partition created with diskpart
    (only windows 8 64 bit properly prepared install media support (u)efi-mode )
  • steps to create a efi-bootable usb stick from only bios-bootable dvd (as described here)
    – unused 4 GB usb stick
    – run diskpart (from windows vista/7/8 or from a windows 7/8 installer)
    – run diskpart with

    • list disk
    • select disk X (make sure X corresponds to the 4 GB usb stick!)
    • clean
    • create partition primary
    • select partition 1
    • active
    • format fs=fat32 quick
    • assign
    • exit

    – copy files from existing bios-bootable windows 8 64 bit install medium to the new usb stick

    • xcopy E:\*.* /s/e/f F:\

    – this assumes the existing install medium has drive letter E: and the new medium has drive letter F:
    – reboot into os x and copy the folder with bootcamp drivers to the new usb stick

install windows 8

  • boot with the efi bootable windows 8 pro 64 bit install medium
  • select the windows partition created before
    (if the installer displays that this partion is not formatted then efi-boot failed; you have to retry to boot into efi-mode)
  • after installation of windows 8 install bootcamp drivers (enables networking)
  • to get rEFIt boot manager back
    – either boot with pressed option/alt-key into osx and use system settings to select start volume “os x”
    – or use the windows 8 bootcamp system tray applet to select the start volume “os x”

opensuse 12.3 installation

  • burn an OpenSuse 12.3 64 bit install dvd (full installer, not only network installer)
  • efi-boot with this dvd (using grubx64.efi)
  • select user defined install
  • add linux partitions to the hard disk
    – an additional fat32 data partition which has rw access by os x, windows and linux might be useful
    – the partioning summary should show that /dev/sda1 is used as boot device
  • in boot manager settings select “test for other systems”, use grub2-efi and ignore the error message
  • install linux
    – should be successful except network
  • to get rEFIt boot manager back boot into windows and use bootcamp system try applet
    (windows should be displayed in the grub2 boot menu; eles use pressed option/alt key during boot)
opensuse 12.3 enable wired network
  • the tg3 network module has to be recompiled with additional pci id lines
    (the same issue is in Desinfec’t 2013 published by german c’t magazine: patched ubuntu tg3.ko: tg3_desinfect2013)
  • boot into linux and use yast to install from dvd build tools and linux kernel source and linux headers:
    – the rightmost tab in yast software install tool (“Schemata” in german version) allows to select
    – basic development tools
    – c/c++ development
    – linux kernel development
  • the file tg3.c has to be patched as decribed here
    (lspci -nn gives [14e4:1686] which corresponds in tg3.h to TG3PCI_DEVICE_TIGON3_57766
    but the device id TG3PCI_DEVICE_TIGON3_57766 is missing in tg3.c)
    – copy /usr/src/linux/drivers/net/ethernet/broadcom/tg3.c to tg3.c.orig and add the lines marked with +
    (without writing the ‘+’ sign)

    {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57762)},
    + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57766)},
    + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57782)},
    + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57786)},
    - then recompile tg3.ko; run inside a konsole window:
    cd /usr/src/linux
    make clean
    make oldconfig
    cp /usr/src/linux-obj/x86_64/desktop/Module.symvers /usr/src/linux/
    (or cp /boot/symvers-3.xyz.gz /usr/src/linux; cd /usr/src/linux; gunzip symvers-3.xyz.gz;
    ln -s symvers-3.xyz Module.symvers)
    make scripts
    make prepare
    cd drivers/net/ethernet/broadcom/
    make -C /usr/src/linux SUBDIRS=$PWD modules
    su
    cp tg3.ko /lib/modules/3.7.10-1.1-desktop/kernel/drivers/net/ethernet/broadcom/
  • finally re-insert tg3 kernel module:
    - rmmod tg3
    - insmod tg3
  • use command dmesg and ifconfig -a to verify that network interface eth0 is now available
  • use yast to setup wired network eth0

opensuse 12.3 enable wireless network

  •  kernel module b43 needs firmware files which should be downloaded by
    sudo /usr/sbin/install_bcm43xx_firmware
    (as diplayed by:
    rmmod b43
    modprobe b43
    dmesg
    )
  • currently (2013-03) install_bcm43xx_firmware does not install all required files
    (ucode29_mimo.fw is missing)
  • download these firmware files (which claim to be part of netgear wndr4500 gpl source package)
  • open this archive and extract linux/wl_apsta.o to /lib/firmware/broadcom-wl-firmwares/
  • open a konsole window with root rights and run
    cd /lib/firmware/broadcom-wl-firmwares
    b43-fwcutter -w /lib/firmware/ wl_apsta.o
  • now run:
    rmmod b43
    modprobe b43
    dmesg
    This should display Broadcom 4331 WLAN found
  • then use yast or network manager to configure wireless network
bluetooth not working: lsusb ID 05ac:828a Apple, Inc. probably solved like done for
ID 05ac:8286 Apple, Inc. (Macbook Pro): see https://lkml.org/lkml/2012/7/9/473

+++ b/drivers/bluetooth/btusb.c
@@ -84,6 +84,9 @@ static struct usb_device_id btusb_table[] = {
+ /* Apple MacBookPro10,1 */
+ { USB_DEVICE(0x05ac, 0x8286) },
+