Re-installing Grub when MS Windows Destroyed It

I have now done it a couple of times, but always have to look it up. Here are the steps to re-install Grub from a live Ubuntu CD, when you have Windows and Linux on your hard disk. You must be root, or run these commands with sudo. Change /dev/sdaXY accordingly.

  1. mount /dev/sda2 /mnt
  2. mount /dev/sda3 /mnt/boot, if you have a separate boot partition
  3. mount -o bind /dev /mnt/dev
  4. mount -o bind /sys /mnt/sys
  5. mount -t proc /proc /mnt/proc
  6. chroot /mnt /bin/bash
  7. grub-install /dev/sda

Above commands are from method 3 in GRUB (in German).


ext3 vs. ext4

Recently I installed an additional SATA drive on my Lenovo laptop. Without much ado I formatted the drive to ext4. Unfortunately, I quickly realized that the hard drive is spinning almost twice a second. My first drive on the laptop is also formatted with ext4, so using ext4 was a natural choice. A Google search revealed that I am not alone with this problem (USB Drive Blinks Constantly on EXT4 Format), and pointed out that formatting with ext3 can cure the problem. Which it indeed did.

The morale is: Newer is not always better.

OpenGL Program: Earth with Moon Rotating around Sun

My other son had a practical training at Fraunhofer IGD. He wrote an OpenGL/C++ program in Windows where one views the earth rotating around the sun, thereby with its rotating moon, see picture below.



I ported this program to Gtk/Linux. You’ll find the code in openglSunEM.c. The link between Gtk and OpenGL is realized by GtkGlExt. On Ubuntu you have to install libgtkglext1-dev.

openglSunEM can either be called with or without textures using command line flag “-t”. Typing ESC stops the program.

The main geometric transformation is handled in drawGLScene(): draw sun, draw earth, draw moon (which rotates around the earth, which in turn rotates around the sun). The speed of rotation can be increased or decreased with the arrow keys (GDK_KEY_Up, GDK_KEY_Down), one can zoom in or out (GDK_KEY_I, GDK_KEY_O).

The whole animation can be rotated like an arcball, its implementation being in ArcBall2.c.