Recently in Misc. Category

What I Really Want Out of Web 3.0

| | Comments (0)

Tagging. It's all the craze now. It's helpful too, as it lets me select and find what I want out of an incredibly large amount of data. Tagging is the future!

So is Web 3.0. And this is what I want out of it:
What I Really Want Out of Web 3.0

(Right-click, View Image to enlarge, or whatever it is that you crazy IE users use. Or, heck, just click it.)

Driving in police cars is fun. No, really.

| | Comments (0)

I mean it. Driving in a police car is fun. Note the phrasing: driving in a police car is fun; being driven in a police car is not. Why is this?

I was driving to work today when I noticed a car with heavily tinted windows pull up behind me. In my general paranoia, I figured this was an undercover police car (fortunately, it wasn't). This then in turn reminded me of a story my uncle had told me semi-recently.

My uncle worked in a rather large car shop. The local police department would bring their cars down when something broke, when it needed a tune-up, or whatever. Likewise, for most of the cars he had worked on, he took it for a short (15 minute) drive to make sure everything worked as it should. He'd test out the brakes, made sure everything was shifting properly, etc.

Likewise, a civilian legally driving a police car can be incredibly fun. For example:

  • Randomly switching lanes and then tailgating a car.
  • Driving 55mph on a 65mph freeway, just to see who would pass.
  • Changing from lane to lane at varying speeds.
  • Finding someone driving relatively fast, and pull up alongside them. No eye contact, no lights, no nothing, just pull up alongside someone speeding.
  • Accelerating to the speed limit, and then slowly drop in speed.

It's not like he can pull anyone over. It's not like he's stolen the car; he has a legal right to it. So why not enjoy it? :)

Manually re-writing the MBR

| | Comments (0)

The other day, I resized my NTFS partition from taking the entire disk, and made some others: a 100MB partition at the beginning of the drive, and then 15GB at the end. The 15GB was split into 1GB/14GB. I'm sure that most of you can imagine what each partition was for: /boot, swap, and /.

I popped in my gentoo livecd, fired up gentoo-nofb, and went to work installing gentoo. Firing up fdisk, I saw that my partition table was out of order. And hey, it was! I had only resized my existing partition, not made additional ones. Likewise, the large NTFS partition sitting in the middle of the drive had partition ID #1, and the 100MB before it had ID #2. "Why not" I said, and told fdisk to fix the partition table order for me. Which, hey, it did, and did perfectly.

Recall from previous posts that Window's boot loader (NTLDR) is a little finicky. It was installed to the first partition, likewise, when starting Windows, it tried to load files from partition one.

Which, was now 100MB in size and formatted ext2.

To complicate the matter, I had left my CD binder at a friend's house the day before, preventing me from popping in the XP CD and hitting the "Repair" option. I also needed to boot into Windows (hey, don't judge me!), and by fixing the problem, I had broken it. I recall a small bit of IRC chat that occured while I was trying to fix this:

him: iirc, fdisk has a fix partition order option, maybe that'll help?
me: That's what I used, I need it in it's broken state to work
him: oh, okay.

So, fdisk is not of use, and I need to change my partition table entry. Luckily, the MBR (which houses the partition table) is only 512 bytes in length, and the partition table is an even smaller subset of that. So, what do you do when you have a linux livecd to repair your partition table?

Google, `dd`, and `echo`.

  1. Google the partition table format and location
  2. Use fdisk to dump the current partition table (it dumps it so that I can see offsets, enter fdisk and then press 'x', 'd' to see what I mean)
  3. Backup the current MBR (dd if=/dev/hda of=MBR.bin bs=512 count=1; scp MBR.bin user@host:~/)
  4. Use a combination of `echo blah > file` and `dd if=file of=/dev/hda bs=1 count=1 seek=blah` to change the partition table order.
  5. Reboot and hope that it works at all.

And guess what?

It worked, first try.

I might have gone absolutely nuts once I saw that it worked.

I wound up deleting the initial /boot partition, and resizing the
NTFS partition to take that initial hundred megs. I'm booting without a /boot partition, but hey, it isn't exactly required.

Of course, an hour later, I realized that I could have just:

  1. Deleted the /boot partition
  2. Deleted the swap partition
  3. Made a new /boot partition, numbered one, after the number two (NTFS) partition
  4. Re-fix the partition order (again)

Oh well. At least I can say that I've manually re-written an MBR now using echo and dd.

Bad idea: changing hostname/domainname while X is running

| | Comments (0)

For anyone who thinks to themselves, "You know, changing the domainname is fine while the system is running [X]", think again.

Change the domainname while X is running causes X to die in horrible, horrible ways.

Taking your glibc compile along with it. Oops. So much for the past half-hour.

MBR Hack and updated DNS hole

| | Comments (0)

Heard of the windows boot loader at all? If you haven't, it's called NTLDR. It actually does a really good job of being a boot loader, too, but with on exception. It MUST reside on an NTFS partition that is the first partition on the first drive that the BIOS sees. No exceptions. Windows expects this also, and likewise, won't boot unless it's booted like that. This kinda sucks for people who want to dual-boot windows and linux, because you have to either repartition to install linux on the first drive, or live without it (gasp). You can't install linux on a second drive, and use any linux boot loader to boot windows on the first hard drive. It just doesn't work.
Solution? The MBR hack.

Windows is installed on /dev/hda1. Linux /boot on /dev/hdb1. For the hack, I recommend grub, though I haven't tried it with grub, only lilo. Why grub is recommend will become quickly apparent.

With the above situation, there is no way to boot windows up from linux. Likewise, if you swap hda with hdb, windows still won't boot. So, once you have your linux boot loader installed on hdb, you image the MBR (master boot record) to a file, copy that file to the windows partition, and add an entry to C:\boot.ini to reference it. Let me put it in a little more verbose way:

dd if=/dev/hdb of=linux.mbr bs=512 count=1

cp linux.mbr /mnt/windows

echo C:\linux.mbr="Linux" >> /mnt/windows/boot.ini

And you're done. When the computer boots up NTLDR, you'll have a "Linux" option that'll pop up grub/lilo/whatever :)

And in case you didn't catch why grub is recommended: if you use lilo, you have to update the linux.mbr file every time you upgrade your kernel... which is typically stored on NTFS. Sure, the file size won't change, but it's another manual step that could be avoided easily with grub.

On another topic, I visited the University of Utah friday, for orientation (which they actually mis-scheduled me for, so I'll go again later). After 30 seconds of poking around, their network allows anything outgoing :53/udp to anywhere in the world. Oops.

About this Archive

This page is a archive of recent entries in the Misc. category.

Linux is the previous category.

Programming is the next category.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.0