Installing Fedora 24 with Guest Addition in Virtual Box

Ah, the moment of triumph!!!

I had installed Fedora before in Virtual Box. In fact, I had done it several times. I have also installed Guest Addition to Ubuntu to correct display resolution problem. But this time? Not only did I ran into trouble with installing Fedora, but the Guest Addition for it as well! I have never had so trouble before!

So, what happened?

Well, at first there was problem with the hard disk installation refusing to stick. I would installed it, and it would me to re-install each time it boots! Turns out the optical drive was being booted first, and because I am on a VM, I can’t use F12 to choose the boot drive. So instead, I just went to Settings->Storage and remove the optical drive. That worked for a while… than I decided to install Guest Addition.

When I attempt to mount Guest Addition, it tells me that my optical drive is empty.

Error Dialog: No optical drive
An error dialog! No optical drive?

Huh?

Ok. Optical drive. Optical drive. Wasn’t that what the Fedora iso was on? Am I suppose to keep the Fedora iso as an optical drive for some reason? But the VM boots the optical drive before the hard drive every time. Did I missed something? Luckily(?), I realized that I can changed the boot order while Settings->System->Boot Order. Then I added Fedora’s iso back as virtual optical drive (Some of you may already realized what happened and is laughing at my idiocy. For the others? Yep, that was not the right train of thought.). Yea! I did it, right?

Then my Guest Addition refused to mount.

VirtualBox Dialog: GuestAddition Unable to Mount
Another error? Unable to insert GuestAddition.iso…

*Head hits table*

The “Force Unmount” button and the “VERR_PDM_MEDIA_LOCKED” under “Details” led me to deduce the process failed because there is something locking the media drive. Then I though, “Did I accidentally mounted the Guest Additions already?” So, I tried both clicking the “Force Unmount” button and entering a umount VBoxGuestAdditions.iso command. Neither worked.

I did a mount and grep for the Guest Addition file, but it’s not in the list. I tried to check what’s in /dev/cdrom. There is a README.MD file there, so there is something… I did another mount, but grep for dev. Then, the light-bulb lit – /dev/sr0, which is where the symlink of /dev/cdrom connect to, is not mounted to the Guest Addition. Some of you who may have noticed about my mistake earlier – I did mounted something to virtual optical drive… I created a virtual optical drive by mounting the Fedora iso, which mean the drive was occupied with another mount already. I should had created an empty virtual optical drive, or created a virtual optical drive with the GuestAddition.iso .

I did a umount of sr0, and this time the install was success, and upon reboot, the resolution of screen is correct.

*sigh with relieve*

Here are the the steps:

Creating the Virtual Machine VDI file:

  1. Open VirtualBox. Click New.
  2. In “Name and operation system”, enter something for Name. Make sure the Operation System is Fedora.
  3. In “Memory Size”, enter 2048. (1024 works at first, but I started having mouse problem. Seems like 2048 works fine.)
  4. Stay with default for “Hard Disk”, “Hard Disk File Type”, “Storage on physical hard disk”, and “File Location and size”.

Install Fedora in the Virtual Machine you created:

  1. Make sure the iso file for Fedora Workstation had been downloaded. Start the VM. When it ask you to select a virtual optical drive, select the downloaded Fedora iso.
  2. Select “Install to Hard Drive”. Select your choice of language.
  3. Click on Installation Destination. Confirm that you are fine with “Automatic partition” by clicking done (unless you want to change the partition).
  4. Click “Begin Installation” at the bottom right.
  5. As Fedora install, there are options to add root password and create user, which I did.
  6. Once installation is complete, click Quit. Instead of rebooting, power off here.

Correct Boot Order and Change Setting

  1. Right click VM in Virtual Box Manager. Select ‘Settings’. Change the following:
    1. In System -> Boot Order, there is an up and down button. Use that to push Hard Disk to the top.
    2. In Display -> Video Memory, increase the memory to 24MB. In Acceleration, click to turn on “Enable 3D Acceleration”.
    3. In Storage, there should be the Fedora iso file under “Controller IDE” and the distro’s vdi file under “Controller: SATA”. Remove the iso file. In order to install Guest Addition later, add an empty virtual optical drive to “Controller: IDE”.

      Controller IDE
      Click the cd image in red circle to create virtual optical disk
    4. Make sure you click “Ok”, or the options you changed wouldn’t be saved!

Prepare and Install Guest Addition to Fix Display Resolution

  1. Boot VM. Open the Terminal.
  2. If you are not root user, su – to become root user.
  3. Optional: If you added root password and created user during installation, your account may not have sudo permission. If you don’t want to su – every time you need to do things as root, do the following:
    1. Enter visudo -f /etc/sudoers¬†(Note that this uses a vi editor. If you don’t how to do basic Insert and Save, look it up!).
    2. At the bottom, add the needed line to give yourself permission to use sudo. For me, my line was username ALL=(ALL) ALL, with username for my account name.
    3. Save file. Try logging out of root with command exit, then do a sudo visudo -f /etc/sudoers. You should be able to enter your password and view the file.
  4. Enter command sudo dnf -y update. It’s going to take a while. Go eat.
  5. Finished? Ok, now enter sudo dnf install dkms gcc kernel-devel kernel-headers. When done, reboot Fedora.
  6. Go to Devices -> Insert Guest Additions CD image.
  7. Errors?: If you get the error I came across earlier, you have either forgotten to remove the iso for Fedora, or your cdrom is preoccupy with another mount for some reason. If clicking “Force Unmount” doesn’t work,¬† do the following:
    1. Enter mount | grep dev. See if the mount on /dev/sr0 is the GuestAddition.iso. If there is nothing, ls -l /dev/cdrom to find what directory is the cdrom symlink to. If you still can’t find it, try mount | grep iso – your Fedora iso have to be mounted somewhere.
    2. Whatever your iso is mounted to, umount it. In my case, it was umount /dev/sr0. After that, do Devices -> Insert Guest Additions CD image again. This time, it should work.

      GuestAddition Mounted
      Viola! GuestAddition.iso mounted and ready to run!
  8. Reboot Fedora. Your resolution should now be fixed.

 

 

Summer 2015 So F ar

One of my goal this summer is work on my project, which ended up with me taking a long detour in both brushing up and learning new skills in JavaScript, JQuery, Ajax, PHP, MVC, and OOP. There was a lot of reading, online video/school, and coding. I have sadly ddiscovered that I have learned more about Ajax in a 2-days self-study using Treehouse video and books than I did a semester of class, but hey, some classes are better than other. It’s been good, although I ended up pushing back my C and Anduino learning.

IT network self-study has been going well. Since I am taking the same professor as I had in my Introduction to Networking for the next semester course in Network Security, I feel that I should brush up on my network knowledge. When I took my first network class over half year ago, I was new to CS and have no idea what is going on. I am half-way through re-reading my books and notes. Now that I have a lot more experience, it makes much more sense, and I feel more comfortable about jumping back to a networking class this Fall.

In term of Fedora, because of that fact that half of my self-study files are local, I lacked a reason to even turn on Virtualbox. But no more. Most of my learning files and even a good portion of my project files are now on Dropbox. I installed both Dropbox and Sublime Text on Fedora, so I can now do most of my coding and studies in Fedora!

Although, Fedora have problem waking up from its sleep in Virtualbox. It would either remain the black screen of death or refuse to let me type anything. In addition, I am consistently clicking on command-C instead of control-C. In Virtualbox, control-C actually exits the Virtualbox out of its full-screen mode instead of copying text. As someone who loves shortcut key and types pretty quick, it’s driving me a bit crazy. I pretty much do a command-key shortcut every 10 minutes when I started using Virtualbox, then when I do return to my Mac OS, I would do the opposite! (As in using control-key for shortcut every 10 minutes). For the first time in my life, I curse my ability to type so quickly…