Thursday, October 5, 2023

Running and building cross platform(ARM64, PPC64le and many more) containers on Windows Subsystem for Linux(WSL) on windows 11 by using qemu-user-static

Windows Subsystem for Linux (WSL) is a feature of Windows 11 that allows you to run Linux distributions natively on Windows. This means that you can use all of your favorite Linux tools and applications on Windows, without the need for a virtual machine.

qemu-user-static is a statically linked version of the QEMU emulator. It can be used to emulate different processor architectures and operating systems.

WSL and qemu-user-static can be used together to run and build cross platform containers. This means that you can build a container on a Linux distribution running on WSL and then run it on Windows or any other platform that supports Docker and the target architecture.

To run cross platform containers on WSL using qemu-user-static, you will need to:

  1. Install qemu-user-static on your Linux distribution running on WSL.
  2. Build a cross platform container using a multi-arch base image.
  3. Run the container using qemu-user-static.

To build a cross platform container using qemu-user-static, you will need to:

  1. Specify the target architecture using the --platform flag. For example, to build a cross platform container for amd64 and arm64 architectures, you would use the following command:
docker build --platform linux/amd64,linux/arm64 -t <image-name> .
  1. Add the following line to your Dockerfile:
RUN apt-get update && apt-get install -y qemu-user-static
  1. Build the container using the following command:
docker build -t <image-name> .

To run the container using qemu-user-static, you will need to use the following command:

qemu-user-static -machine x86_64 -kernel <container-image>

Benefits of running and building cross platform containers on WSL using qemu-user-static

There are several benefits to running and building cross platform containers on WSL using qemu-user-static:

  • Portability: Cross platform containers can be run on any platform that supports Docker and the target architecture. This makes them ideal for developing, deploying, and running applications in a variety of environments.
  • Consistency: Cross platform containers ensure that your application will run the same regardless of the platform it is running on. This can help to reduce development and testing time.
  • Efficiency: Cross platform containers can help to improve the efficiency of your development and deployment workflows. For example, you can build a cross platform container on your development machine and then deploy it to production without having to rebuild it for the production environment.

Conclusion

Running and building cross platform containers on WSL using qemu-user-static is a great way to develop and deploy applications in a variety of environments. It is a powerful and flexible solution that can help to improve the efficiency of your development and deployment workflows.

Additional notes

Thursday, September 26, 2019

Amazon prime video not working on Ubuntu linux with chrome-beta or chromium browser

Today I got an issue on my Ubuntu 18.04 machine with latest chrome-beta installed. The issue was relating a component named "Widevine Content Decryption plugin" not installed. The amazon prime support recommended me to enable the plugin named "Widevine", but "chrome://plugins" was not accessible.

I got the fix for above issue at below URL in "chrominum setup" section.


https://gist.github.com/ruario/3c873d43eb20553d5014bd4d29fe37f1

Command which fixed mine:
sudo ln -fs /opt/google/chrome/libwidevinecdm.so /usr/lib/chromium-browser/libwidevinecdm.so
Enjoy the fix!

Wednesday, August 14, 2019

Zun on devstack: mysql issue



Are you getting below error while installing 'zun' on devstack? Then run the following command.

ERROR 1045 (28000): Access denied for user 'root'@'localhost'

sudo mysqladmin -u root password

Tuesday, August 13, 2019

Issues I faced when I tried installing "ZUN" on devstack(ubuntu based)

When I tried installing "zun" on my devstack. I got following errors.

stack@naveenr-VirtualBox:~/zun$ tox -egenconfig
genconfig create: /opt/stack/zun/.tox/venv
genconfig installdeps: -chttps://releases.openstack.org/constraints/upper/master, -r/opt/stack/zun/requirements.txt, -r/opt/stack/zun/test-requirements.txt
ERROR: invocation failed (exit code 1), logfile: /opt/stack/zun/.tox/venv/log/genconfig-1.log
==================================================================================================== log start ====================================================================================================
_____________________________________________________________________________________________________ summary _____________________________________________________________________________________________________
  genconfig: commands succeeded
  congratulations :)
Traceback (most recent call last):
  File "/usr/local/bin/tox", line 11, in
    sys.exit(cmdline())
  File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 44, in cmdline
    main(args)
  File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 68, in main
    exit_code = session.runcommand()
  File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 192, in runcommand
    return self.subcommand_test()
  File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 220, in subcommand_test
    run_sequential(self.config, self.venv_dict)
  File "/usr/local/lib/python2.7/dist-packages/tox/session/commands/run/sequential.py", line 9, in run_sequential
    if venv.setupenv():
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 594, in setupenv
    status = self.update(action=action)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 257, in update
    self.hook.tox_testenv_install_deps(action=action, venv=self)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 87, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 81, in
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 81, in get_result
    _reraise(*ex)  # noqa
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 740, in tox_testenv_install_deps
    venv._install(deps, action=action)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 457, in _install
    self.run_install_command(packages=packages, options=options, action=action)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 407, in run_install_command
    env=env,
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 574, in _pcall
    report_fail=not is_test_command,
  File "/usr/local/lib/python2.7/dist-packages/tox/action.py", line 121, in popen
    reporter.quiet(output)
  File "/usr/local/lib/python2.7/dist-packages/tox/reporter.py", line 123, in quiet
    self.logline_if(Verbosity.QUIET, "quiet", msg)
  File "/usr/local/lib/python2.7/dist-packages/tox/reporter.py", line 74, in logline_if
    message = str(msg) if key is None else "{}{}".format(key, msg)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 56414: ordinal not in range(128)


The issue here is not the UnicodeEncodeError, when I checked the log file given by tox in the beginning(file /opt/stack/zun/.tox/venv/log/genconfig-1.log), it was due to "python.h" not found.

After I installed python3-dev packages the following file got installed with it the issue got resolved.

$ ls /usr/include/python3.6m/Python.h 
/usr/include/python3.6m/Python.h

Very few files were getting showed up earlier.

$ ls /usr/include/python3.6m
Imaging.h  ImagingUtils.h  ImDib.h  ImPlatform.h


Monday, August 12, 2019

How do I login to CoreOS installation.

After installing my CoreOS for the first time. I was startled to see login prompt. I tried various default passwords nothing worked. Thanks to following blog, here is what worked for me. https://www.netroby.com/view/3795


If you just installed CoreOS, you do not set password, Now you have a chance to set it up again.
Once you see the boot screen , press keyboard, let grub menu hang up.
and type e, to enter edit mode.
you may see console=tty0 and etc,
Just put these code insert after it

coreos.autologin=tty1 coreos.autologin=ttyS0
And press F10 to boot system, now you have the chance to set up your password.


Thursday, September 8, 2016

Pause and wait commands in android mobile phones

I was going through Quora and one day I came across a article which suggested that pressing IVR numbers could be automated. It was quite interesting. It suggested after typing the phone number in address book if you type ","(using ) it means pause and ";" means wait.

For example lets say that you are calling some customer care often and this call is being handled by IVR and then you are required to enter dial pad numbers to answer questions given by IVR. Lets say your typical IVR session starts like this.

You: Type customer care number and dialed it.
IVR: Picks up the call and says "Press 1 to continue in english... Press 2 to continue in hindi blah blah."
You: Pressed "1" on dial pad.
IVR: If you are new customer press "1" If you existing customer press "2"
You: Pressed "2" on dial pad.
IVR : Enter your customer id and press #
You: 1111111#
IVR: You have entered "blah blah" Press 1 if it correct, 2 if you want to reenter.
You: Pressed "1"
IVR : For billing queries press "1" for techinical assistence "2" blah blah
You: Pressed "2"

You can automate above conversation on most android phones as follows. Assume the the customer care number is 987654321 then in you address book enter phone number as follows.

987654321,1,2,111111#,1,2

and then save. Now dial the saved number. You can see that the IVR keys are being pressed by the phone for you automatically.

Taadaaaa another mundane task automated!!!!!

Monday, March 23, 2015

Telugu to English Word translation.

Pullapuri as we call it here in Bangalore(Telugu speaking Bangaloreans) is a skin condition where you get cauliflower like small white heads. In English they are called Warts.

Here is what Wiki says about it.

wart is a small, rough growth resembling a cauliflower or a solid blister. It typically occurs on humans' hands or feet but often in other locations. Warts are caused by a viral infection, specifically by one of the many types of human papillomavirus (HPV). There are as many as 10 varieties of warts, the most common considered to be mostly harmless. It is possible to get warts from others; they are contagious and usually enter the body in an area of broken skin.[1] They typically disappear after a few months but can last for years and can recur.
Link : http://en.wikipedia.org/wiki/Wart