0 Comments

I am a really trouble guy and having problems and spending sleepless nights seems quite often to me. But gee, it’s 2019! and still it’s not very obvious, why sometimes it’s so hard to do things that in theory should be so easy.

You probably noticed, that I like TeamCity. Since I am going to participate in JetBrain’s latest TeamCity Plugin Contest 2019 I came up with idea of setting up virtual machine with a test instance of the CI, instead of messing up my production one to only test the plugin. I choose latest Ubuntu Server to minimize resources required. I created new Hyper-V machine Gen 2, inserted ISO into the virtual DVD drive and all collapsed.

So for future reference, not to forget and also achieve it quicker, below I present a small guide, how to initialize Ubuntu Server under Hyper-V control. Refer to my previous post, if for any reason you use HAXM or QEMU and don’t know how to enable Hyper-V.


  1. First, you need the “traditional installer”. If you choose the “live-server installer” (default one), later during the process, console tty1 will continuously fail with and exception and won’t let installation to finish.

    download-ubuntu-server


  2. Make sure that Hyper-V has defined a network switch with access to the Internet. If doesn’t have one, just create a new as shown below to avoid some warnings during the installation.

    external-network

  3. Manually create a hard-drive for the virtual machine. To do it, use the following PowerShell command:

    New-VHD -Path 'H:\Virtual Machines\Ubuntu-Server\Ubuntu-Server.vhdx' -SizeBytes 64GB -Dynamic -BlockSizeBytes 1MB

    It will more effectively use hard-disk on the host side as by default the block-size is 32MB. That means VHDX allocates space in 32MB chunks even if guest OS only wants to write 512kB at random locations. More info here.

  4. Finally – create the virtual machine itself with “ubuntu-19.04-server-amd64.iso” mounted as DVD drive.

    However are few pitfalls:
    * use at least 2 CPU cores and enough RAM
    * switch to Microsoft UEFI certificate authority (default one is only suitable for Windows UEFI installations); without that UEFI will report invalid OS
    * use previously crated VHD
    * use network switch with Internet access
    * make sure, that manually created DVD drive is first during the boot sequence and points to proper Ubuntu Server ISO file


    create-ubuntu-vm


  5. That’s all. Run the machine. Proceed with installation and have fun!

0 Comments

During installation of Android Studio we usually end-up with Android Emulator using Intel HAXM. This is still pretty good virtualization platform. Unfortunately might lead to a clash, since only one virtualization technology could be used at a time. And if you continue using Docker for Windows or any other Hyper-V based virtual machine with Linux system, something will not work (depending, what was launched first).

Fortunately Microsoft solved this problem with 1803 release for Windows 10. Since this version there is additional Windows component, called “Windows Hypervisor Platform”, that essentially allows running another virtualization environment on top of Hyper-V.

Of course to enable it, your PC has to match Hyper-V hardware requirements. It should be pretty easy (as my i7-3770 from 2013 still matches it!). Simply navigate to Control Panel, enter Programs, then Turn Windows features on or off and enable mentioned “Hyper-V” and “Windows Hypervisor Platform”. Here is also official Microsoft guide.


enable-hyper-v-hypervisor


Once you confirm and the whole Windows upgrade process completes, you are ready to go.

0 Comments

At first glance, it seemed to me to be a really easy task. Install QEMU for Windows, download latest Raspbian and run! Unfortunately after whole evening of tries I still fail to have it usable anyhow. Maybe it’s not totally not running, but still it’s pretty useless in terms of any further development of application without a device. Simply, at current state (as of 2018-02-18) of QEMU, it doesn’t support emulation of the USB controller, and since the whole network relays on it, there are huge connectivity issues (no network interface at all, so no SSH, no tools installation, no file transfers neither).

Just for reference, here is the tutorial I followed, not to be very bold, that I have discovered everything myself. I appreciate the work already done by QEMU team and others involved. I only hope they can emulate BCM2836’s USB anytime soon…

Probably since the spec of the USB controller is not publicly available, it makes the whole thing harder and that’s why the emulation not yet available. Although I found some article describing try of porting the USB driver itself into the Xinu OS running on Raspberry Pi. Maybe this could be used somehow to create the opposite.


OK. That’s a NO GO for the moment. Is there any other solution?


Well, yes, there is. After a while, it turned out that there are plenty of people (here, here or here) doing some heresy, but at the end of the day, it works. Instead of running Raspbian on emulator of the Raspberry Pi hardware, they use the ARM Versatile/PB board, which works somehow as expected. Among the best, it has network working!

This is pretty amazing, but also has some own quirks. First – a set of kernel patches must be applied to make it boot. Secondly it can handle only up to 256 MB of RAM (qemu exits with an error, when more is specified). Should be enough to start the device, but it’s quite low for some serious scenarios of audio/video processing. Thankfully Dhruv Vyas prepared required QEMU binaries in this open-sourced project (well, took over the work after xecdesign.com went down few years ago and is updating it along with all recent Raspbian releases). Great job!

So after downloading updated kernel, it’s just a matter of issuing single long command (Windows 10 shell):

"C:\Program Files\qemu\qemu-system-arm.exe" -m 256 -M versatilepb -cpu arm1176 -serial stdio -no-reboot -kernel kernel-qemu-4.14.79-stretch -dtb versatile-pb.dtb -net nic -net user -append "root=/dev/sda2 panic=1" -drive format=raw,media=disk,index=0,file=D:\Raspi\2018-11-13-raspbian-stretch-lite.img

Update paths accordingly to your installation. Then QEMU will start fine.


PS.

One final note. It would be recommended at the very beginning to enlarge the SD card image to get some extra space for new programs to be installed.

This could be done with following command:

"C:\Program Files\qemu\qemu-img.exe" resize D:\Raspi\2018-11-13-raspbian-stretch-lite.img +2G


That's all. Have fun!

0 Comments

Some time ago I have written a post about, how to setup Windows 10 to wake it up remotely via network using magic packet. The question that remained unanswered is: how to actually send this packet to the PC to trigger it running.


In the first example I will use Raspberry Pi with Rasbpian Stretch Lite installed:

1) First make sure a tool etherwake is available. If not, this could be fixed with following command, otherwise skip this step:

sudo apt-get install etherwake

2) Then simply invoke it with proper arguments:

sudo etherwake –i <ethernet-interface-name> <PC MAC-address>

Some explanations:

Yes, it will ask you for a password, each time you try to call it. Also MAC address should be specified in format “XX:XX:XX:XX:XX:XX”. That was the easier part.

The harder part is that etherwake by default tries to use eth0 as the network interface, where to send the magic packet. Raspberry has a feature called “Predictable network interface names” enabled by default (since August 2017 I think; was even in Jessie edition, but was disabled by default). With a big probability the name of the interface will be different than eth0 (something like enx?? or wlx?? depending if using LAN or WiFi and ?? should be replaced with Raspberry’s own MAC address).

To list existing network interfaces type this command:

ip link show

Then grab the proper name, which is not a loopback. Or use raspi-config (via command “sudo raspi-config”) and navigate to “2: Network Options” and disable predictable network interface names, so it should go back to using eth0 and wlan0 names.


In the second example I wish to show, how to achieve the same effect on Synology NAS station.

If your DSM is really old, you could use the optional package manager named ipkg. Though this manager make sure wakelan utility is installed. And waking up a PC is just a matter of issuing following command in the console:

export PATH=$PATH:/volume1/@optware/bin/

wakelan –m <PC MAC-address>

MAC this time is in format: “XXYYZZXXYYZZ”.


On the other hand, if you don’t want to play with custom package managers and have a decent DSM 6.x on-board, one could use the build-in synonet utility (as also described here). Then it’s just a matter of calling it this way:

sudo synonet --wake XX:XX:XX:XX:XX:XX eth0

Executable is located at: /usr/syno/sbin/synonet


And that’s all. Have fun!

0 Comments

Yet, Internet connection sharing is an easy-to-use feature on my Xiaomi Redme Note 5 phone that has wasted me whole evening to get it right. Funny thing, really, since as a user I was supposed to enter Settings, navigate to Mobile Hotspot, define password and swipe to enable it. Also from that point of view, that’s all you can do, due to lack of any other configuration options. But as it turned out, there is a subtle “bug”, that causes it not to work on any Xiaomi phone (with MIUI and without).

Short story long… Of course data connection on the phone itself was always working fine. I could browse the net, connect via VPN to work network, watch YT, listen music from Spotify etc. Several times I needed to share this LTE connection with the Windows 10 laptop to perform some immediate tasks and it always failed. No matter what hour I tried, or the part of the city I was sitting. Then I mostly gave up and turned back for few moments to my BlackBerry Passport phone, where it was always working smoothly ;)

Finally I realized it’s time to find a solution to this issue. And here it is, few hours later.

I browsed the Internet and found all those misleading guides, that lead to nothing, so simply skip them:

  1. First I thought it was due to problem with the way my APN (settings for data-connection) was defined:
    • Switched to IPv6 only
    • Reset everything to default
    • Confirmed with my mobile operator, whether default is right
    • Switched APN type to ‘default’
    • Switched MVNO type to ‘GID’
    • Switched to IPv4/IPv6
  2. Set hotspot frequency to 5 GHz
  3. Reset device, place SIM card in secondary slot
  4. That all was wrong, still I could only to connect the PC to the hotspot, but no packets were actually transmitted over the LTE. Then I thought – maybe it’s the problem with Windows itself. So I tried:
    • Forced IPv6
    • Reset network settings to default
    • Hardcoded Google DNS – 8.8.8.8
    • ipconfig /renew
    • ipconfig /flushdns
    • ssh to any external server

Continuously nothing working correct, even when all the guides I have seen were claiming, it should be fine long ago. I have even found info about Samsung and Huawei devices, where IP ranges or default DNS can be defined directly on mobile.

Then boom! What if this is Xiaomi-only related “bug”. And that’s true. It flies around since several years and xda-developers.com has even a fix, that looks like:

  1. install Android SDK
  2. enable developer mode on the device
  3. enable USB debugging and especially USB debugging extra security settings (without it further commands will throw security exception; also it might require registering at Xiaomi portal as developer)
  4. connect the device via USB
  5. in command prompt type adb shell to issue further commands on the device directly
  6. check value of tether_dun_required, that in my case was `null` as described in the original fix, with command: settings get global tether_dun_required
  7. if the value is different than ‘0’, hotspot will not work
  8. to set it type: settings put global tether_dun_required 0
  9. exit shell and reboot the device


And now it works finally!