Sunday, June 5, 2016

Changing/Customizing Screen Resolution for Remix OS (Android-x86) on VirtualBox VM

I primarily referred to the following site for a step-by-step to setup my custom screen resolution.
https://4sysops.com/archives/change-the-screen-resolution-of-an-android-virtualbox-vm/

This site has instructions for testing different screen resolutions (non-permanent) before implementing the permanently.
http://luisrato.azurewebsites.net/2013/10/15/how-to-install-android-x86-on-hyper-v-part-2-screen-resolution-and-network-configuration/


In this posting I added some additional comments to augment the guide for permanent implementation.  Screen resolutions can be found on Wikipedia.
https://en.wikipedia.org/wiki/Display_resolution

1. Add a custom screen resolution to your VirtualBox VMOpen a Windows Command window.
Change directories to C:\Program Files\Oracle\VirtualBox
    cd ..\..\program files\oracle\virtualbox
Enter the command
    vboxmanage setextradata “<your VM name” “CustomVideoMode1” “<desired resolution>”
    substituting in your VM name and screen resolution in the places noted.
    e.g. vboxmanage setextradata “RM0010” “CustomVideoMode1” “1366x768x16”

Note: According to VBox documentation you can add up to 16 CustomVideoModes using the same approach, e.g., "CustomVideoMode2", etc.





2. Start the VM and, when the GRUB boot menu appears, select the Debug mode.

3. Wait until the Linux boot process is completed, and then press Enter.

4. At the Linux prompt, enter the following commands:
For this step, I first made a copy of the menu file
mkdir /boot
mount /dev/sda1 /boot
    cp /boot/grub/menu.lst /boot/grub/menu.lst.old
vi /boot/grub/menu.lst

5. Move the cursor to the first line that begins with kernel /android

Instead of modifying the existing menu options, I added a new menu option with the custom resolution. To do this is inserted new lines above the existing menu list (menu list items begin with 'title'). When I created the new lines I simply copied the menu entries below. This approach can be used to add multiple menu selections for various screen resolutions.

To distinguish my new menu options from the other menu options, I entered the resolution in the title and modified the title of the original default.


5. (cont.) I did not find “video= -16” so I just added the text at the end of the line. See screenshot below. This site can help with vi navigation and commands.
https://www.cs.colostate.edu/helpdocs/vi.html6. Press the i key (enables insert mode in the vi editor), and then type UVESA_MODE="1366x768"

uvesa_mode as in
UVESA_MODE="1366x768"
case sensitive and quotes
Reference: https://groups.google.com/forum/#!topic/android-x86/IrAVyc_4Tiw

7. Press ESC and then SHIFT+ZZ to save the new GRUB boot menu.

8. Clean up and then restart the VM.
umount /boot
rmdir /boot
reboot –f
note: The command is umount, not unmount.

9. From now on, your Android VM should use the new screen resolution.

Installing Remix OS (Android-x86) on VirtualBox VM

Here are the steps I took modified from this posting.
https://www.reddit.com/r/RemixOS/comments/40ahkc/is_it_possible_to_run_remix_os_on_virtualbox_if/

Here's how I managed to get the 64-bit version running in persistent mode in VirtualBox 5.0.16 on Windows 7.

*My VMs are typically stored on an USB external drive.  I was having trouble creating the Remix VM on the external drive so I started by changing my VBox settings to install to the local drive (e.g. desktop vs USB external drive).

Create a new machine - type: "Linux", version: "Other Linux (64-bit)". I named mine RM0010 but it doesn't matter.
Allocate some RAM for it. I went with 4096MB and couldn't find the minimum required specs, but you should be okay with 2048+.
Create a virtual hard disk. I used the VMDK file type with a fixed size of 64.00GB - simulating running it on a 64GB flash drive. The minimum specs require 8GB of space.
DON'T START THE MACHINE YET!
Click "Settings">"Storage">"Controller:IDE" and add an optical drive (icon looks like an optical disk with a plus symbol). Choose the OS's ISO. This should appear above any existing optical drives and below the hard drive.
Select the drive you just added and check the "Live CD/DVD" toggle. Then click "OK".
*Also increase the number of processors for Remix OS
We are now ready to start the machine. When you do, there should be a splash screen - press the tab key before it tries to perform a default installation. If you missed it, just power down the machine (don't save its state or send the shutdown signal, just power it off) and try again. It only gives you about 3s to press tab.
Type a space then "INSTALL=1 DEBUG=" and press enter/return. Don't forget the spaces.
Press down to select "Create/Modify Partitions" and press return/enter.
Say "No" when it asks if you want to use GPT.
Press the right arrow key to select "New" and press return/enter.
Select "Primary" and press return/enter.
Press return/enter to use the default size.
Select "Bootable" and press return/enter.
Select "Type" and press return/enter until you're back at the main cfdisk screen. (Linux "83")
Select "Write" and press return/enter.
Type "yes" and press return/enter.
Select "Quit" and press return/enter.
Select "sda1" (the partition you just created) and press return/enter.
Select "ext4"
(ignore, replaced with the step above) Select "ext3" as the filesystem format (AFAIK, ext4 is also fine, but I didn't test with it).
Select "Yes" and press return/enter to format the virtual disk.
Select "Yes" and press return/enter to install GRUB.
Select "Skip" and press return/enter to skip installing the EFI GRUB2 loader.
Select "Yes" and press return/enter to enable the /system directory as a read/write.
Select "Run Android-x86" and press return/enter.
Several minutes later, you'll be taken to the language selection screen. Follow the OS install as you would any other.
Once you're on the desktop, shut down the OS (properly).
Open the VM settings and remove the OS ISO from the list of devices - we don't need it any more.

Friday, September 11, 2015

Create a virtual router (DD-WRT) in VirtualBox

Okay, this is a pretty long post, but hopefully it captures what you need to create a virtual router in VirtualBox.  Some of the websites I have linked here make it seem so simple, but there is a little more to it and I have tried to capture what you need here.  I also included the links I used so you can refer to them if you run into any challenges.

Download dd-wrt for x86 platform and prepare the image/disk file:

Download the dd-wrt file.  The file can be down loaded from this site. http://www.dd-wrt.com/site/support/router-database Type ‘x86’ in the search box.  Select x86 and then the link labeled ‘DD-WRT X86 Public Vga: Console image’.

Convert the image file to a VM disk by executing the following command in the command prompt window.

cmd> "C:\Program Files\Oracle\VirtualBox\vboxmanage.exe" convertdd dd-wrt_public_vga.image dd-wrt.vmdk

Resized the disk. http://www.dd-wrt.com/phpBB2/viewtopic.php?t=76456  Otherwise it will be stuck at 10MB and may not save your settings.

cmd> "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd --resize 1024 "dd-wrt-x86.vmdk"

Some forums suggest the image needs to be natively installed to the VM.   http://www.dd-wrt.com/phpBB2/viewtopic.php?t=81836

Create a new virtual machine in VirtualBox:

Set the following specifications.

Operating System: Linux
Version: Other Linux (32-bit)
Storage: Choose existing disk: dd-wrt.vmdk
Audio: Clear the checkbox ‘Enable Audio’
Network>Adapter 1: Select PCnet-FAST III as the Adapter Type (under Advanced)

Depending on your desired network configuration, select the appropriate ‘Attached to:’.  I want to create a connection with my home network so I selected ‘Bridged Adapter’ and my computer’s WiFi adapter (which is how my computer connects to my home network).

Network>Adapter 2: Enable the adapter and again select PCnet-FAST III as the Adapter Type.  Select internal network.

I had trouble with the default Intel PRO/1000 MT Desktop where eth0 and eth1 were not being recognized.  The posting from JimmyPage on this thread http://www.dd-wrt.com/phpBB2/viewtopic.php?p=690980 was helpful.

Configure the virtual router:

Turn on DD-WRT VM when the text stops hit enter and log in. 
User: root
Password: admin

At the command prompt enter ‘ifconfig br0 192.168.2.1’ to change the IP address to avoid conflicts with your physical network (assuming it is on 192.168.1.X, which mine was).

Using a separate VM computer, set the network adapter to 'Internal Network'. Turn on the VM computer.  Manually set the IP address to 192.168.2.2. Open a browser in the VM computer and enter 192.168.2.1 to access the DD-WRT webGUI.  Change the username and password and login.  Go to the ‘Setup’ tab and update the following fields (use values appropriate for your network).

WAN Setup
Connection Type: Static IP
WAN IP Address 192.168.1.3
Subnet Mask 255.255.255.0
Gateway 192.168.1.1
DNS 192.168.1.1

Network Setup
Local IP Address 192.168.2.1
Subnet Mask 255.255.255.0

I left the rest of the values on the setup tab as the default.  Click 'Save', then click 'Apply Settings'.  The router should now handout IP addresses to your VMs. Change the settings on the separate VM computer to automatically receive an IP via DHCP. 


The following are additional links I referenced.

This youtube video is pretty helpful and walks through similar steps to those above.

The following links provide an overview of the steps.




Sunday, November 2, 2014

OpenCPU and rapache Installation

I used a combination of installation instructions from http://rapache.net/manual.html and https://github.com/jeroenooms/opencpu-server/tree/master/debian#readme in order to get OpenCPU installed.  This was a process of trial-and-error.  Eventually there were no critical errors and the commands would work.  Building rApache, I used the instruction from the rapache site.  Building OpenCPU I used the instructions from the github link above.  When I first attempted the build there were a few missing dependencies.  I installed these and then retried the build with success.  Installing OpenCPU I used the following instead of the suggested commands.
sudo dpkg -i opencpu-lib*
sudo dpkg -i opencpu-server*
I also opted to install apparmor using the instructions on the github link

Saturday, November 1, 2014

OpenCPU Installation

The installation of OpenCPU on my Debian system is less than simple.  There is no easy apt-get solution so I am working my way through the instruction on https://github.com/jeroenooms/opencpu-server/tree/master/debian#readme.  So far I made it through 'Building OpenCPU packages'.  When I got to the 'debuild' command I got an error 'debuild command not found'.  This was solved by installing the 'devscripts' package (sudo apt-get install devscripts).    

Frameworks

After careful research and consideration I am going to use Drupal as my full stack framework with Bootstrap for the web layer.  I read lots of recommendations for Bootstrap.  The reviews said Drupal was easier to get going than Django.  Eventually I expect I will shift the web app to Python (Django), but I'd rather just get going at this point.  Hence the decision to go with Drupal (PHP) for now.  Looks like Django can also interface with Bootstrap so I'm thinking the shift will not be that bad if/when I get to that point.  On the other side I decided to use opencpu to interface with R.  Again, I'm hoping this will facilitate any eventual shift to Python/Django since opencpu is a framework agnostic API.  I will also install rApache just for good measure, but I don't currently plan to do any R scripting with PHP/Drupal.

Saturday, October 25, 2014

Curl and RCurl getURL

I wanted to use the getURL function from RCurl so I tried to install the RCurl package.  I received this error Cannot find curl-config. In order to clear the error, I had install curl (apt-get install curl).  This didn't work so I ended up trying (libcurl4-gnutls-dev).  I then had to restart R and install R package bitops.  I ran library(RCurl) just to be sure.  getURL is now working.

Friday, October 24, 2014

User Authentication Parameters in .my.cnf

The RMySQL documentation (http://cran.r-project.org/web/packages/RMySQL/RMySQL.pdf) recommends placing user authentication parameters (user, password, database, and host) in the config file. This file is read from $HOME/.my.cnf.  I found this file did not exist so I copied the my.cnf file from /etc/mysql to my home directory and changed ownership (sudo chown...).  Next I added a group and my authentication parameters to the file.  I could then used 'con <- dbConnect(MySQL(), group = "group name")' in R to connect to my database.  This might be more secure if I were to continue using R Studio server from a separate computer, but my plan is to run R scripts locally initiated from PHP files, so I don't think there is any enhancement security in my case, but it does work.

Thursday, October 23, 2014

RMySQL - dbConnect

Now that R was recognizing the dbConnect function, there was a new error.
Error in mysqlNewConnection(drv, ...) : 
  RS-DBI driver: (Failed to connect to database: Error: Access denied for user 'root'@'localhost' (using password: YES)
I concluded this error was returned from MySQL and started looking for a solution in MySQL.  Using MySQL Workbench I had created a database and connected to it from within Workbench.  However I was unable to connect to MySQL from the command line.  I couldn't even start MySQL from the command line.  When you install MySQL you need to create grant tables.  This is easily accomplished in Workbench using the new instance wizard.  I had to select 'Debian' a few steps into the wizard so it would know the correct file paths.  Once the instance was established I was able to create users and assign them access to my database.  I was then able to connect to MySQL from R using my newly created user.

RMySQL Installation Challenges

I loaded RMySQL package so I could connect R to MySQL.  I used the install feature within R Studio.  The package installed without errors, but when I tried to use the dbConnect function I would get this message Error: could not find function "dbConnect".  I finally tried 'library(RMySQL)' and that did the trick.  Also had to run 'library(DBI)'.  DBI was installed with RMySQL as a dependency.

Background

Several months ago I purchased a used computer to use for a hobby machine with the intent of learning more about programming.  Recently I realized that if I didn't start to capture my experience, there was a good chance I would forget what I had done.  So today I am starting this blog to capture my small achievements.  So far I installed Linux Debian, Apache, MySQL, PHP and R Studio Server.  I installed VNC so I can access my machine remotely.  After some research I also installed NetBeans (PHP and others), PyCharm and MySQL Workbench IDEs.