Monday, May 12, 2008

Up to Date

I've used Debian for a bit and really love the package manager. However, I'm still learning how these repositories work. My first attempt at updating my system gave me an error.


~# apt-get update

... http://ftp.debian-ports.org ... NO_PUBKEY found ...


Basically each package in the repository is signed using GPG. When apt tries to use the repository, it must have the public GPG key on hand to authenticate it. The list of repositories apt uses can be found in /etc/apt/sources.list. I read that apt could ignore this, but didn't seem like a good practice to start.

To read up on how this authentication works, I browsed a well-written article "Securing Debian Manual", which explained how Debian handled this [1]. It mentioned how to add the key, but also said that finding the public key for a given site wasn't exactly uniform across repositories. After digging around in http://ftp.debian-ports.org for a while, I went to the IRC channel and just asked. I got a response instantly. He/she posted a link to http://www.debian-ports.org/archive, which I wouldn't have found for a quite a while. It gave me two commands to download and add the key.


~# gpg --keyserver hkp://subkeys.pgp.net --recv-keys 43229C06
... (a bit of text)
~# gpg --export 43229C06 | apt-key add -
... (a bit of text)


I wasn't sure if it worked or not since I am inexperienced in doing this. I saw the phrase "gpg: no ultimately trusted keys found", which I thought my be an error. I googled the error, and was learned that by default, gpg is setup to not ultimately trust any keys and in this case it didn't matter. I'm still not sure what the rigorous definition of "ultimately trust" is, but I took their word [2].

After running apt-get update, apt updated with no mention of NO_PUBKEY, so I guess it worked.

Thursday, May 1, 2008

Network Fixed

One thing that appeals to me about open software movements like the Hurd is the team development. IRC is a traditional method of communication on the internet--something like a very basic chat protocol. I have used IRC several times before, but usually with poor results. Often the channel is completely empty or no one wants to talk about anything related to the channel topic. But like bug-hurd, I have enjoyed the feedback from the Hurd group.

On this particular night, I jumped on and asked some questions about the e-mail I sent assuming most people on the IRC channel also followed the bug-hurd mailing list. After getting a few e-mails back saying that it worked fine for them, I found two people that gave me a few ideas of how to fix it. First, they never used any flags for qemu--the default NIC always functioned fine. This led us to believe my OS (Ubuntu 7.10) provided some wacked configuration of qemu.

Just for kicks, I ran it through kvm with no flags. I started out checking to see if my eth0 was established.


~# devprobe eth0
eth0


That's a good start. Whatever configuration kvm uses obviously didn't need any NIC flags. Starting up pfinet didn't give any errors either. Usually I use ping to check my network connection, but since that was installed yet, I tried a simple apt-get update. After a few seconds, the files started rolling in. Network connection!

I thanked the two guys on IRC and posted my solution on bug-hurd. I figure the next time someone has that problem, it will be documented in some mailing archive (if it wasn't already...).

Playing with Debian GNU/Hurd

Debian GNU/Linux is a great operating system. Debian provides deb package management, which IMHO is the best of any distribution of Linux. Debian also packages its operating system using GNU Mach as the kernel and runs the Hurd to manage the system. It was recommended by several sites that one use Debian GNU/Hurd, if you're a beginner. I am.

First, I decided to run Debian GNU/Hurd in qemu. For those not familiar with qemu, it's a x86 hardware emulator. I chose to use an emulator as I'm not sure what hardware I had sitting around that was compatible with GNU Mach and GNU Hurd. Debian GNU/Hurd actually provides a image file specifically for qemu, so it's easy to just jump right in. I just downloaded debian-hurd-k16-qemu.img.tar.gz from the site and untarred everything. Then I just ran qemu using this as the hard drive.


~# qemu -hda debian-hurd-k16-qemu.img


After running this command, I see the GRUB menu provided. I chose the first option


After booting, I login as root (login root) and I'm running the GNU Hurd. Woo hoo! Of course the first thing to do is configure networking. Following the guide at http://www.bddebian.com/~wiki/hurd/running/qemu/,
I try setting up the network.


~# settrans -afgp /servers/socket/2 /hurd/pfinet -i eth0 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0
/hurd/pfinet: eth0: (os/device) no such device
settrans: /hurd/pfinet: Translator died


Okay, now I was totally lost. They didn't mention this in the guide. First, I joined the Bug-Hurd mailing list. This mailing list is not directly related to the Debian project, but is found on the GNU Hurd website under Getting Help. After a quick description of my problem, I received an answer within several hours (I have always received feedback from this mailing list within 24 hours). Someone told me how I could find the problem. First, see if the ethernet card was detected.


~# devprobe eth0
~#


Alright, that was the first problem. The network card wasn't detected correctly. To figure out what exactly devprobe does, you can type: devprobe --help. Just FYI, the GNU Hurd doesn't use man pages at the moment--not sure if they ever will. Most programs, however, can provide usage information by passing the --help. After sending this information back to the person, who responded, he chewed me out for not replying to the whole mailing list. This is just another thing I've learned along the way. They don't like having private conversations. For one reason, problems like this that are sorted out on the mailing list are archived and can be searched later by people having the same problem. Thus problems are solved once and we're not reinventing the wheel. Don't feel bad about asking stupid questions (after looking through the documentation for a reasonable amount of time).

I was then told that my Linux distribution at the time, Ubuntu 7.10, used a version of qemu with a default NIC that was not supported by the Hurd. He supplied a flag to qemu that would use a supported NIC.

I now start qemu with the following:


~# qemu -hda debian-hurd-k16-qemu.img -net nic,model=ne2k_isa


After booting the Hurd now, running devprobe gives me the following:


~# devprobe eth0
eth0


Success! A NIC card has been found and assigned as eth0. Running settrans no longer gives an error.


# echo "nameserver 10.0.2.3" > /etc/resolv.conf


Supposedly that is all it takes to get network up and running. I do a quick ping of some website to see if it works.


# ping www.yahoo.com
-bash: ping: command not found


Drat! I find out through seaching ping does not come with the install and must be manually added. So I try installing a package.


# apt-get install lynx


I figure running lynx should tell me if I have internet access. The system recognizes the package and goes to fetch it. It seems to have trouble connecting to ftp.uk.debian.org. I ping it from my Linux distro and see the site is in fact running. I e-mail bug-hurd and decide to take a break. But the Hurd is now booting in qemu!