My pain is your gain: Installing Windows after Ubuntu and the joy of GRUB2
Do yourself a favor and never do this if you have other things on your mind. The information is sparse and not very well written, so I'm going to fix that right now. Today I had to install Windows XP on my wife's laptop because some company that makes software that she needs decided that it would be too easy to allow people to use virtual machines to run their software. When I installed Ubuntu on the machine a few months back, I left a 30GB partition at /dev/sda1 to put Windows on there at a later date should she need it. Well, she needed it and I installed it. Once installed, I needed to get GRUB back. If you haven't done this with GRUB2, consider yourself lucky. Here's the easiest way to do it.
- Boot to the LiveCD Desktop (Ubuntu 9.10 or later).
- Open a terminal by selecting Applications, Accessories, Terminal from the menu bar.
- Determine the partition with the Ubuntu installation. The fdisk option "-l" is a lowercase "L".
-
sudo fdisk -l
If the user isn't sure of the partition, look for one of the appropriate size or formatting.Running sudo blkid may provide more information to help locate the proper partition, especially if the partitions are labeled. The device/drive is designated by sdX, with X being the device designation. sda is the first device, sdb is the second, etc. For most users the MBR will be installed to sda, the first drive on their system. The partition is designated by the Y. The first partition is 1, the second is 2. Note the devices and partitions are counted differently.
-
- Mount the partition containing the Ubuntu installation.
sudo mount /dev/sd''xY'' /mnt
Example: sudo mount /dev/sda1 Note: If the user has a separate /boot partition, this must be mounted to /mnt/boot
- Run the grub-install command as described below. This will reinstall the GRUB 2 files on the mounted partition to the proper location and to the MBR of the designated device.
sudo grub-install --root-directory=/mnt/ /dev/sdX
Example: sudo grub-install --root-directory=/mnt/ /dev/sda
- Reboot
- Refresh the GRUB 2 menu with sudo update-grub
That doesn't look that difficult, does it? Yeah, well, it was a pain in the ass to get to that point. If you notice, I highlighted the example for #5. If you do what I did and try to sudo grub-install --root-directory=/mnt/ /dev/sda1, then you're going to end up getting something that looks like this:
grub-setup: warn: Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea.
grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and its use is discouraged.
You don't want this. You're going to try to force it and you're going to fuck something up. Make damn sure you do it right. Let's look at my particular situation.
My setup looks like this:
/dev/sda1 is NTFS
/dev/sda2 is ext4
/dev/sda3 is swap
I would have to enter the following commands:
sudo mount /dev/sda2 /mnt sudo grub-install --root-directory=/mnt/ /dev/sda
After knocking that out, it should tell you that it's been successful and all you now need to do is reboot! It took me 5 different times to get this damn thing back. I ended up bombing out the Windows MBR by installing GRUB on it, which made me have to do a fixboot/fixmbr from the windows recovery console and start all over again. Once I was back to square 1, following the commands above got me done in 5 minutes.
I hope this helps you!
-Greg


Ubuntu + Netgear WGPS606 = Wireless printing!
Today I decided to upgrade my Ubuntu installation to 64bit. I've been running the 32bit version because there was no solid version of flash for the 64bit. Well, after a little research, I found Adobe's alpha version of flash for 64bit Linux.
I didn't have a printer setup in my last installation because I didn't use Linux for any kind of printing. I want to get into using Linux for more and more things, so I figured it was about time to setup my printer. I have an HP PSC 1510 All-In-One that is upstairs in my office and it's plugged into a Netgear WGPS606 Wireless print server. I have no cables running into the office (stupid apartment!), so everything up there is coming off this print server/wireless bridge. A little bit if digging and I finally figured out how to setup this print server in Ubuntu. Follow the directions below and it works like a charm. I know this had nothing to do with Cisco networking, but neither did my article on Creating a transparent signature stamp in Adobe Acrobat.
Before you get started, make sure you have the latest firmware on your print server. You can find it here. The latest firmware is 1025 as of today.
- Go to http://localhost:631
- Click "Administration" in the header.
- Authenticate with user: root, password: root's password if you are asked to.
- Click "Add Printer" in the Printers section.
- Fill in at least "Name" and click "Continue"
- In the Device Dropdown box, select "LPD/LPR Host or Printer" and click "Continue"
- In the Device URI box put "lpd://<your_wgps606_ip>/L1" or "lpd://<your_wgps606_ip>/L2". L1 is for the first printer, L2 is for the second. In my case the full URI is
lpd://192.168.1.5/L1. - Select your printer's make and click "Continue"
- Select your printer's model and click "Continue"
That's all it takes! Shoot a test page to the printer to make sure that everything is working and you should be done! If you have more than one printer plugged into the print server, simply run through the process again and put the other port number in the URI box in #7.
-Greg