Friday, June 28, 2013

Ubuntu 12.04 guest OS runs in "Low Graphics Mode" on VirtualBox 4.2.14

As the title says, this entry is about the persistent issue with running Ubuntu 12.04 as guest OS on VirtualBox 4.2.14 running in "Low Graphics Mode" - meaning it won't let you boot into Ubuntu with its nice graphical user interface, instead you're stuck with the shell/terminal. If you google (yes, that's officially a word) this issue, you'll find some discussions of it like in this forum: VirtualBox Forum. Before I move on, a couple notes which may or may not be important:
  1. I used Ubuntu 12.04 Desktop edition 32-bit version
  2. I'm writing this based on my recent experience with the issue where my Host OS is Windows 7 (SP1) 64-bit. But I think it happens regardless of the kind of Host OS (MacOSX, Windows...)
  3. I tried increasing my video memory to 48MB but it does not solve the issue

The only known solution for this problem so far is installing the VirtualBox Guest Addition package. Once you get the Guest Addition installed, the problem goes away. However, I did run into some problems trying to install the Guest Additions. Hence, I am writing this note to help any of you who might encounter similar problems (but also for my own notes). I apologize in advance for not having screenshots that would greatly help the explanations below. I'll try to reproduce the issue and update this post with screenshots as soon as I can. So here goes...

I'm going to skip the steps of installing VirtualBox and the Ubuntu as guest OS. I'm going to assume you are at the point where you've installed those two, and as you load your Ubuntu VM, you're seeing this issue.

 

Mounting the Guest Additions .iso

The scenario:
  • I've launched my Ubuntu VM
  • It gives me a message "Running in Low Graphics Mode"
  • I choose to "Continue running in Low Graphics Mode"
  • The VM launches into shell, I logged in
  • Now I'm in the shell prompt
Now I'm trying to mount the Guest Additions .iso to install it.  I do:
  1. On the VM menu bar, go to: Devices > CD/DVD Devices
  2. Choose: VBoxGuestAdditions.iso
  3. I noticed I don't have a checkbox next to it after I selected it, but there's no error messages.
I tried looking around for the mount point for the VBoxGuestAdditions.iso, under: /media and /mnt by typing the following in the shell:
  • ~$ ls /media
  • ~$ ls /mnt
 And both directories remained empty.  This means the mount somehow didn't work. I tried to unmount/re-mount this a few times, even manually pointing to the .iso file (in Windows, it's under: C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso), nothing works.

Solution:
  1. Download the Guest Additions .iso for VirtualBox 4.2.14 from the archive: here.  
  2. Download and save the .iso somewhere (maybe your default \Downloads folder).
  3. Mount the .iso by:
    1. On the VM menu bar, go to: Devices > CD/DVD Devices
    2. Click on "Choose a virtual CD/DVD disk file..."
    3. Find your VBoxGuestAdditions_4.2.14.iso file (do you remember where you saved it?), click on the file, and click Open.
  4. If all goes well, now when you reopen Devices > CD/DVD Devices menu, you'll see a checkbox next to "VBoxGuestAdditions_4.2.14.iso"
Wait, we're not done yet.  After I did this, when I ls on the /media and /mnt folders again, I still don't see anything mounted. I guess I have to mount it manually.

Mounting:
  1. In the Ubuntu shell, do:
    • ~$ ls /dev OR ~$ ls /dev/sr0
  2. If sr0 exists, then you're in luck! That's what you need to mount. Otherwise, I have no answer.
  3. Create a directory as the mount point for your VBoxGuestAdditions_4.2.14.iso:
    1. ~$ mkdir /media/disk1
      • Note: I don't remember if you have to use sudo mkdir /media... or not. If you get permission error then you probably do. "/disk1" is a name I arbitrarily chose, so you can use any name you want if you so choose.
  4. Edit the fstab file to let the system know you're adding a mount point.
    1. ~$ sudo vi /etc/fstab 
      • Make sure to use sudo to get permission to write the file
      • I use vi, but you can use any other text editor you like, e.g. pico)
    2. Add a new line to the file (the last line in the screenshot):
      /dev/sr0     /media/disk1   auto   ro,noauto,user,exec 0  0
    3. I'm not sure how important the exact spacings between those entries are, but  I tried to make the first character line up with the first character of the column name when I can.
    4. Save the file and close the text editor.
    5. Mount the .iso using:
      1. ~$ sudo mount /dev/sr0 /media/disk1
        • Yes, you have to use sudo due to permission requirement
    6. If all goes well, now you can go to the directory and execute the script to install the Guest Additions:
      1. ~$ cd /media/disk1
      2. ~$ sudo sh VBoxLinuxAdditions.run
The Guest Additions should install. Reboot after it's finished installing, and the "Low Graphics Mode" message should not appear anymore and take you to Ubuntu login screen.

Hope that helps.

Monday, August 13, 2012

MacPorts trouble with OS X Lion


It's a llama and an ass.


Recently I had trouble using MacPorts on Lion, for whatever reason. But I managed to find the fix, and here they are.
  1. Unable to do selfupdate:


    ~$ sudo port selfupdate
    ---> Updating MacPorts base sources using rsync
    MacPorts base version 2.0.4 installed,
    MacPorts base version 2.1.2 downloaded.
    ---> Updating the ports tree
    ---> MacPorts base is outdated, installing new version 2.1.2
    Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl

    Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)

    Cause: ??? (shame on me for not checking the logs)
    Solution: Re-install Xcode (ref: MacPorts ticket #30507).
    Before re-installing Xcode, I had to uninstall my existing one. All I did was:
    1. Search for the Xcode executable from Spotlight
    2. Open the folder where the Xcode executable is (usually under /Applications).
    3. Drag the icon to the Trash bin. OR drag the Launcher icon to the Trash bin (this will prompt for are-you-sure-you-want-to-uninstall? confirmation). Click Yes/OK if asked.
    Unfortunately, I wasn't 100% sure my method of uninstalling Xcode is correct. So here's a most-likely-more-proper-way reference from StackOverflow: #6777462 - Can't Reinstall Xcode
    If you're able to successfully re-install XCode (mine was 4.4.1 as of this writing), you should be able to run ~$ sudo port selfupdate successfully.

    p.s. Actually, I also installed MacPorts 2.1.2 manually (go to MacPorts website, download the .dmg, install, etc.). So now I'm not entirely sure which fixed it.
  2. Unable to install Octave


    ~$ sudo port install octave
    Warning: The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build.
    Warning: See http://guide.macports.org/chunked/installing.xcode.html for more information.
    Error: Unable to open port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?
    Error: Unable to execute port: upgrade perl5 failed

    Cause: (the error message was pretty explanatory on this one) "The Command Line Tools for Xcode don't appear to be installed" and (hence) "Failed to locate 'make' in path".
    Solution: Install the XCode Command Line Tool.
    1. Launch XCode.
    2. In XCode, go to: Preferences > Downloads
    3. Click "Install" for the "Command Line Tools" item (the screenshot shows that it's already installed).


    Currently I'm still unable to install octave because MacPorts failed to install gnuplot, but it's not the error above - so that's an improvement. It may be missing some dependencies...

    p.s. Prior to installing the Command Line Tools, I ran across this post: "GCC non-existent in Lion". So I also did what was recommended there: made a symbolic link to llvm-gcc-4.2 to /usr/bin/gcc. But the location of the newest Xcode directory in my system is a little different:

    ~$ sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 /usr/bin/gcc

Monday, March 26, 2012

VirtualBox and The Pesky Shared Folder

VirtualBox and Shared Folders

What I learned: if you want full access to your shared folder on VirtualBox, do manual mounts.


System:
Host: Mac OSX 10.7 (a.k.a. "Lion")
Guest: Ubuntu 11.10 (a.k.a. "Oneiric Ocelot")
VirtualBox version: 4.1.10 r76795
VirtualBox Guest Addition version: 4.1.10
Shared Folder name: ~/sharedfolder

Case:
I need to rebuild a database in the guest OS. The database dump is stored in the shared folder (due to limited space in my .vdi), and I need to use it to rebuild the database.

Issue:
I used the command:
~$ sudo su postgres -c "psql -d < path-to-shared-folder/database.pgdump"

Result:
after entering root password, it returned:
"Permission denied"

I checked the permission on the shared folder and the dump file. The file's permission was:
-rwxr-x---

I tried changing the permission to no avail.

Solution: manual mount!

  1. Create a new folder in your HOST system. e.g. ~/sharedfolder
  2. Add the folder to your VirtualBox Guest OS shared folder list
    1. To access the Shared Folders option: select your guest OS > Settings > Shared Folders
    2. Add your shared folder. Make sure NOT to check "Auto-mount" (it's evil). Then click "OK".
  3. Run your guest OS. The following instructions are for Ubuntu only (sorry!).
  4. In your guest OS, create the directory you want the shared folder to be mounted to. For example: /mnt/shared
  5. Open a Terminal and mount your shared folder
  6. Et voila, your file (if you have any in the shared folder) will have the following permission:
    -rwxr-xr-x 1 root root
Only after doing the manual mount, I was able to use the .pgdump file to rebuild the database. Prior to that, it's just a bunch of "Permission denied", "Wrong protocol", "file or folder not found", etc. I can't say whether or not this would work if you want to use a shared folder you already used with Auto-mount. I had to create a new folder for it to work. Let me know if you had a different experience/luck. Signing off...

Tuesday, March 6, 2012

iPadHD = iP+ADHD

The new iPad will be called iPadHD:
i - P - Attention Deficit Hyperactivity Disorder (ADHD)

What is ADHD?

Tuesday, November 8, 2011

VirtualBox Shared Folder (Mac OS X 10.6)

I believe it's generally a good idea to set up a shared folder if you're doing virtual machines (VM's) like VirtualBox.  Particularly:

  • If you have limited disk space (like me), you'd want to make your virtual disk fixed-sized. But at the same time, you recognize you may do a lot of work with your VM, so you want some way to store your data without quickly hitting the capacity of your virtual disk.
  • You may have some files you'll be working on both in your VM OS, and your host/main OS. So you need a way to transfer/access the files between the two OS'es.
Here are the steps to set up your shared folder for VirtualBox (version 4.1.4 as of this writing) with Mac OS X 10.6 as host, with Xubuntu 11.10 in the VM:
  1. Launch VirtualBox - don't run your VM yet.
  2. Select the VM you want to add your shared folder to.
    1. Go to Settings > Shared Folder
    2. You should only see "Machine Folder" in the list box if your VM is off. If you see "Transient Folder" in the list, that means your VM is running. Turn it off.
    3. To the right of the list box, click on the Folder-with-Plus-Sign icon to add the folder.
    4. Select the folder you want to use as your shared folder (create one if you like/necessary). For example, name the folder: "SharedFolder" (creative, I know). Check the Auto-mount option.
    5. Accept, OK, and close the Settings window.
  3. Run your VM.
  4. Log in. (You can skip step 5 and go to step 6 - I'm just showing that the Shared Folder is not yet accessible at this point)
  5. Open the File Browser/Explorer and try to access the shared folder at: /media/sfSharedFolder. You will get a "Permission denied" error. Don't panic - follow the next step.
  6. Open a Terminal window.
  7. Add yourself to the group: vboxsf.  E.g.
    ~$ usermod -g vboxsf
    You might need to become root before you can do it:
    ~$ sudo usermod -g vboxsf
  8. Check that the group vboxsf has been added to your group list:
    ~$ groups
  9. Now this is important: Log out, then log back in. You won't be able to access the shared folder if you don't.
  10. After you log in, you should now be able to access your shared folder (/media/sfSharedFolder) without the "Permission Denied" error.
Hope that helps.
 

Sunday, November 6, 2011

The Ten Virgin Brides

It's a glorious foggy morning
This morning, the Gospel reading is on Jesus' parable of the ten virgin brides; five wise, and five foolish.

'Then the kingdom of Heaven will be like this: Ten wedding attendants took their lamps and went to meet the bridegroom.
2 Five of them were foolish and five were sensible:
3 the foolish ones, though they took their lamps, took no oil with them,
4 whereas the sensible ones took flasks of oil as well as their lamps.
5 The bridegroom was late, and they all grew drowsy and fell asleep.
6 But at midnight there was a cry, "Look! The bridegroom! Go out and meet him."
7 Then all those wedding attendants woke up and trimmed their lamps,
8 and the foolish ones said to the sensible ones, "Give us some of your oil: our lamps are going out."
9 But they replied, "There may not be enough for us and for you; you had better go to those who sell it and buy some for yourselves."
10 They had gone off to buy it when the bridegroom arrived. Those who were ready went in with him to the wedding hall and the door was closed.
11 The other attendants arrived later. "Lord, Lord," they said, "open the door for us."
12 But he replied, "In truth I tell you, I do not know you."
13 So stay awake, because you do not know either the day or the hour.
(Source: http://catholic.org/ Matthew 25:1-13 for November 6, 2011)

It looks like in this version, they changed the original "virgins" to "wedding attendants" - whatever. This is one of Jesus' parables that seemingly have a darker side to the story, but one have to keep in mind that: a) the context (time and place) where these things make sense, and b) Jesus used a parable to make a point, and only one point. So, don't get caught up in the details and missing the whole picture. The following points are based on Fr. Ignatius' homily (the presider for today's mass) and what I understood from it.

First interesting point: there were ten virgins. Why would a bridegroom have ten virgins? What kind of bridegroom is this? Well, this is a parable; Jesus often illustrates the relationship between God and mankind as to be as intimate as the relationship between a bride and bridegroom. And in those times, marriage ceremonies are big events that lasts for days - it is supposed to be a big, joyful occasion. Hence, the relationship between God and mankind is to be like one in a marriage: through good times, and bad times. The number of virgins? Doesn't matter.

Second point: did you notice how selfish the wise virgins are? Those bastards won't share their oil and help their poor, oil-less companions. Are they really companions? Well, if you put it in the context of the coming of the bridegroom as the end of times, the 'oil' is your 'good deeds' that you did in your life. 'Being prepared' then means doing good deeds as you prepare for the end of times. If good deeds are your Trophies (for those of you PS3 gamers) or Achievements, how are you to share those with others who don't have any when it's time to tally? You can't. So the issue of selfishness is irrelevant for this parable.

Third point: when the 'foolish five' came late to the wedding, the bridegroom denied them by saying he did not know them. How dare he! Well, I don't have a good explanation for this one. But if you think about it, how late did they come? What if the main part of the ceremony already passed? In a sense, it's kind of disrespectful to the bridegroom, the guests, and the ceremony itself.

Lastly, all ten virgins fell asleep and none of them knows when the bridegroom is coming. In those days, the bridegroom need to make preparations for the wedding with the parents of the bride before coming for the bride. This process can be quick, or it can take a while. Thus, the bride is just left waiting until it is done, but not knowing when it will be done. The point is: both the wise and foolish virgins all fell asleep - waiting. Same thing: none of us know when the Second Coming (if you believe in that term) or the end of times is. I frankly would rather not knowing anyway. Whatever - just. be. prepared. THIS is the main point of the parable.

I thought it was an interesting parable. At first it sounds like it has a bunch of darker twists to it, but once you look closer, the twists are not the point Jesus was trying to make. And it's very easy for us to focus on the twists and missing the whole point of the parable - and believe me, the Evil One is masterfully tricky and will use it to his advantage.
Mass at St. Michael the Archangel Church, Portland, OR
Study/Research
Made a bunch of progress this week. Brzozowski's original Derivatives of Regular Expression paper was actually difficult to comprehend! Luckily my adviser had written a paper that gives the gist of it with examples. So it makes sense now.

In another news, made a lot of progress with Lisp programming. Made a Breadth-First Search and Depth-First Search program, and learned how to use structs (defstruct ...), which is useful in programming the A* search, and a bunch of other Lisp functions. Next up: either a program for Brzozowski's method or some sort, fuzzy logic, genetic algorithm, genetic programming, and maybe neural nets if I have time.

But first, I need to get a mobile platform for my robot. Maybe getting one of these:

(Source: Stingray Chassis Kit)
Now this is FASCINATING. The idea of a structure that is not random, but does not have a repeating pattern. Who knew that this property is what makes a sonar ping works best?! At this point I can't explain this very well, but I am going to use this for my research for using patterns and other properties in music to change the behaviors/movements of a robot.



I'm going to have to research this more, and I think it's going to be awesome.