Rezaf Diary

I'll write about my daily life, as a PhD Student at the University of Illinois. I'll put some photos from my town, Urbana, and some music.

Sunday, December 09, 2012

60 hours with Linux


Hi everyone, loooong time no see :-) So a few things happened since my last post here. I finished my PhD studies and finally graduated. I spent maybe a quarter of last year traveling. I started playing the Persian setar, and maybe, only maybe, I might be on the path to start a startup company. Anyway, this post is not about the past year or two, it is about the past 60 hours, where I spent wrestling with Linux two separate Linux installations (and a total 8 hours of sleep).

Exhibit A:
The first one was setting up a modern Linux variant, Ubuntu 12.10 on an up-to-date PC, one which I bought components for in this past black-friday. We are talking Intel core i7 3770K, 16GB of memory, NVIDIA GTX480 (which I got from NVIDIA as a gift in the last GTC conference), SSD, etc. The intent here was to setup a CUDA 5 development station. I wrestled with installing 12.10 first, then 12.04 and finally only got everything to run under 11.10. The problem turned out to be assumptions, and lack of enough documentation. See, I first tried to install NVIDIA drivers downloaded directly from NVIDIA website on Ubuntu 12.10 and 12.04, but for whatever reason it didn't work. Googling around, I found out that ubuntu has now packaged the latest drivers (310.19) in their repositories, and it's just a matter of a simple "sudo apt-get install nvidia-current". But but but, turned out the CUDA 5 toolkit assumes the libraries are not in /usr/lib/nvidia-current, where the ubunutu developers have decided to put them. More over, the CUDA 5 make file structure has changed, and instead of a including a common.mk file, each make file is not independent. So I would have to modify every single SDK sample by hand to make it work. Another problem: ubuntu 12.10 has moved to gcc 4.7, which is NOT compatible with CUDA 5. Solution: I moved back to 11.10, where gcc is 4.6, and NVIDIA drivers install just fine. Although I think I may move the machine to 12.04. Another problem I experienced is that the Atheros AR8161 ethernet chips that are integrated on my GA-Z77-DS3H motherboard do not yet have a driver on Linux, apparently on any version of ubuntu at least. I'm sure time will fix this problem, but at the moment it seems the only solution is compiling a custom Linux kernel and installing kernel modules manually. Moral of the first story: Make sure to understand the assumptions used in Linux packages. Also, the situation in Linux world (or ubuntu world at least) is as hectic as it ever was.

Exhibit B:
So I ended up working very late in my new lab (at the IGB building at UIUC, which seems to be an empire of its own, but that's a story for a different time). Why? Because I don't yet have a keycard, and the building is locked after 5 PM and weekends. Geeeez! Anyway, after I installed the ubuntu 11.10 and got my CUDA 5 working, I went back home at 2 PM. Well I still had the Linux itch in me, and had the components ready for another go. SO I started a weekend project, to install Linux on my Apple TV (first gen). I had previously replaced the Apple's media player OS with a version of Mac OS X leopard (10.5.8), but I was never happy with the performance. AppleTV only has 256MB of memory with a 1GHz pentium M processor. The processor isn't bad, but the RAM is really limited and the system starts thrashing as soon as you want to do anything useful. Add this to the slow speed of the original 4200 RPM hard drive, and the experience is very lethargic. Anyway, I first tried to go without the prepackaged crystalbuntu images, but neither the live USB nor the installation image could boot the system. I suspect the reason was that I had put a brand new SSD drive insead of the hard drive. Dang! I finally found out about the ATV-Bootloader project, which is pretty neat. The idea is that when AppleTV BIOS can't find its Apple provided TV, it will fall back to a recovery partition and run whatever it is there (assuming it has an Apple Boot.efi). ATV_bootloader does exactly that. You partition your hard drive (or USB) with an Apple partitioning scheme, use the correct boot.efi from Apple, but then hand it a Linux image to boot. The result is that the system boots up to a busybox kernel. From there on, you have control and can boot into another kernel using another neat trek called kexec, which is the same idea used for exec, but for kernels. It works since Linux (Unix) kernels are image based, all you need is a vmlinuz and initrd.gz (or initrd.lz in newer ubuntus). So after I got into busybox, I tried installing ubuntu 12.10 or lubuntu 12.10. Neither would load up. So after Googling more, I decided to curb my enthusiasm and settle on what has shown to work, ubuntu 8.04. I also decided to go with lubuntu / LXDE, but alas Lubuntu wasn't available back in 8.04 time frame. Anyway, ubuntu 8.04 LIveCD (copied onto a USB) would run fine, but the installation process was VERY VERY SLOW. It took it 6 hours (!!!) to get from page 1 of the install script to page 6, and it finally froze on page 7. Sooo, back to drawing boards again. This time I decided to use 8.04 server edition, and lo and behold the installation worked out just fine! W00t, I have a functioning Linux. Then I went ahead with installing X11 package y package and then LXDE on top of it. The whole thing ended up in a pretty fast Linux experience, which wouldn't need much more than the 256MB RAM available. I set aside a large swap space on the SSD, but haven't got to the point to try out its effects yet. I had a little bit of adventure with older NVIDIA drivers not liking 8.04 due to the support for XEN in that version of the kernel. I ended up installing the latest legacy driver package from NVIDIA, 304.xx, and it seems to work fine. However, I'm still having a hard time getting the wireless chip to work. My network at home is WPA2, which is proving to be too hard for the current configuration. (I'm not even sure if the broadloom hardware supports it.). For the time being, I'm connecting it through ethernet to my macbook pro (using "internet sharing" functionality, since I only have wifi in my house and no wire. Sharing internet with my neighbor can be economical, but once in a while you end up wishing for a wire!) I'm currently using midori for the browser, which is slightly more memory consuming than dillo (where I was a Mac OS X contributor for a short time), but much more functional. Turns out installing X and LXDE from scratch is a bit of an underwhelming experience, since pretty much nothing else is installed. That's why a distro helps you so much, it already has a lot of stuff included. I'm not fully done with it yet, since putting "startx" in /etc/rc.local ends up loading LXDE in root mode, which isn't a very good idea. And in my last round of tinkering, I lost the window manager functionality (probably open box got crushed somehow). I have X and graphics, but no window borders!

Moral of story: It's fun fun fun to tinker with Linux, but don't expect to get very functional setups. At the end of the day, I'm glad I have my Macbook pro with its very functional unix based OS that works and doesn't need constant tweaking. Also, I would like to switch to some distro that doesn't change all the time. From Ubuntu 8 to 12 SOOO MANNNNYYYYy things have changed! I'd like to invest my time in a more stable distro that doesn't change all the time. I think RHEL and its open source equivalents (CENTOS, Scientific Linux) probably change less often, but I'm too unfamiliar with RPM based distros that I'm afraid to move. I like my apt-get! And Debian itself isn't sexy enough for many, for example there is no NVIDIA CUDA package for Debian. So, I guess for the time being I'll stick to ubuntu and accept the fact that it changes all the time. Well, maybe if I stick to LTS releases ...

Note: Click on the photos to enlarge them.

If you feel interested in any of them and want to get the original file, please don't hesitate to email me!

0 Comments:

Post a Comment

<< Home