Categories: Linux, Applications, Debian, Ubuntu

11/12/06

Permalink 08:30:39 pm, Categories: Linux, 18 words   English (US)

Apache vs strace

strace is the swiss army knife for sysadmins. Here is a nice article on debugging Apache with strace.

11/05/06

Permalink 12:56:33 pm, Categories: Linux, 131 words   English (US)

Doom on your ipod

doom

Here's an interesting interview with the ipodlinux guys. They are doing some amazing work:

Unfortunately the bootloader which was previously a wealth of information was unavailable and so we had to revert to picking through, literally, millions of lines of assembly to obtain any information on the new hardware. In the end we found enough to build a simple program that could generate two different tones using the inbuild speaker (the clicker, or piezo). Using this code one of our enterprising hackers played a tune of ones and zeros representing the firmware which was then recorded in a custom-built recording studio and then decoded the tune to obtain the original firmware image! From there it was still another few months painstakingly going over assembly dumps to reverse engineer the new CPU.

10/29/06

Permalink 08:41:43 am, Categories: Linux, 44 words   English (US)

seq

I can't believe in all my syadmin I've never used 'seq'. Pretty cool for bash for loops:

m=`seq -f "host%02g" 1 20`
echo $m
host01 host02 host03 host04 host05 host06 host07 host08
host09 host10 host11 host12 host13 host14 host15 host16
host17 host18 host19 host20

08/20/06

Permalink 10:52:37 am, Categories: Ubuntu, Apple, 1791 words   English (US)

Ubuntu on my Powerbook

This weekend I decided to take the adventure of installing Ubuntu 6.06 (Dapper Drake) on my Powerbook G4. I wasn't sure what to expect as to hardware support, and learned alot along the way. I am writing this from Firefox in Linux on my Powerbook though, so it's been somewhat successful :).

I've been wanting to have a good Linux box to hack on. I did install Xubuntu on an old Thinkpad, but it's falling apart and the battery lasts a whopping 10 minutes. I've heard some good things about Ubuntu on PowerPC, so decided to give it a go.

I have OS X Panther on my Powerbook. I have never had the chance to upgrade to Tiger. I have a 70G drive and had plenty of free space, so my first task was to resize and repartition. Now I'm pretty familiar with doing this on the PC, but not on Macs. I have been using SuperDuper for backups to an external USB drive, so I was set for backups. I actually wouldn't mind it if my Panther partition got trashed, as it would give me an excuse to upgrade to Tiger. In the end nothing bad happened, so I was still luckily (or unluckily) stuck with Panther.

Back to resizing. Out of whim, I tried booting the Ubuntu CD to see if it had an easy resizing tool like it did for Intels. Nope, it just wanted to erase my whole disk. I read that it is possible to do resizing with free tools, but it was late and I didn't feel that brave. I decided to purchase and download iPartition, which seemed similar to Partition Magic. Of course, it couldn't resize the live running boot partition, so I needed to boot something else. The manual first recommends trying to boot off of a backup drive, and if that doesn't work to use the boot CD creator tool that comes with iPartition.

Obstacle #1: try to boot my backup drive via USB

I thought this would be a good test of by 'backup strategy.' I plugged in my external USB drive. After some digging around, I found out that you can have the Mac scan for bootable media at powerup by holding down the Option key while powering on. This brings up a nice GUI boot screen and showed my USB drive! I selected it, and after some crunching it eventually came up with a no smoking sign and didn't boot :(. Oh well I guess my backup isn't that cool. It does have files on it though, so I am backing up something, just not something that will boot. I tried some other hackery mentioned on the web, by booting into the Open Firmware by holding down the twister-inspired key combination of Command-Option-O-F while powering up, and changing the boot-device with setenv. I swear, Apple is trying to give me arthritis. Anyway, no luck with that, and I later realized that setenv actually writes the NVRAM, so I had to remember the old setting and undo this. Fuck booting from my 'backup.'

Next I created an iPartition boot CD with their CD creator tool. I booted it (again with the Option key held at boot to select CD), and successfully shrunk my OS X partition by 10G and left the free space. This operation was done so fast I thought it didn't do anything. I booted back into OS X. It booted ok (whew), and I verified in Disk Utility that the partition shrunk by 10G. So far so good.

Now on to installing Ubuntu. I booted the CD. I wanted to see if the Airport wireless worked, so went to System -> Administration -> Networking. It detected the Airport but failed to configure it, and I remember seeing boot messages about firmware errors. I did some research beforehand and it turns out the driver is not open, and it was up in the air whether it would work or not. I figured I could fool with it after installation. I grabbed a wireless card from my Thinkpad, and voila that worked like a charm in my Mac. At least I would have internet access while I debugged the Airport driver later.

I ran the installer, and specified for it to use my free space. The text that is shown before making the partition gave the impression it was going to wipe my HD, i.e. it was not obvious it would use my free space. I thought whatever, if it trashes it that's ok. It didn't (whew), and after a 40 minutes or so, I rebooted. I was given a LILO-like boot menu with my OS X still there. I tested OS X, and that still worked (whew). Next I rebooted into Linux! It was speedy and worked like a charm. My wireless was working, but with the PC card, not with the internal Airport.

Obstacle #2: getting Airport to work

I started searching the discussion boards for Airport support. Now Ubuntu forums are interesting. They are mostly filled with non-Linux users seeking help. That's cool and all, but it just makes my searching more difficult with crappy results. I finally found this guide which was generally what I did except for the part about installing 'Network Manager', whatever that was. I figure I should be able to use the Network setting app that is already part of Ubuntu. I found some other good docs, the latter being very helpful. Eventually I got it working whenever I brought up the interface in the Networing app, but it would take a very long time, and would never work at bootup. From those docs, I added the following to /etc/network/interfaces:

auto eth1
iface eth1 inet dhcp
  pre-up ifconfig eth1 up
  pre-up iwconfig eth1 rate 11M
  pre-up iwconfig eth1 ap any
  wireless-essid myssid

I rebooted and voila, Airport works! No more PC card needed. Everything, even sound, was working. But after using Ubuntu for some time on the Mac, I realized a big annoyance...

Obstacle #3: How the fuck do I right-click?

I realized early that Ubuntu is not very usable with a 1-button mousepad. After some searching I found out that F12 (or maybe it was F11, it's not working now) was mapped to right-click. WTF, there is no way in hell I'm using any F key for right-clicking. In OS X I can do it by ctrl-clicking, so I should be able to do it in Linux too. I came across this posting about installing mouseemu. I did so, and added to /etc/default/mouseemu:

MID_CLICK="-middle 125 272" # Command key + mouse click
RIGHT_CLICK="-right 29 272" # Control key + mouse click

Once I did that and restarted mouseemu (sudo /etc/init.d/mouseemu stop/start), I was able to right-click with ctrl-click. Yay! But then after realizing that I have to use Alt-Tab instead of Command-Tab to switch windows, I was annoyed further because the Alt key on the Mac is proven to increase the risk of arthritis and why the hell do I have to remember a different keystroke for Linux when Command-Tab works in OS X?

Obstacle #4: Swapping Alt with Command key

I found somewhere on the web that xmodmap can be used for this. I created a ~/.xmodmap file that contained:

keycode 115 = Alt_L

One thing very cool is Ubuntu will notice your .xmodmap and ask you to load it on next startup. There was some discussion on whether to use .xmodmaprc, or .Xmodmaprc, or .Xmodmap, or .muhahhayouWillneverFigureitOutrc. But I will tell you .xmodmap works :).

After booting back and forth between OS X and Linux, I realized that the boot manager was defaulting to Linux. I didn't want that. I wanted OS X by default. Such began my journey into yaboot, the LILO for Mac's.

Obstacle #5: boot OS X by default damnit

It was a short journey. I edited /etc/yaboot.conf and added after the macosx= line:

defaultos=macosx

This is described in 'man yaboot.conf'. I rebooted, but whaddaya know, it still booted into Linux by default. I was optimistically thinking this would be like GRUB, where I didn't have to run anything to update the boot sector. Turns out I need to run ybin, which copied my changes in. I didn't know what arguments to give, so being inspired by 'lilo', I just ran 'ybin.' That worked, and I was booting OS X by default. Yay.

Now I worked a bit more in Ubuntu and realized that I needed to copy some files off of my OS X partition (namely, my SSH config file).

Obstacle #6: Accessing my OS X partition from Linux

I had no idea if OS X's HFS+ partition was supported in Linux. I found this document which states that it is, and the fs type is hfsplus. However, 'man mount' only shows hfs, not hfsplus. I stuck with hfsplus anyway. I found this post about a user mounting his partitions. All I wanted to do was copy a file, and I'd be pretty pissed if Linux screwed up my OS X partition accidentally. I decided to mount it read-only. But what's my OS X partition? I easily found that from the macosx= line in /etc/yaboot.conf, which was /fev/hda3. dev has been replaced with fev to protect the innocent. For some reason either my webhosting provider or blogging software won't let me post dev. I ran the following commands:

mkdir /tmp/mnt
mount -o ro -t hfsplus /fev/fda3 /tmp/mnt
cp my file
umount /tmp/mnt

At this point there are only a few things left that annoy me. The mouse sensitivity seems quite different from OS X. I tried adjusting the acceleration settings, but it still just seems wierd. My fan seems to be constantly running, and my guess is Linux is not as nice on the CPU as OS X. Finally, cutting and pasting with a 1-button mouse in Linux is a bitch. Why do I have to shift-ctrl-anything to copy text in Terminal anyway? Why can't I just select and have it auto-copy? Maybe there is a way, but I haven't figured it out yet. Maybe it is time for me to get a real mouse and keyboard.

The fn, ctrl, alt, and command keys on the Mac cause me no end of grief. I constantly forget which incantation to use to switch workspaces, switching firefox tabs, closing windows, closing firefox tabs, etc. But that's more of a rant towards the Powerbook keyboard in general. Also forget about Flash and other plugins, they are nonexistent for PowerPC Linux.

In general, it was a fun adventure to figure out how to do things and cool to have Linux on my Powerbook. It runs beautifully and I'm sure I'll be hacking on it for some time.

08/15/06

Permalink 10:04:03 pm, Categories: Ubuntu, 718 words   English (US)

Xubuntu: alles wunderbar

I have this pretty old IBM Thinkpad iSeries Type 1161-260 with a Celery processor. It's been sitting in my closet for about 6 months. I had attempted to run Linux on it at one point, but the Cardbus pcmcia interface on this laptop did not have good support so essentially no pc card worked. I spent alot of time hacking at it and eventually I gave up and left Windows XP on the system.

This weekend I thought maybe Linux these days has better support. It's a low end laptop with 192MB RAM. I wanted to run Ubuntu, but needed a lightweight version. That's when I found Xubuntu, a lean Ubuntu. I had about 3G free on my windows partition (a whopping 5G drive). I guessed correctly that Ubuntu must have a partition resizer that works well.

I downloaded the Xubuntu ISO on my Mac, burned it, and booted my Thinkpad. After some crunching, it came up to X with a live-CD like distro and an 'Install' icon on the desktop. Cool. I brought up a terminal and did an 'ifconfig -a' expecting to see only my loopback device. Lo and behold, I see an eth0. I think to myself, this can't be my wireless card. I then went to the graphical network configurator and saw that it detected my wireless card. A few clicks and I saw the open wireless networks (I keep mine open too :). I was able to join, startup Firefox, and browse. My jaw dropped. Ubuntu out of the box on its installation live-CD has support for my wireless card that I could never get working for the life of me? I was very impressed. I had to start the installation.

After a long time I eventually had Xubuntu installed. I rebooted and found out that now my wireless card wasn't detected. Poking in /var/log/messages I saw:

cs: warning: no high memory space available!

Now this shit looks familiar, the same crap I had ages ago that I couldn't fix. So continued my hacking. I thought maybe some module loaded at full install and not in the live-CD was conflicting, maybe USB. So I sought to disable USB. Now times have changed and this is not as easy as just commenting it out in /etc/mod* files. I found /etc/modprobe.d/aliases and began fiddling with it. But for the life of me I could not get USB disabled. Even when I removed the kernel module file it would still get loaded!

This really baffled me. I thought maybe USB is compiled into the kernel. But that wasn't the case because I see it in a 'lsmod'. After much searching I realized that now distros use an initramfs, which is like an initrd but I believe you can store more. I looked at the current initramfs used during boot (via /boot/grub/menu.lst), which is a fun gzipped cpio archive:

mkdir /tmp/a
cd /tmp/a
gzip -dc /boot/initrd.img-2.6.15-26-386 | cpio -i

And whaddaya know, the usb kernel modules are stored in there. I found out about mkinitramfs (like mkinitrd), made a new one without usb, rebooted. But still my fucking wireless card didn't work. I went to sleep and decided to try again later. I was determined though because the damn thing worked on the live-CD, I have to be able to get it working installed! That would be really lame if I gave up now.

I spent some time searching, and found some references about pcmciautils replacing pcmcia-cs, and /etc/pcmcia being moved to /usr/share/pcmciautils. On my system /etc/pcmcia was empty. I booted the live-CD again and noticed that /etc/pcmcia had lots of config files, importantly a config.opts. On my installed system, this file was in /usr/share/pcmciautils. It contains info on memory regions to probe.

Then I found this German posting that seemed to be recommending copying config.opts to /etc/pcmcia. My 2 semesters of German came through, and I knew that 'alles wunderbar' meant something good. I copied the file, rebooted. Voila, my wireless card worked!

What a pain and such a simple fix! It's really lame this file is not automatically copied there, but I'm glad to have gotten it working. Where there is a will there is a way.

08/01/06

Permalink 08:31:07 pm, Categories: Linux, 158 words   English (US)

I need a PC

So I've been using a Mac for some time now. In fact I haven't had a PC at home in over a year. And now I miss it, yes I miss the PC.

Why? Obviously I've found the Mac superior than a PC in terms of usability. However I feel that Apple is not a very open source developer friendly environment. I don't know how to describe it. If I want to do development on Mac, I'd want to use the Cocoa stuff, or Applescript, or whatever. But this is not as fun as doing true Linux development. The open source developer community is missing from Apple. I enjoy development on Linux better than the Mac.

I hack on Linux at work, but at home I have no Linux box, which sucks. I'd like to maybe get an Ubuntu box at home as a desktop. Now I wouldn't give up Mac of course, just need the Linux fix.

<< Previous Page :: Next Page >>

Viraj's Weblog

Donate to keep this site going!

Amount USD $

< Previous | Next >

October 2014
Mon Tue Wed Thu Fri Sat Sun
<<  <   >  >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Search

Categories


Misc

Syndicate this blog XML

What is RSS?

powered by
b2evolution