Sunday, March 3, 2013

Ubuntu Linux (Picuntu RC3) on Measy U2C (RK3066) with WiFi dongle

In this blog-post I'll explain how to install Picuntu 0.9 RC2.2, upgrade to RC3 without Internet connection, and then, using a very common WiFi USB stick connect it to the Internet, bypassing the internal WiFi chip.

In my case I will be using a TP-Link TL-WN422G USB WiFi stick, which contains an Atheros 9000 class (ath9k) WiFi chipset, supported by Picuntu 0.9 RC3.


As you may already know, the Measy U2C TV stick comes with chips Mediatek MT5931 (WiFi) and Mediatek MT6622 (Bluetooth) which are not currently (March 2013) supported in Linux.

For more up to date WiFi+BT compatibility information see Miniand's website:
Please note that, from the featureset, the Measy U2C stick seems to be a clone of Kimdecent's B12 (even the U2C's PCB silkscreen reads "B12_main_V1.1").

My current setup is the above MeasyU2C with:
- A phone USB power adapter (5V 1A) connected to the DC-5V Micro USB port
- A Logitech wireless keyboard+mouse with its USB dongle plugged in the USB 2.0 port
- A TP-Link TL-WN422G 802.11g WiFi USB stick into the side Micro USB port through an adapter (Micro USB to full size USB).
- An 8 GB Class 4 MicroSD card into the "TF Card slot" (helped by a small screwdriver)
- An Acer X233H FullHD monitor (with an HDMI to DVI adapter) to the HDMI connector

Now on to the installation, but first of all, a big thank you to Alok Sinha, the main developer behind Picuntu, for his great work.

1st) Rooting the Measy U2C

When your Measy U2C arrives it will contain an unrooted Android system. The first task is to unroot it by following the directions indicated in this url:

This is necessary to end up with an Android console that can reboot your Measy into Linux whenever you want (you keep both systems, since the Linux kernel is flashed into the recovery partition).

The rooting process requires two tools: Moborobo will get the right drivers for WinXP to talk to the RK3066 stick, and only then, the TPShark tool will be the one unrooting the stick.

It took me some time to get Moborobo to install the right drivers on my Windows XP 32 bits, so much that I can't really tell what I did besides rebooting, plugging/unplugging lots of times to get it done. I was unable to get Moborobo to install drivers correctly on a clean WinXP VM on VirtualBox.
However I must admit I heavily dislike the Moborobo tool, to me it feels like screaming "malware", so I am very cautious dealing with it.

Once Moborobo gets the right drivers installed, the TPSharky unrooting utility will be able to work (or else it'll complain that device is not detected or it's offline) and effortlessly unroot it (after three reboots).

After this, get into Android and install in the stick the utilities: SuperRoot, Busybox, and Android terminal. These will be needed to order the Android stick to reboot into Linux (that's the way it is).

2nd) Installing Picuntu Linux

This part can't be better explained than it already is in the comprehensive Miniand's website:

It's great to see a distributor taking so much care for the products it sells, by supporting customers with all this information.

When running the "prepicuntu" script (as root, to access/format the SD), from my Linux PC (in order to copy Picuntu in my 8GB MicroSD card that will go into the Measy U2C) I selected iMito MX1 as my stick (current options are UG802, MK808, MX1, and generic).

UPDATE: Install is fine when selecting "Generic" also, but even if you select USB dongle for Wifi, you'll still have to change the "interfaces" file as indicated in a step below, since the Wifi stick gets named "wlan1" anyways.

VERY IMPORTANT if by the time you are reading this the Miniand's website instructions still refer to Picuntu 0.9 RC 2.2:
Since we need the Picuntu RC3 kernel+modules to be able to use our WiFi USB stick:
- When reaching "Part 3-Flashing the PicUntu kernel as the Android recovery image" page, you MUST NOT follow this instructions
- Instead turn to "Appendix C--Using PicuntuRC3KernelInstaller to Flash your Desired RC3 kernel" and follow those instructions, to flash the RC3 recovery kernel.
Then, follow on to "Optional-Upgrading your PicUntu installation to RC3" with the modifications described next.

Since we don't have Internet in the stick yet, we can not download the required kernel modules + firmware from inside it. Hence, it has to be done from the PC with these steps:

1) Insert the Picuntu MicroSD card prepared on "Part 2-..." into your Linux PC

2) Open a terminal and type

3) Followed by:
sudo tar -xzfv modules-3.0.8-alok-RC3.tgz -C /mnt/linuxroot/lib/modules
Root is necessary or it won't allow modifiying the SD contents. Changing "/mnt/linuxroot" with the appropriate dir where the MicroSD was mounted (could be /media/user/linuxroot for Ubuntu PCs, where "user" is your username).

4) Then, as indicated in the previous Miniand's website, correct the folder name:
sudo mv /mnt/linuxroot/lib/modules/modules /mnt/linuxroot/lib/modules/3.0.8-alok+
  (Same as before: modify the linuxroot base dir to your case)

5) NEW STEP: Since a firmware file is needed for my USB Wifi stick (htc_9271.fw for mine, check out yours) to communicate with Linux, we'll copy it now. Supposing your Linux PC already has it (or else it's easy to find & download):
sudo cp /lib/firmware/htc_9271.fw /mnt/linuxroot/lib/firmware
   (Same as before: modify the linuxroot base dir to your case)

6) NEW STEP: Now you must modify the "/mnt/linuxroot/etc/network/interfaces" file in the MicroSD in order for Picuntu to use the USB WiFi stick with your Internet router, you can type:
gksu gedit /mnt/linuxroot/etc/network/interfaces
   (Same as before: modify the linuxroot base dir to your case)

And then rename every reference to wlan0 to wlan1 (the name Picuntu gives to my Wifi USB dongle at boot time, you can check yours with ifconfig if it doesn't work for you), and set your SSID + password. As an example here is my [mangled] interfaces file:
auto lo
iface lo inet loopback
auto wlan1
iface wlan1 inet dhcp
wpa-ssid MyWLANname
wpa-psk "MyWLANpassword"
Please note ssid does not have quotes, whereas the psk text password does need them.

7) Enter the "sync" command twice to write all changes, safely extract the MicroSD from the PC, and insert it into the Measy U2C stick (all terminal commands from now on are on the stick, not on the PC).

8) Boot into Android, get into the terminal, type "su" followed by "reboot recovery" (as indicated in previous Miniand's link as step 7).

9) Now the screen should show a typical Linux boot sequence and after a minute or so you'll be prompted to login (do so as root, with default password being 12qwaszx )

10) Type "depmod -a" and after it hit Ctrl-Alt-Supr to reboot, get into Android, do the Terminal+su+reboot recovery and be back into Linux

11) I have made a little init script with the following contents:

#load spanish keyboard
loadkeys es
#make sure console fits screen (or else missing bottom lines)
fbset -move up
#set to 0 or else every 120secs task kinteractiveup shows block debug warning
echo 0 > /proc/sys/kernel/hung_task_timeout_secs
#remove large module, since this Wifi chipset is not present!
modprobe -r 8188eu

    In my case I need the "fbset" line because for some reason the Linux prompt looks the usual 80x24 size, but I am missing the bottom lines once I get past the last line shown in screen. Using fbset the terminal gets the right resolution. If you want to see this issue, type (w/o quotes):  "find /." and see if you are missing the cursor when it finishes listing.

UPDATE: The "fbset" thing was due to the monitor displaying a resolution of 720p (look in the OSD), even though the monitor is capable of HDTV 1080p60 video timings, the kernel is also 1080p, and the system res is also 1080p... However, since 720p also happens when booting into Android, I'll blame it on the stick's HDMI I/F chip.

12) Try a ping to see if the WiFi dongle is connected:
If there is response, you are good to go, or else try "ifconfig" to see if the WiFi USB is detected and maybe check the Linux logs and the interfaces file to see if the correct Wifi and settings are there.

3rd) Getting a GUI into the stick

Now for this you should run as root, from the Picuntu Linux prompt, the script:

This will guide you through the configuration, download & installation of the necessary packages, which may take very long (hours) depending on the Class (speed) of your MicroSD card.

In my case the GUI of choice is the very fast and lightweight XFCE. After install finishes, I can get into XFCE by typing: startxfce4

The GUI feels snappy and it's quite cool to have such a minimal computer with a real OS!! (Android who?).

UPDATE: Just arrived a Samsung 32GB MicroSD card Class 10 (UHS-1), system is much faster!

UPDATE: If you run into problems (CRASHES) when installing apps or trying to change settings in XFCE, you may be running into the same DBUS bug I did, click here for my post on how to fix it.

I hope this quick write-up helps other people get through these steps, since it's great to be able to run Linux (and a graphical one!). If you run into any problems or would like to remark something I may have missed, please don't hesitate to leave a constructive comment below.   :-)


  1. Hi Galland,
    I am trying to flash the recovery image of the Measy U2C but even if I was able to connect to the device via ADB as root and to restart it with the command ADB reboot-bootloader, I cannot use fastboot.
    My device is seen as PCI 2207:300A when turning into boot-loader mode.
    I've tried also to use the tool RKAndroidTool 1.35 but even if the driver is properly installed (RK30 Device), the device is not detected by the tool.
    If I try to connect to a WIndows PC as mass storage, I cannot press the button Flash Mode of the RKAndroidTool because the device is unmounting the SDcard and an error message says "The device has no drive".

    Please help.
    Looking forward


  2. Hi Galland, I found another post from you suggesting to press the RESET button in the small hole.
    I did it and the tool RKAndroidTool could find the device as Loader.
    I will proceed with Picuntu installation as recommended.
    Keep in touch


  3. Hi Galland,

    As Picuntu 4.5, Mediatek MT5931 (WiFi) and Mediatek MT6622 (Bluetooth) drivers are released, can you post a tutorial on how to get these drivers to work on Measy U2C please? Thank you very much.

    1. Hi, I don't do much with the U2C lately, (I actually got tired of the MTK internal wifi chips, which are terrible), however it should be feasible by following the excellent work from usumfabricae in this page: