How to Use Qemu in Termux

 Everyone who owns a android phone hs come across a app called termux, and most of you know about termux and its usage but there is package called qemu which is like a Vmware in android.



  Qemu packages enables you to run other os system in your android phone like windows, linux and for some extent mac os too.

But most of them doesnot know to use it correctly and how to solve the errors in qemu related issues, So this tutorial blog will help you to solve the issue.

Method:

Installation of Termux:

  • First You need to download Termux and open it


Access Storage for Termux:

  • If you need to give storage access for the termux to open the files in termux
  • Command:
termux-setup-storage


Update and upgrade the Packages in termux

  • This step will be helpful updating the packages and solve some of the issues in termux
  • Command:
pkg update -y && pkg upgrade -y


Installation of x11-repo Packages.

Due to some of the recent updation of packages in termux, Now you can install qemu additional packages by using x11-repo.

  • Command:
pkg install x11-repo


Installation of Qemu x86-64

  • This step is essential for installation of qemu x86_64 (This is 64 bit qemu package) in termux.
  • Command:
pkg install qemu-system-x86_64


Installation of Qemu i386

  • This step is essential for installation of qemu i386 (This is 32 bit qemu package) in termux
  • Command:
pkg install qemu-system-i386


Installation of Qemu i386 & Qemu x86-64 together (Optional)

  • This Command will install the packages  of Qemu i386 & Qemu x86_64 at once
  • Command:
pkg install qemu-system-x86_64 -y && pkg install qemu-system-i386 -y

  • Now the packages are been installed lets fix some issues


Problems and Fixes:

  • Problem 1: Could not initialize SDL



  • This problem can occcur for two instances
  • If you didnt add a / after the -drive command.
  • If you have not given -vnc command at the end
Solution:
  • Enter a / after the -drive command
  • Remember to add -vnc command at the end


  • Problem 2: Respository is under maintaince
Solution:
Try after some time

  • Problem 3: Syntax error near unexpected token '('

  • This Problem can if you have given file name "filename(1).qcow2" in this manner

Solution:
Rename your file name in your browser in this way "filename-1.qcow2"



  • Problem 4: Connection unexpectedly closed
  • This Problem occurs due to Ram given in the termux
Solution:
  • Lower the Ram given in command from 2048M to 1024M


  • Problem 5: Port on which computer is listening couldnot be connected.
  • This problem can occur due to unupdated packages in termux
Solution:
  • Update your termux packages by using the command.
  • Command:

pkg update -y && pkg upgrade -y



  • Problem 6: No Such File or Directory
  • This problem can occur by two causes.
  • File name given is incorrect to the file name in your file explorer
  • There is no storage permission given to the termux
Solution:
  • Check the file name is correct or not before running the command.
  • Give Storage permission to termux by entering this command.
  • Command:
termux-setup-storage



  • Problem 7: Invalid option
  • This problem can occur if there is a unwanted symbol or space in the command
Solution:
  • Check the unwanted symbols or spaces in the command before you enter it in termux.

  • Problem 8: could not open ' '
This problem occurs due to unwanted spaces present in command.

Solution:
  • Remove the spaces before you enter the command in thetermux


Additional Packages for Qemu Termux:

Converting vdi image to qcow2 image:

  • Install the qemu package by using this command.
  • Command:
pkg install qemu-utils


  • Convert the vdi image to qcow2 image by using this command:
  • Command:
qemu-img convert -f vdi -O qcow2 /storage/emulated/0/Download/filename.vdi /storage/emulated/0/Download/filename.qcow2