Category Archives: Linux

Ubuntu Oneiric: Initial Musings

Update: Because of hardware problems the information about Oneiric’s speed are off, please ignore these mentions. Correction: Also, Unity is a collaboration of Gnome 3.0 and the Ubuntu Launcher with the Launcher generally replacing Gnome 3’s Activities Start Menu.

Aaaaaaaa….

First thing I noticed as Oneiric booted up was how pretty it was: from the unassuming theme to the colorful launcher, the Oneiric looks are sweet. The second thing I noticed, however, was how slow it was. Upon logging in: the desktop took about 60 seconds before becoming usable; the application menu took 10 seconds to open, and the file browser another seven. My first impression: a bit scared (no worries, read on).

Note: A quick background to explain my experience: I have an eight year old laptop that I’d like to be able to hold onto. I know a good number of other Linux users with older computers because basically, I think, we feel that for what we need to do that these computers are good enough. Up to this point, I’ve used the original Gnome (Gnome classic < 3.0) fine on this computer (many Firefox tabs, Gimp, Inkscape concurrently) and it ran adequately enough. We are at a time though where it is certain that Gnome is changing (Gnome re-engineered the desktop with Gnome 3.0 (a more "modern", though more resource-intensive desktop)). Shuttleworth (Ubuntu's high commander) was like many though and couldn't understand it's ergonomics and announced a split from Gnome 3 with the Ubuntu-designed Unity desktop (basically a Gnome 2.x desktop with some tweaks and a new application bar). Unity too though is more resource-intensive than Gnome Classic and judging by other posts I've seen I am not the only one questioning if I need new hardware.

Aesthetics

Ubuntu certainly is putting good thinking into creating an efficient desktop. The colorful icons on the launcher distinguish differing programs very well. When they are clicked they provide nice feedback so you know the program is loading. I think that going the route of icons only was a nice touch (as I generally know what I have open in a program). The theme too is a design that is well thought out and works well for applications that run full screen. Unity saves screen real estate by combining the title bar, gnome panel and program options (File Edit …) into one. Since I don’t usually need the program options visible this works well for me.

The scrollbar is re-engineered too and is just hinted (a small four pixel-wide color bar) and pops-up on roll over. I’ve found this useful since it is something that I don’t always use. Other new niceties are an improved system font that has great readability and tabs have been made much smaller from the typically roomy Gnome originals.

Launcher

The launcher appearing too basic originally worried me, but I began to like it because it was so. It is nice that the colorful icons stand out but I wonder if a bit later on they won’t stand out too much. If they matched Oneiric’s notification icons (monotone icons) they might be less distracting (the bright colors attract my eyes easily). I like how the launcher simply explains how many windows belong to an application by arrows to the left of the icon, and which application is focused by an arrow on the right:

The launcher though does have an Achilles heal in it’s auto-hide functionality. This feature probably has it’s reasoning based in Unity’s netbook origins where screen real-estate was the first-most thought. On a normal desktop though, auto-hide functionality takes away the direct route I am typically used to. For one, applications a lot of times open up under the launcher causing the launcher to auto-hide. This meant that I would have to go from a visual representation to a mnemonic one for my open applications. I discovered that I had to put my pointer to the left edge and wait for the launcher to re-appear a good many times. Later on I just moved applications away from the launcher but since most applications launched there this got tedious too. This behavior added a lot of work for me and there is no direct option to fix it.

The application menu on the launcher is very thorough. It’s most useful feature in my opinion being the search box where you can search applications and documents (the cursor even starts there). It is slow to load on this old computer (10s cold start, 3s warm), but I find it so useful I can take the wait.

Red Zone Issues

A few things happened that caused me a good amount of concern. First, after loading up the desktop I installed Gparted to format a USB flash drive (the new Ubuntu Software Center is very nice, though very slow)

only to have Gparted crash on me mid-format. I’ve never seen Gparted crash ever before and this really threw me (Note: running the last several days though no other application has crashed on me except Firefox once [though I haven’t tried Gparted again]). Others bugs were: resuming from suspend failing two times (out of about twenty), and having the mouse freeze up once. The big adjustment I’ve had to make is due a bug (I think) on how I normally perform my tasks: I’ve had to learn to look for a blinking cursor. There is something about Oneiric where I’ve clicked text boxes a good number of times and typed only to have the first keypress missed. I believe this behavior is due to the first keypress actually selecting the text box. I’m not sure why this behavior occurs (never seen or heard of it before) but I hope it gets fixed soon.

Ups and Downs

Up: Desktop now volume-less, leaving it available just for my work files.
Down: Flash installed by default… groan.
Down: Firefox not pgo yet.
Down: Mail Notification requires Thunderbird to be open.
Down: File manager started from launcher opens behind Firefox.

Ameliorations

I did manage to get most my problems fixed over the last few days. The speed can be improved a good deal making it about on par with Natty, the dock can become just about as usable as the Gnome panel Application Switcher, and the missing key presses… well.

Tomorrow I’m going to write Ubuntu Oneiric: Tuning the Desktop on a adjustments that I made that improved my desktop experience.

MPD Locally

Recently I updated the Ubuntu wiki to add using MPD locally and cleaned the Arch wiki of the same name some. MPD on the Arch wiki is a good source of information but it needs help: organization, some tech things, grammatically… but its holding together for now. Because I am mainly using Ubuntu now it is wiser for me to use MPD locally (clean installs are still recommended over updates (just engineered that way)) and having a home partition simplifies things greatly. Anyways, I’ve added .desktop file information and a fix for PulseAudio too.

REO Speedwagon to Ario MPD-wagon

One of the reasons that the MPD page on Ubuntu’s wiki is so scare, I believe, is because Ubuntu uses Banshee. Banshee is a nice MP3 player with about every feature I’d want from an MP3 player. It also has a really nice layout. For my tastes though, I’d like my MP3 player to be more responsive and lighter (MP3s aren’t incredibly resource intensive files to play) and that’s why I like MPD. Banshee on my eight year old computer takes about thirty seconds to load and has a slight (very slight but noticable to me) delay when changing tracks.

Take a look at this:

This is Ario, a MPD client I hadn’t heard of before. The flow is beautiful, very logical to me. Works great, gonna be using it for a Bit.

Missed Touchpad Button Clicks

I had gotten this laptop as a gift/hand-me-down from someone else. Since the first thing I did was install Linux, I hadn’t thought otherwise that the buttons hadn’t been treated to well: left-click was very stubborn, often missing on some very obvious pushes. The action/response of the button resembled a sticky button. Because right-click was better, I created a script that would switch/toggle left and right click. I toggled it twice to test it (so that it reverted back to the original) when and found that left-click was working normally. Not sure why this fixed the problem and have yet to see another problem like this but I’m glad it’s good again. I created a script to quickly do this then added .desktop file to have it load on Login. The script:

Then I created a desktop file touchpad-button-fix.desktop in ~/.config/autostart to start it on Login:

Additional, the touchpad button may revert to it’s original behavior after resuming from sleep. To run the script upon resume it will need to be defined to pm-utils. Put this in /etc/pm/sleep.d/90_touchpad-button-fix:

Then make them executable:

sudo chmod +x ~/.config/autostart/touchpad-button-fix.desktop
sudo chmod +x /etc/pm/sleep.d/90_touchpad-button-fix

Older Computer: Streaming Media Servers

Recently I had a notion after I bought my PS3 about media servers. The PlayStation 3 is pretty neat. Being just a little computer (with a big graphic card) it is able play audio, videos, and display pictures. The PS3 has categories of its’ differing abilities: Music, Video, Game, Network… On the Music, Video and Picture categories I noticed there is an option to find ‘Media Servers’. This got me intrigued: I have a basic wired/wireless home network that connects my PS3, Laptop and Printer (this also is pretty neat, a minuature Cisco router does this seamlessly) and I wondered if the media I had on my laptop could be shared with my PS3. With it I’d be better able to view/listen my media by using my TV, but would it be able to run decently on an eight year old laptop?… Yes.

MediaTomb

This is what I was recommended first when I first asked about media servers. I think this may have been because it is the most commonly used media server on Linux. MediaTomb was easy to install, configure (all three media servers I tried are just basic daemons with easy to edit configurations), and didn’t bog down my system when it ran normally. MediaTomb does provide nice thumbnail support and after editing the configuration and restarting the daemon it showed up immediately on my PS3. After running MediaTomb for awhile though however, I gave up using MediaTomb because at times it would get heady. MediaTomb appears to rescan the library from time to time and then it appears to do some parsing of files. Doing this would run up my fan on my laptop which is generally reserved for heavier tasks like working with ffmpeg.

uShare

Not sure I want to mention much here as it probably isn’t worth the time. A bit after installing uShare (a day) I discovered it wasn’t being developed anymore. uShare ran nice for one day but after adding a video that wasn’t support (or maybe just a new start to the PS3) The PS3 gave a “A DLNA Protocol Error (501)” that I could never fix. I tried waiting for the library to fully scan on my laptop before turning on the PS3, removed any questionable media files (unsupported codecs, DRMm have reported to cause problems) with no luck. uShare has not been maintained since 2007. When it did run, it ran well and light. uShare does not have support for thumbnails, and it does not monitor (or rescan) directories while running (the daemon will need to be restarted if you add new music for instance).

miniDLNA

Never got this to work, but I heard it is fast and cool.

Notes

Since I’ve written this article I’ve been using Rygel which is an ok media server. At least it is doing the trick now.

A more Desirable rm

Update: Added mv option -t and --backup=t (thanks to Matt) to prevent file collisions from same-named files. Thanks Matt! A bashrc version and a bash script are both available.

Warning: Currently I am not using this script. This script works good for most instances but I discovered it does have problems when compiling. During compiling some files get force removed (the rm -f, -fr, or -rf options) that it looks like mv will not do. When this happens files don’t get removed and compiling errors can occur. I am still trying to figure out how to do this.

I’ve deleted files before that I wish I could have back and resorted to file saving utilities to try and save them but I have never done this before:

rm -rf ~/ .Arachnophilia

I was doing a bit of spring (fall?) cleaning and as you may have guessed: the space between ~/ and .Arachnophilia was not intended. An accidental slip of the thumb caused this and yes, this had caused my computer to delete my whole home directory! I remembered a post I had read at cyberciti and quickly I did sudo init 1 to drop into single user mode. The post was for recovering a text file though and single user mode didn’t accept any input anyhow so I rebooted into my beloved Parted Magic.

R! and R? (Request!! and Recover?)

Parted Magic now has Clonezilla once again and luckily I had back up several days ago. I wrote down the files I had been working on since then to try and recover. The Arch Wiki has a good page on this. I tried extundelete first and while its probably the best and most through way to recover all files, it recovers the files like this:

ls . | head -n 2
010392
010394

Since the files I’ve been working on were just text files and scripts, Photorec was a better application for this. Photorec is able to analyze and determine certain file types including text files and script files.

Afterward, I was left with directories and files that looked like recup_dir/f1029394.txt. 14000 and some text files if I remember right. To be able to find which one were the correct ones using grep is awesome. So quick too. I just had to be able to remember some text within the file and search for it like this:

grep -rn --include=*.txt "the text here" .

Using grep alone instead of combined it with some program like find is much quicker. The -r does a recursive search, the -n will print the line number, and --include specifies the file type in this case. Piping grep works good for more refined searches like searching for two patterns on a string or removing a string:

grep -rn --include=*.txt "the text here" . | grep -n "this too"
grep -rn --include=*.txt "the text here" . | grep -v "string not with this"

I found the files I needed, thankfully, and was able to get them back.

~/Never\ Again\?/

First thing I did after restoring from my backup was to see if I could prevent this again. The answer was pretty simple: move the files to the trash instead. By adding:

alias rm="mv -t ~/.local/share/Trash/files --backup=t --verbose"

to the ~/.bashrc files will get moved to the trash instead of deleted. The ~/.local/share/Trash/file is defined by the freedesktop.org organization so it has interoperability with both KDE and Gnome. With the -t and --backup=t options mv will rename files with duplicate file names to ones with appended numbers (e.g. abc.~2~).

Here’s is a more detailed version in a bash script that includes feedback:

Audible.com and Linux… Arghh.

Update: Since this I’ve learned that Barnes and Noble carry Audiobooks in the MP3 format. To download them though the Windows application OverDrive Media Console is required. Good news is that you can D/L the file and open it through the application so you don’t have to order it through Windows. Thankfully it’s a good program and does it’s job well.

Recently, I decided to get and audiobook to be able to listen to on my MP3 player. I had heard on TV the audible.com commercial that audiobooks could be downloaded and played on my computer or MP3 player. I went to Audible, found the book I wanted and downloaded it. When it started downloading, I noticed the extension was .aa. I hadn’t noticed but below the Download link was a mention of how to import the file to iTunes. The .aa extension is a specially created extension short for Audible Audio and it only works on several types of portable music players that support it. iPods are one, and newer Creative Zen, and SanDisks do too. Having already spent $30 dollars though, I was determined to get this to play on my slightly older MP3 player. Unfortunately, the only way to do this (without spending $20 to $30 on software that removes DRM illegally) is a time-consuming, and somewhat laborious process.

Burn, Burn, Burn… Rip, Rip, Rip

I was a bit thrown off of the MP3 mention:

Saying MP3 player (to me) seems a bit too generic to me and sadly it had me boot up my dusty Windows install :) to be able to start the process. I did bit of research and booting to Windows is necessary – there is no way to convert .aa files in Linux as of yet. I copied my .aa files to the Windows partition, rebooted to Windows, and then installed iTunes. To begin: in iTunes I had to create a new playlist ‘File > New Playlist’, and drag an .aa file to it. I had multiple .aa files so I had to do them separately, one at a time. After that, I did ‘File > Burn Playlist to Disc’, select ‘Gap Between Songs’ as ‘none’, and hit ‘Burn’. This is where the long part of the process takes. For my three part audiobook (three .aa files) the total ~15 hour audiobook spanned 13 discs. I did this for each .aa with a new playlist. I tested a CD after it was done and it played fine but oddly I noticed that iTunes had decided to break the audiobook up into 8 minute tracks – wish it didn’t do. When finished, I decided to rip in Linux. Reboot.

In Linux, Ripit is a good command line tool for ripping CDs. In Ubuntu, install by:

aptget install ripit lame

Lame is required for encoding. Make a new directory for the audiobook. In my case:

mkdir -p ~/Audiobooks/Stephen\ King/Full\ Dark\,\ No\ Stars\ \(Unabridged\)
cd ~/Audiobooks/Stephen\ King/Full\ Dark\,\ No\ Stars\ \(Unabridged\)

And begin burning:

ripit --playlist 0 --bitrate 64 --quality 0 --loop 1 --outputdir ~/Audiobooks/Stephen\ King/Full\ Dark\,\ No\ Stars\ \(Unabridged\)

I did a bit of research on this and for most audiobooks the are encoded in 32bit mono but since some have sound effects, 64bit is the way to go. Also using 64bit helps because a bit of quality will be lost in the conversion. This unfortunately makes the MP3s slightly larger (the original files were about 75MB each, afterward they were around 150) but is really the best choice. The other commands here do: playlist 0 (don’t create a playlist), quality 0 (encode slower for slightly better MP3 quality), loop 1 (will eject disc after rip and prompt for a new one), and outputdir (to specify where to put the ripped folders). Ripit automatically queries the FreeDB database for MP3 tagging (there won’t be any valid entries likely) and there is no way to override it. So for each CD I had to enter into it: not to use a DB entry (0 none of the above); to label with the “Default Album…”; and for genre I just hit enter (none). Ripit burned the CDs into folders named ‘Unknown Artist – Unknown Album’ and was smart enough not to overwrite the folders of the same name and sequenced them. When it was done, I had a list like this:

ls -1
Unknown Artist - Unknown Album
Unknown Artist - Unknown Album 1
Unknown Artist - Unknown Album 10
Unknown Artist - Unknown Album 11
Unknown Artist - Unknown Album 12
Unknown Artist - Unknown Album 2
Unknown Artist - Unknown Album 3
Unknown Artist - Unknown Album 4
Unknown Artist - Unknown Album 5
Unknown Artist - Unknown Album 6
Unknown Artist - Unknown Album 7
Unknown Artist - Unknown Album 8
Unknown Artist - Unknown Album 9

Put it Together, Polish it Up

To be able to put the audiobook back together, I’d have to join the numerous MP3s back together. Here, I choose to use mp3cat. I was a bit unsure which way to go. The best source I could find to do this was this question at stack overflow. I decided to use mp3cat because here it is said that (later on in post by joelhardi) that mp3wrap “inserts its own custom data format in amongst the MP3 frames (the “wrap” part), which causes issues with playback, particularly on iTunes and iPods.” mp3cat pulls the tag (ID3) information out (which leaves only the binary part of the file) and then joins the MP3s together. To install:

wget http://tomclegg.net/software/mp3cat-0.4.tar.gz
tar xvf mp3cat-0.4.tar.gz
cd mp3cat-0.4/
make install
sudo cp mp3cat /usr/local/bin

For my audiobook, part 1 of my audiobook spanned the first folder (0) to folder 4, part 2 from 5-8, and part 3 from 9 to 12. To concatenate the files back together, I’d have to define the folder span of the MP3s to put together. However, because the folders will are not going to be recognized in the correct order (e.g. folder 10 will come after folder 1 [as recognized by the shell]) I had to zero pad them (e.g. …Album 000, …Album 001,…):

mv Unknown\ Artist\ -\ Unknown\ Album/ Unknown\ Artist\ -\ Unknown\ Album\ 0
rename 's/\d+/sprintf("%03d",$&)/e' *
ls -1
Unknown Artist - Unknown Album 000
Unknown Artist - Unknown Album 001
Unknown Artist - Unknown Album 002
...

The rename command here grabs any number and turns it into a it’s three digit equivalent. Since all my folders had numbering at the end of the name this solution worked good in this case. I created a script to concatenate the MP3s with for ease of use if I ever have to do this again. I had help from some people at the Arch Linux forums to help finish this, particularly rockin turtle. Thanks guys!

To use it for example:

mp3cat-multiplefolders 0 4 "01 Part1"

This did exactly as I wanted except for one thing: I learned that the track length information is also part of the binary file. This would cause some MP3 players to report the length incorrectly thinking that the MP3 was an eight minute track instead of the five or so hours that each actually was. To fix this, the only program I could find was MP3 Diags. This is a great tool to repair damaged MP3s with. Unfortunately, it a GUI utility only and I was hoping for a command line one. To install on Ubuntu: apt-get install mp3diags. I just clicked on 4 to fix everything (which was just the track length issue (bc)).

Tag Line and Submit

I searched online for tag information of the audiobook on both the FreeDB and MusicBrainz databases but had no luck. At this point I knew I’d have to create the audiobook information tags (ID3) manually. Originally I used EasyTag but it created a couple issues afterward when I went back and checked it with MP3 Diags, particularly when adding cover art (problems with frames and such). So it looks like its best to use MP3 Diags tag editor as it had all the basic parts I needed. The tag editor was basic but worked nice and I found the only tricky thing was adding cover art (which I had to be copied to the clipboard and pasted in). The only way I could find to put an image to the clipboard was to find the image in Firefox and copy it from there. The only question I have now is if MP3 Diags correctly assigned it as CoverArt as it has no ability to specify it. However, when playing the files in Banshee the CoverArt is show correctly.

Since this audiobook hadn’t been listed in an ID3 database, I thought I’d put it up in case anyone else was crazy enough to do this :). After looking at FreeDB some more, I read in the forums that they didn’t think this was a place for audiobooks and that the FreeDB was geared toward audio CDs. However, MusicBrainz had audiobook listings so I decided to put it there. Originally I had tried to use MusicBrainz’s own application (Picard) to tag the MP3s with but to tag with Picard the original needs to be a CD (the DiscID creator feature requires a CD to be inserted). However, Picard does have a plugin available called “Add cluster as release” that works. I installed it following the instructions, put the audiobook into a cluster, right-clicked the ‘Album’ > Plugin > Add cluster as release, created an account (required to submit), and filled out the form as best as I could:

Finally, I found the audiobook on Amazon and did ‘Relate to URL’ to add coverart. When done I was told that MusicBrainz has a process that puts new entries into a queue for peer review.

Thoughts and Conclusion

All and all the process went smooth so I’m happily listening to my audiobook now. I’m happy with the quality for the MP3s except for one thing: when I reach the length in the track where the segments were joined I can hear a slight dip in volume. Barely noticeable so I’m not too worried. I also would have liked to be able to fix the track length error from the command line and enter ID3 information from there as well. If anyone knows of anything, I’d appreciate hearing from you. And finally, if anyone knows if it is possible to get audiobooks in MP3 format that would help me quite a bit.

Calibration of a Samsung Series 3 350 32″ TV

This isn’t exactly Linux related but I thought I’d share my experiences on how I calibrated my TV. A great source on doing this is the LCD TV Buying Guide website. This is a great source on not only why TV’s need to be calibrated but also because it has settings for most popular models. Why do TV’s need to be calibrated? Basically most companies rig their TV settings so they look the best on the show floor. However this leads to things like picture tint, contrast exaggeration and other things that doesn’t reproduce the picture realistically. Even if your TV model doesn’t exist on the website, they say to look at a similar model that will a lot of times provide the settings you need. I found this to be true with one model of TV I had, but not another. Even if they have your model it doesn’t hurt to be a bit skeptical. I found for my model I had to change a few settings a tad bit further. I’m going to print the settings now and then tell you how you can calibrate it too if you’re able to connect your computer to the TV. This TV has the model number LN32C350D1DXZA but is known as the model LN32C350.

Main
Picture Mode Standard
Backlight 10
Contrast 97
Brightness 55
Sharpness 36
Color 34
Tint G50/R50
Advanced Settings
Black Tone Off
Dynamic Contrast Off
Gamma 0
Color Space Auto
Flesh Tone 0
Edge Enhance Off
White Balance
Red Offset 18
Green Offset 15
Blue Offset 24
Red Gain 2
Green Gain 21
Blue Gain 10
Picture Options
Color Tone Cool
Size 16:9
Digital Noise Filter Off
HDMI Black Level Normal
Film Mode Off

The contrast is a bit stretched as to give a more in depth look, 92 is more accurate though.

Another good way to calibrate your TV is to use Lagom’s excellent computer monitor calibration tests. I always use this when I get a new computer monitor and it’s well worth the time if all else fails. Also another option is to use the THX video calibration that you will find on LucasArts movies (usually in the options menu).

Thanks to katzmaier at cnet forums for the basis if the white balance setting. Well that’s about it. If you haven’t messed around before with monitor calibration, I think you’ll find the doing so to be a pleasant experience.

A reasonable looking replication of how the TV looks after calibration

Back in Business

Been liking my new setup after fixing things when my hard drive began to go down. When I installed Arch on this computer, I began to notice problems right away that I couldn’t explain. For instances, it would hang badly. During compiles and heavy-ish workload it would stutter and freeze for most of the time. I originally attributed this to the older ATi card (a ATi Mobility Radeon IGP 345M with 64MB Shared memory) that I had a little trouble setting up. I wasn’t sure if the trouble came from an incorrect configuration or if this legacy-ish card just couldn’t handle the load. When these hangs occurred they would last about five seconds and normally responsive tasks like moving the scrollbar, became unresponsive. I considered that this might also have to do with KDE 4, thinking that this was just too much of a workload for a Pentium 4 2.66 GHz computer with 500 MB. One day, when I went to change my password:

usermod -p secret-password root

and got this interesting response:

usermod: cannot lock /etc/shadow; try again later.

I knew something wasn’t quite right ;). I rebooted into the Parted Magic CD and did an extended S.M.A.R.T. test:

smartctl -t long /dev/sda

And when I looked at the results an hour later:

smartctl -l selftest /dev/sda

I discovered that their were 48 errors that began to start two weeks ago. Thats not good by any stretch of the imagination :). I did a backup right then (that failed) and ordered a new hard drive. The new drive is running great (also did a smartctl test on it when I first got it) and no more hangs and glitches. Turns out that faulty hardware can cause all types of input/output problems through the motherboard. The new drive (I had hoped) I thought might allow me to be able to run KDE again but to no luck. The drive I got is a good drive and considerably better than the previous but programs are just taking too long to load. Even with JFS (which is a great file system to help reduce load) KDE is out of the realm of possibility. I’ve been using LXDE and think I will stick with it. It runs great and has what I need through it… though can be a little boring at times :D.

The Beauty of Basics

I recently had a hard disk begin to fail on me. I had had Windows XP on this machine for quite some time and because of the immenent failure I was afraid I had lost it for good (laptop didn’t come with any XP installation disk). So I booted up the install cd, mounted Windows, backup drive, cd’d to Windows, did a:

tar --exclude=Windows-XP.tar.gz -czvpf /mnt/backup/Windows-XP.tar.gz .

After I put in a new hard drive, I extracted it:

tar xvf Windows-XP.tar.gz -C /mnt/win

And all was golden. What surprised me was that on reboot, it booted straight into Windows. My previous hard drive had dual-booted so I thought I’d have to pull out the Window XP Recovery disk and do a fixmbr to test it, but it looks like without an MBR the BIOS is programmed to look for a ntldr file (the Windows bootloader). I guess a lot of BIOS’s are like this.

Anyways, getting everything put back together again with Arch and am pretty happy with it.

Random Tidbits

Today, I’ll be going over the jet and flotsam I’ve been thinking about lately. Since everybody’s desktop is extraordinarily unique in Linux so there should be something here for everyone :).

Gnome Smaller Icons

For a smaller screen like I got (800×600) having smaller icons helps save a good amount of screen real estate. I figured I wanted them about half the size they normally were. I was using Lxappearance which controls a few Gnome desktop attributes, but not the icon size unfortunately. Lxappearance writes to the gtk configuration file (~/.gtkrc-2.0) and is supposed to be able to inherit additional settings in (/home/user/.gtkrc-2.0-mine) which it wasn’t doing. Had to give up Lxappearance and just manually write to the (~/.gtkrc-2.0) file directly. By adding this I get nice appropriately felt sized icons:

gtk-icon-sizes="panel-menu=16,16:gtk-menu=16,16:panel=16,16:gtk-large-toolbar=16,16:gtk-small-toolbar=16,16"

Gentoo Quick Install

The last update to this installation guide was on April 2009, whether it is accurate still I can not say. Gentoo evolves gradually so for the most part it should be alright, best to use in reference with the Gentoo Handbook.

Installing Gentoo really is a breeze… once it has been done before. This guide is for installing Gentoo in a logical straight-forward manner. I have written everything generically, with necessary links for additional resource, look at the Gentoo Handbook from which this guide derives for more complex set-ups.

I choose to install from a LiveCD [1]. I choose not to use Gentoo’s Minimal Install CD because many distro CD’s create a nice desktop to work on and a web browser can be useful to look up any questions.

Partitioning

Just about any Live CD a person has/likes can be used to install Gentoo with. For beginners it helps if it contains Gparted, an easy tool to partition with. If it doesn’t consider using Gparted’s LiveCD [2] to first partition the drive.

For security purposes and for convenience, I’d recommend having a partition for the system (root “/“) and another for “/home” (aka the users partition).

Linux uses a considerable less amount of memory than Windows or Mac OS X. Users with memory of 2GB or more probably don’t need a swap partition. If you choose not to have a swap partition and need to use swap, a swap file can be created later [3].

Date

When done partitioning, restart and open the BIOS. Make sure the hardware clock is set to the right time, start the install disk and check the time in the terminal:

date

Possibly the installCD is using the UTC clock (Universal Time Clock – aka Greenwich Mean Time) for time and date and the clock will be skewed. This is not a problem. The correct settings will be entered on the new installation.

Network

Gentoo will likely detect your network card and setup your network. If it doesn’t try the configuration utility:

net-setup eth0

You can find the name of your network device with ‘ifconfig -a‘.

Remote Install (Optional)

Some people may want to use another computer to install Gentoo from. This can be handy if say the remote machine has a bigger screen or has notes on it you’d like to access.

Begin by starting sshd on the computer to be installed upon:

/etc/init.d/sshd start

How to start a daemon differs though per distribution. Give root a password on the machine to be installed on for security purposes:

passwd

Type “ifconfig” to find the internet address, then on the remote computer:

ssh -l root@address

Preparing the Storage Unit

Mount the system partition created for the system install:

mount /dev/devicename /mnt/gentoo && cd /mnt/gentoo

You can find out the partition you need to use with:

fdisk -l

(e.g. /dev/hda3, or /dev/sda4) are examples of what your partition may be named.

A stage3 tarball will be needed now. Stage3 tarballs are tools and a base system that contains just enough necessary to boot your system. Gentoo builds regular stage3 tarballs. You should find the newest on the mirror (contained in /releases/<architecture>/autobuilds and download it.

On the LiveCD the internet networking needs to be working. Learn how to do this (it probably already is) and copy DNS info over to the system that is being built so the network will work on it:

cp -L /etc/resolv.conf /mnt/gentoo/etc/

Mount /proc and /dev on the system being built:

mount -t proc none /mnt/gentoo/proc && mount -o bind /dev /mnt/gentoo/dev

Enter the new Gentoo environment by changing root:

chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile && sleep 2 && export PS1="(chroot) $PS1"

Portage Configuration

The Portage Tree (the software-repository) will need to be downloaded, this is done by:

emerge –sync

Portage is the package installer for Gentoo. Gentoo does have some binary packages (packages pre-built) but mostly Gentoo is about compiling packages specific to your system.

For some reason Gentoo doesn’t add the portage configuration files:

mkdir /etc/portage
touch /etc/portage/package.keywords
touch /etc/portage/package.use
touch /etc/portage/package.mask
touch /etc/portage/package.unmask

Vim Default Editor (Optional)

I to do my editing with vim, why it’s not installed I don’t know.

emerge vim

Basic Settings – Add Timezone, Locales, Keymap

Add timezone

ls /usr/share/zoneinfo
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime

Set Time Type

vim /etc/conf.d/hwclock # or
vim /etc/conf.d/clock

Set time type to “local” if dual-booting Windows or Mac OS =<9. Later we’ll add an NTP program the syncs the time on boot, so it might be a good idea to edit “clock_systohc” to “YES” to keep the hardware clock in sync with Network Time Protocol.

Don’t bother to look at “date” as the chroot still uses the CD settings. The effect won’t be seen until you boot into your Gentoo system.

Glibc Locales

Locales provide information on regional settings – money type, character maps… To see available locales look at:

vim /usr/share/i18n/SUPPORTED

Set locales in:

vim /etc/locale.gen

Enter your locale. Here’s and example of the United States local setting:

en_US ISO-8859-1
en_US.UTF-8 UTF-8

To generate locale, run “locale-gen” and “locale” to check if the correct locale is set.

Update environment:

env-update && source /etc/profile

Keyboard Layout for Console

vim /etc/conf.d/keymaps

Available keymaps are in /usr/share/keymaps.

Make Files

The make files are basic settings for the system being built. There is the “make.default” file that is the system profile for building a system. And there is the “make.conf” file – a user-controlled profile that contains hardware information, properties wanted in packages (USE flags), and adds to or overrides the “make.default” file.

A system profile link to “make.default” is set by default, make sure it is the correct one for the system:

ls -l /etc/make.profile

Link to the most appropriate system profile:

ln -sf /usr/portage/profiles/default/linux/<arch>/<gentoo-version-year>/<desktop|server…>

The “desktop” and “server” subdirectories are optional but provide more detailed settings.

Confirm the link is correct:

ls -l /etc/make.profile
… /etc/make.profile -> /usr/portage/profiles/default/linux/x86/<version>/

Make.conf

“Make.conf” sits on top of the system profile choosen, adding and over-riding those settings. The most important item to a successful Gentoo build is providing as complete a “make.conf” as possible.

vim /etc/make.conf

CHOST defines the basic architecture of the computer – 486,586,PPC… This is important to get right. It is alot of work and dangerous to try and fix this later in the build, research and be sure that it is right one.

CFLAGS are used to define the CPU architecture more specifically.

USE flags define options programs have that can be enabled or disabled. Try “emerge -pv gcc” to see available flags.

It is nice to install Gentoo and have a reference to USE flags. You can install “gentoolkit” and use equery to find out about USE flags per packages:

equery uses gcc

The ACCEPT_KEYWORDS variable defines what software branch to use on the system. In Gentoo, there is a stable branch for already tested software and an experimental branch. If user is willing to test more recent software, consider using the testing branch, but expect more time debugging problems. To have Portage use the testing branch, add a ~ in front of the architecture.

VIDEO_CARDS define video card type. This value will tell xorg-server what video card drivers to pull in, and what DRI to use for the X server. Also a video card DRM is required either by selecting it in the kernel, x11-drm package, or the driver may have support for it: e.g. nvidia, ati, intel video card… A few values are available.

INPUT_DEVICES tells xorg-server what basic devices are or will be connected. Items include keyboard, mouse, touchpad…

GENTOO_MIRRORS are used for syncing the portage tree. You can test and add the three fastest mirrors by:

mirrorselect -s3 -b10 -o -D >> /etc/make.conf

Beginning to Build

There will be a lot of compiling that can take several days to build on older computers. Portage is a well tested and complete compiling system and eases the process, but likely a few bugs will appear. A few tips:

Previous Versions

Occasionally during compiling errors can occur. If choosing to use the unstable branch, the newest updates and less tested programs come with it. If there is a problem compiling along the way, check Dibb’s Package Page and revert back to an older version to compile. Or you can install eix (run eix-sync to update database) and do a quick search with “eix <package>“.

Dependencies

Check the dependencies of a program to see if a dependency is causing the problem:

emerge -pv –tree <program>

Custom USE Flags per Package

Apply custom USE flags for packages (e.g. “media-sound/lame -gtk” removes the gtk dependencies of lame) and put in:

vim /etc/portage/package.use

Read the Developer’s Notes After Emerging Packages

When emerging finishes developers will often leave notes about the program. It may mean more time and work but it is usually a good idea to follow them.

If you miss a note, developer notes are recorded in:

vim /var/log/portage/elog/summary.log

Installing a Kernel

The kernel contains the information of almost all the hardware on the computer and how to run it.

If this is the first time working with a kernel, I’d recommend using the genkernel – a basic all types kernel that will run on most systems.

Otherwise the configuration can be done manually. Manual configuring the kernel can make for a slightly faster boot but isn’t necessary in most cases. Manual configuration can take a long time though and requires alot of research, begin by:

emerge gentoo-sources
cd /usr/src/linux

Make sure the “/usr/src/linux” link matches the downloaded kernel source[5]:

ls -la /usr/src/linux

Enter the directory and run “make menuconfig” to get to the kernel configuration editor.

A Few Tips for Configuring the Kernel

  • A good amount of details about the computer can be discovered with “lspci” (part of the “pciutils” package).
  • lsusb” can be useful for USB hardware (“lsusb” is part of the “usbutils” package).
  • It’s a good idea to build sound support into the kernel if you need it.
  • If unsure about an option, try adding it as a module – these can be specified to load or not load at boot time.
  • More information can be found on the kernel in the Gentoo Handbook.

When the kernel config file is finished, compile the kernel, the modules, and install them:

make clean bzImage modules modules_install install

Now the modules that were created need you need to specify which ones you need to boot.

find /lib/modules/ -type f -iname '*.o' -or -iname '*.ko'

Now add the ones needed to /etc/modules.conf. Gentoo hasn’t added OpenRC to it’s stage3 yet but that should happen soon. When that happens you’ll have to add modules to /etc/conf.d/modules. See the OpenRC migration guide for details.

Filesystem Information

The fstab file contains storage devices (drives and partitions), their mount points and any options that will mount at boot time. The “/etc/fstab” file must be edited manually with the storage units you plan to be use.

An example fstab file:

# /etc/fstab
# static file system details

# <file system> <mount point> <type> <options> <dump> <pass>
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
/dev/hda3 none swap sw 0 0
/dev/hda4 / ext3 noatime,defaults 0 1
/dev/cdrom /mnt/cdrom auto noauto,user 0 0

Unique device nodes (UUID’s) can be used too that can prevent possible device conflicts. Take a look at this.

Setup the “/etc/mtab” file here too. Usually the system discovers what filesystems are mounted and adds them to this file, but since this isn’t a full system yet, it needs to be created for your bootloader later:

grep -v rootfs /proc/mounts > /etc/mtab

Configuring the Network

Naming the pc is important so people on a network can recognize you. This is done with a hostname. A good practice is to name the computer <owner>-<machine> but people can name them anything – after famous philosophers, your favorite Gentoo developers… Open /etc/conf.d/hostname

HOSTNAME=”smith-dell”

Add the hostname boot script to run at startup:

rc-update add hostname default

Hostname will also need to be set in “/etc/hosts” so some programs can become aware of it:

127.0.0.1 smith-dell localhost

Setting a domainname is primarily used if the computer is to be server or if on a specialized network. Most people can ignore this setting.

Networking with DHCP

Most ISP’s (Internet Service Providers) use dhcp (network discovery) that makes setup easy.

Type “ifconfig” to see if your devices have been recognized. There should be a “lo” (loopback) device (necessary for some programs to access the network) a wired interface (eth0 is a common wired interface) and possibly a wireless interface (eth1, ath0…).

Any wired/wireless device will have to be linked to net.lo for the boot init system to recognize it.

ln -s /etc/init.d/net.lo /etc/init.d/net.eth0

Wait until reboot to see if the wired/wireless devices connect to the internet. Networks that require greater configuration can be done in “/etc/conf.d/net“, see the Gentoo Documentation links below.

Now the init script needs to be added to load at boot:

rc-update add net.eth0 default

Adding System Daemons and Tools

Daemons are constantly running programs that provide necessary services. Each service is listed below, or for ease of install, with one command:

emerge sysklogd vixie-cron slocate ntp acpid \
&& rc-update add sysklogd default && \
rc-update add vixie-cron default && && rc-update add acpid default \
&& rc-update add ntp-client default

The System Logger logs many events (good for debugging problems):

emerge sysklogd && rc-update add sysklogd default

Cron Daemon schedules programs to run at a certain times.

emerge vixie-cron && rc-update add vixie-cron default

Indexing Files for quick searches, use slocate to index files:

emerge slocate

ACPI (Advanced Configuration and Power Interface) is used by most modern computers for power saving, suspend…

emerge acpid && rc-update add acpid default

NTP client (Network Time Protocol) keeps the computer in sync with an internet time server.

emerge ntp && rc-update add ntp-client default

File System Tools, if using another file system beside ext2/3, you’ll need their tools – xfsprogs, reiserfsprogs, jfsutils.

Check out what boot scripts are to load to be sure you got them all:

rc-update show

Adding Password and User

Root doesn’t have a password yet, so give it one and also create a new user.

passwd

If you need to create a regular user (not root) and you made a home partition (/home) partition, it needs to be mounted now [4]:

mount /dev/devicename /home

Now add a new user. Groups give the user permission to do certain tasks. Add a user to the wheel group to allow the user to ‘su’ to root. Other programs you add later may require you add a group to gain certian permissions (a developer note will usually tell you when you have to do this).

useradd -m -G adm,audio,cdrom,cdrw,cron,portage,users,usb,video,wheel -s /bin/bash USER
passwd USER

Warning: For the install, root user is being used for installing but besides this process it is not a good idea to log in as root. Login as regular user and use ’su‘ to log into root when you need administrative priveledges.

Configuring the Bootloader

A boot loader is required to load Linux. The boot loader should almost always be installed in the Master Boot Record (the first 512k of the disk – not partition). The MBR defines partitions, partition types, labels, whether it’s bootable… Getting this right is very important. Grub is the preferred bootloader, installing makes it the default system bootloader and will boot both Windows and Linux.

Grub nomenclature is different for devices. The first disk it recognizes is called “hd0“, the first partition it sees is “0” So the Linux root partition located on the first hard drive on the first partition, is labeled “hd0,0“.

First, the Grub configuration file (/boot/grub/grub.conf) needs to be created manually:

Here’s a sample grub configuration file:

# /boot/grub/grub.conf

# Default system to boot, 0 is first,…
default=0
# Timeout to wait before automatic loading of default system
timeout=10

title Gentoo Linux 2.6.27-r1
root (hd0,4)
kernel /boot/kernel-2.6.27 root=/dev/sda5

title Gentoo Linux 2.6.27 (Rescue)
root (hd0,4)
kernel /boot/kernel-2.6.27 root=/dev/sda5 init=/bin/bb

title Microsoft Windows Vista
rootnoverify (hd0,1)
makeactive
chainloader +1

Grub also looks for kernel images relatively. So if a person has created a separate /boot partition the correct path would be “kernel-2.6.27” instead of “/boot/kernel-2.6.27“.

The only require fields are default, timeout, title, root and kernel. You can also add password protection to the Grub, see Grub Password-Protection.

When done writing the grub file, create a link to it called menu.lst (this is required because grub looks for this file):

ln -sn /boot/grub/grub.conf /boot/grub/menu.lst

Install Grub the Easy Way

Grub developers recommend using “grub-install“, this usually works. If it doesn’t you’ll have to install grub manually.

grub-install –no-floppy /dev/devicename

“devincename” needs to be the hard disk your are installing Gentoo on. Often devicenames are “hda”, or “sda”. Grub needs to be installed at the beginning of the disk drive, not the partition.

Install Grub Manually

grub # Enters Grub shell
root (hd0,2) # Define where the “/” (aka root partition) lies”
setup (hd0) # Install Grub to the MBR
quit

Reboot

Now that your basic system is set up. Its a good time to see if it’s installed correctly. We’ll exit chroot here and umount the partitions:

exit && cd /
umount /mnt/gentoo/home /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo

Reboot (command is ‘reboot‘) and test the new system.

After you see if it boots to a command prompt, I’d recommend rebooting back into the LiveCD, chrooting again, and building from there so you have a browser… to work with.

Final Touches

Now you should update everything. Even though the stage3 is fairly new a good number of changes may have been made already. You can update everything with:

emerge –update –newuse –deep world

With everything installed, now check that all library links meet their dependencies in case any breaks occured during the build (requires gentoolkit):

revdep-rebuild

Now you can continue with the Gentoo documentation if for say you want to install a desktop.

For more on managing Gentoo take a look at Gentoo Linux Tidbits.

Troubleshooting and Notes

[1] If a distro CD refuses to boot, trying burning it to a DVD. Some BIOS’s have trouble with Linux CD’s.

[2] If Gparted makes a Windows install unbootable read Recovering Windows Boot

[3] If needing to use swap later a swapfile can be created:

dd if=/dev/zero of=/swapfile bs=1024 count=2097152
mkswap /swapfile
swapon /swapfile

[4] These two warnings will occur when there is no “/home” partition mounted before adding a new user (i.e. a “/home/user” folder beneath the “/home” partition”):

xauth: timeout in locking authority file
No directory, logging in with HOME=/

[5] With numerous kernel-sources, link “/usr/src/linux” is best done by:

eselect kernel list
eselect kernel set <no.>
Follow

Get every new post delivered to your Inbox.

Join 52 other followers