Monday, October 23. 2006Desktop FreeBSD: the right way
There is a number of reasons why I decided to write an article about how to setup a FreeBSD desktop. One of the reasons is the article on "Open For Business" called "Desktop FreeBSD: Fully Optimized 6.x Installation". While I agree with the author on some of the steps of the procedure he is suggesting, I would like to chip in 2 cents worth of my experience in running solely FreeBSD as my desktop of choice for over 6 years. Also, I wanted to criticize author's choice of software. Pico? KDE? Give me a break. There is no way you can build an optimized and efficient desktop with such software. I'm explaning it later in the article.
As one can find from my previous articles I like to optimize stuff. What I like even more is to configure my desktop to be as efficient as possible. Let me define what efficiency really means for me. Efficiency is when you spend less time on doing something. While I understand that I'm far from being perfect myself, I do try to make use of every second I spend while working on my workstation.
It's also important to initially spend some time setting up your ideal desktop. In my opinion, you can cut down idle time you just have to sit and wait in: 1. startup 2. execution 3. use of application I'm going to make some assumptions: - super bare minimum distribution set FreeBSD is installed. There is really no need for docs and no need for sources at the time of installation. All you need is just the bare minimum of binaries which include everything you ever need to get and build everything else. details - you have pretty good connection to the Internet - your PC is i386 arch - latest ports from CVS(up) are in /usr/ports and latest OS sources are in /usr/src. details 1. Startup By startup I mean how long it takes for an application to start right after you execute it or for OS to boot after you push the power button on your PC. Let me break down different pieces of what can be sped up: phase 1 - from the time you press the power button on your PC to when you see FreeBSD boot loader screen phase 2 - from the time kernel starts to load to when you see the login prompt phase 3 - from the moment you execute a binary of your desktop application to when you can start using the application. Startup: Phase 1 You should know the BIOS on your motherboard fairly well to configure it for a quick bootup. Usually the following things help: - disable autodetection of all IDE devices. Detect them in the bios and save the drive(s) configuration. The bios won't have to query your device every time your PC starts - some BIOSes have a setting called quick startup. Usually what it does is skips tests of certain parts of your system for quicker startup. - disable all peripherals you never use. I usually disable all serial and parrallel ports, floppy controller, firewire etc. If I'm building a server I also disable USB, on-board sound card(if any) etc. - read your BIOS manual for more. Some motherboards have a ton of settings you can play with which will make a big difference in the time it takes to pass the BIOS startup phase. Startup: Phase 2 FreeBSD comes with a GENERIC kernel that has a lot of commonly used drivers compiled in it. You probably don't need about 70% of everything that's in that kernel. You can save yourself pretty good amount of time by recompiling the kernel to exactly fit your hardware configuration. To do that start by looking in /usr/src/sys/i386/conf/GENERIC. That's that kernel's build configuration file. What I usually do is I make a copy of that file in the same directory and start commenting stuff out. A good guideline to what to disable in your new kernel is to see what is in 'dmesg' of your latest OS boot. Comment out everything you know you don't have and comment out everything you know you have but don't need(should be disabled in the BIOS too). After you are done with editing the kernel config file, compile it and install it. If that's the first time you are compiling a new kernel out of fresh sources that you downloaded, you might want to recompile all the system binaries too. Before actually compiling the kernel, please read "Startup: Phase 3" section about what /etc/make.conf can do for you. Startup: Phase 3 All binaries that come with any FreeBSD distribution set are compiled to be as compatible with as many PCs out there as possible. That's why I'd recommend recompiling them to be as optimized as possible specifically for your PC. To do that start by copying /usr/share/examples/etc/make.conf to /etc/make.conf and start making changes. You can specify your CPU type, which will apply to anything you build in the future. And of course the same rule applies to other parts of make.conf: disable everything you don't need. I usually disable a ton of stuff like: bluetooth, games, IPv6, info files, printing stuff, sendmail etc. What I also disable is building and installing kernel modules. I beleive that if you compile you kernel right, there is no need for external modules. However, even if such need arises, usually, it is for one or two modules and it is quite easy and fast to compile and install them by hand. If you decide to disable building and installing kernel modules in FreeBSD 5.x or 6.x, keep in mind that you still need to build at least acpi.ko, because 5.x and 6.x kernels prefer it to be external. Another thing you can do is to make sure that all the binaries that you build from ports are stripped. Since stripping helps in reducing the size of the binary, you can cut down the time it takes for the binary to be read from the disk. Certain pieces of software I actually build by hand without relying on the ports tree. There is an article about how I build and configure my browser. I make sure it has only the features I need and not the rest of the junk that it usually comes with. Now lets go back to the article where the author recommends using KDE as window manager. The worst thing you can do to your desktop is to install something gigantic and super slow as KDE or GNOME. Not only you'll end up with a ton of unsed junk on your system, but also your desktop will be crawling wasting CPU cycles on worthless crap. I'd recommend using something way lighter. I personally use icewm. The flexibility of that tiny, yet powerful WM is just amazing. I fell in love with it 5 years ago and there is no way in hell I'm switching to anything else any time soon. Read the next section about why I think icewm makes very efficient use of your time. 2. Execution By execution I mean how much time it actually takes for you personally to launch the application that you need. Usually using mouse to execute something is highly inefficient. It can take you a minute, when you are trying to find the right icon to click on, or it can take you a split second to press a combination of the keys that you have configured to do the same thing. In my opinion, scrolling through menus looking for the right icon is extremely inefficient, in fact, I never use any menus to execute any of my applications. The goal is to configure everything in such a way where you don't touch your mouse at all. That's when icewm turns out to be extremely helpful. In $HOME/.icewm/keys file you can configure any number of shortcuts to run any number of applications. Here is just a short snippet of what I have in that file: #xterm full screen key "Alt+Ctrl+t" /usr/X11R6/bin/xterm -sl 8000 -bg black -fg gray -geometry 140x66 -cr green -bc -bcf 400 -bcn 900 -tn xterm-color -ms red -fn -misc-fixed-bold-r-normal--15-140-75-75-c-90-koi8-r #xterm half screen key "Alt+Ctrl+l" /usr/X11R6/bin/xterm -sl 8000 -bg black -fg gray -geometry 140x26 -cr green -bc -bcf 400 -bcn 900 -tn xterm-color -ms red -fn -misc-fixed-bold-r-normal--18-120-100-100-c-90-iso8859-1 #lock key "Alt+Ctrl+x" /usr/X11R6/bin/xlock -mode strange #browser key "Alt+Ctrl+m" /usr/local/seamonkey/bin/seamonkey If you want to execute some other application, which you rarely use, just press Ctrl-Alt-Space and type the command. Read for more icewm usability tips in the next section. 3. use of application In this section I could spend a lot of time telling about how to effectively use a bunch of applications. But it's not that hard for one to actually read the manual of the application to learn about all the things that can be optimized. I'd like to limit the scope of that section to a couple of things: - effectively using desktop space in icewm - effectively using desktop space in mozilla browsers - effectively using shortcuts for basic WM operations There is always a dilemma, at least for me, how to make the most use off my desktop space. On a single monitor, one can fit only that much. Fortunately, icewm(and most other WMs) provides us with the ability to have virtual desktops(VD). Initially, the important thing is to identify which applications you need running at all times. For me those are: email client(mutt in an xterm), browser(seamonkey), some IM application(gaim), xterm where I run mplayer to play music and a ton of xterms running a bunch of other stuff. I know that my email client is on VD#1, my browser is on VD#6, my IM application is on VD#7, xterm with mplayer is on VD#9. Once I had that memorized I don't even have to think about that any more. My fingers automatically press the right shortcut to get exactly where I need to be. I beleive that it is best to have no more than 3-4 windows on the same VD. If there are more, switching among them using keyboard becomes tiresome. I'm sure some kind of mozilla browser is the browser of choice for many people running FreeBSD. While it is pretty hard to completely get rid of using mouse when browsing, you can easily optimize your interaction with your browser by reducing mouse clicks. There are numerous shortcuts for doing all kinds of things, most of which save time and help reduce strain on your hand from switching from keyboard to mouse and back. Another thing I would recommend doing with your browser is to maximize the space that's devoted to the content you are browsing and not to some menus, buttons and other junk you never use. You can read about my recommendation about how to configure your seamonkey/firefox here. I would also highly recommend start using shortcuts for basic window operations. Icewm developers did an excellent job in making it very easy to move, resize, hide, close, rollup windows with easy to remember shortcuts. In addition, the configuration file itself gives you plenty of flexibility to configure it to your liking. Yes, everything I mentioned does take time to initially setup. And the gains you are getting from each section might seem tiny. Trust me, though, they all add up to quite big savings in your own time. And the time you spend optimizing your workstation initially, pays off very quickly. Trackbacks
Trackback specific URI for this entry
No Trackbacks
|
QuicksearchCategoriesBlog Administration |