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…

Wiking Upstart during Linux homework reading. Wiki is awesome!

In my current Linux Admin class, the professor is trying to adjust his notes to the new Redhat 7 standard. One of the biggest confusion is Upstart and Systemd. He write his own notes for us, and he has good writing and teaching skills, but to go back and change everything… it is not a job I envy. For students, it’s hard enough to remember which term and system is for 6 (the old version), and which one is for 7. Just now, I found myself googling Upstart for the Nth time trying to remember if it’s 6 or 7 (6, Amy, 6).

Interestingly, I noticed a wiki page this time and opened it. I found the article quite informative for my curious side. Turns out Upstart also replaced another init daemon, much like systemd that is now replacing Upstart itself (Which, now that I think about it, duh. Considering the numerous version of Redhat and even more numerous version of Unix?  Just one init daemon? Nah.) It was replace and improved the previously traditional init process, so that computer can respond to events asynchronously instead of synchronously. It was first included in Ubuntu 6.10 release and replaced sysvinit. It is used in Chrome OS (wait, does that mean my Nexus tablet uses it?) , was considered by Debian (who eventually went with systemd), and replaced sysvinit in Fedora 9 then was replaced by systemd in Fedora 15.

Hmm, I don’t think I will get Upstart and systemd confuse now. Although, on a totally irrelevant note, why is Upstart the only one to get capitalized?

I clearly needs more coffee.

Fedora: Testing Testing

Ok, so today is the first day I am exploring Fedora GNOME after my installation during the Open Source event. Being a Linux student who was also studying my reading, I decided to run some of the command in my reading and compare it for the fun. Besides, that way I know which directory path exist in Linux but not in Mac.
Note that reading of the read was runlevel and subsystem, and that it will probably take me three tries before I understand the reading…:
Fedora
Macbook
pwd
/home/amychan331
/Users/amychan
ps
PID:1915 TTY:pts/0 TIME:00:00:00 CMD:bash
PID:2401 TTY:pts/0 TIME:00:00:00 CMD:ps
PID:784 TTY:ttys000 TIME:00:00:02 CMD:-bash
ps -u root | wc -l
86
61
ps -e | grep ‘d$’ | wc -l
33
73
who -r
run-level 5
. run-level 3
/sbin/runlevel
N 5
No such file or directory
/sbin/service —status-all
netconsole module not loaded
Configured devices: lo enp0s3
Currently active devices: lo enp0s3
The VirtualBox Additions are not currently running.
Checking for VBoxService …not running.
No such file or directory
cd /etc/rc.d
Blank. I am in!
No such file or directory
ls rc?.d/*rsyslog
ls rc2.d/S*{network,sshd}
No such file or directory
N/A
grep chkconfig /etc/init.d/rsyslog
No such file or directory
No such file or directory
  • Their home directory is different, as expected.
  • What on earth is “-bash” in ps?
  • I found it interesting that Fedora is running more ps than its local sister.
  • Runlevel is 5 for Fedora and 3 for Mac. Let see… my text says that Fedora being means 5 it starts the window manager, X Window. *Nods* Makes sense. It is the VM. Running /sbin/runlevel in Mac returns a “No such file or directory” error message, but then Mac is not Linux after all. who -r, however, does work. It returns 3, which means that… full multi-user mode, but interface is text-only. Hmm… text-only? Not sure what that mean. I will have to look it up later.
  • Fedora has less than half of running daemons than Mac, as expected.
  • Running an inquiry about subsystems status in Fedora returned text, mostly about systems that are not running. Mac, once again, returns “No such file or directory”.
  • Once we start to get into rsyslog, error keeps popping up. We have the rc.d directory in Fedora, but the naming system inside rc.d directories is probably different.

Of course, all this observation was made without any regards as to what version I am on! The notes my teacher give was for Redhat 6.5, and here I am comparing it to Fedora and Mac OS. Still, it was fun to do. Once I am not so busy with my classes (full course this semester), I would like to research the corresponding commands and file path in Fedora. For now though, I am mostly playing around to see what is in common and what is not.