Tuesday, July 24, 2007

Debian Etch: Custom Install

The following is a how-to that was on my original blog and also posted at www.debian-administration.org. It is the first I ever did, and as such has a few rough edges.

As a not completely new Linux user I have been frustrated over and over again at all the extra bloat and apps that I will never use that gets loaded onto my system when I do an install. Debian was the second distro that I tried and have used many others since, but I keep coming back.
With Etch I finally decided to get my system MY WAY(tm). No excess junk and no excess apps. After I had played for a little while I came up with the way to do it, and since I had found very little in the way of easily human understandable documentation I thought I would share the process.

Now understand that what we are going to do is start from where I changed the installation.

1: netinst CD and an internet connection.

2: start the normal install process and proceed all the way to where it asks if you want to use a network mirror.

3: select NO for network mirror (we will change this in a minute)

4: reboot and log in root

5: edit the sources.list

nano /etc/apt/sources.list


add these lines

deb http://ftp.debian.org/debian etch main contrib non-free
deb-src http://ftp.debian.org/debian etch main contrib non-free



Then make sure to comment out the line with the CD in it with a # otherwise it will drive you nuts asking for that blasted CD that has nothing of anymore use on it.

Close and save the file (double check your spelling and make sure you didnt fat finger any keys like I constantly do)

6: type in the command

apt-get update


7: type in

apt-get install xserver-xorg-core xorg


There will be a few questions at the end, for now just go with the defaults.

8: while apt is doing its thing we need to make a decision.
Which login manager do you want to use? Unless you want to run as root all the time ( #1 bad idea by the way) we need a login manager. Here are the 3 I have used and comments on them.

xdm:

smallest and works well to get you going on your way. Highly configurable.



gdm:

easily configurable and adds libraries you need if you want to use the synaptic package manager. (also contains alot of the extra functions of xdm)



kdm:

largest and bloated, I list it only because I know a few people who like it. (my opinion)



It honestly makes no differance to us which you pick. For ease of configuration I'd suggest gdm, if your just setting up a single user machine and will never change your desktop interface xdm might be the way to go. Your choice (thats what Linux is about right?)It doesnt matter which desktop environment you are going to use, any of them will fire up what ever you happen to have

So we

apt-get install xdm/gdm/kdm



9: Next decision, what desktop package to put in?

GNOME:

If you want Gnome you have just wasted time reading this, thats what you would have gotten if you had continued on with the installation normally.



KDE:

very much like the operating system that comes from redmond, and nearly as bloated with worthless junk. I have this installed only because my wife likes it.



Fluxbox:

This is the one I use. Very small, fast, and configurable. Its a low frills let our programs use system resources instead of having the desktop environment hog it approach. Nor will this one load your system up with oddbits like Gnome or KDE, however both are integrated with it. So if you install your favorite Gnome app or KDE app it automagicly appears in your menu in fluxbox.



There are others you can use as well, if you have one you like instead, use it.

So we

apt-get install fluxbox/gnome/kde



9A: If you went with fluxbox because like me you wanted to control what apps are on your system instead of letting someone else decide what is right for you. Remember this, fluxbox doesnt ship with proggies AT ALL. so at the very least you will want to add a web browser.

apt-get install firefox

(my choice, again use what you like)

10: reboot and poof you should be up and running.

For those who are wondering this worked equally well on my desktop as it did my laptop. I hope this helps someone else who like me is still learning all the wonderful things that can be done with Linux, but needs a few pointers because face it, we arent all programmers and everyone has to start the process of understanding somewhere.

Since originally writing this how-to I have changed my minimal install technique, however since at this point I have stopped using Debian or Debian derived distros completely I doubt that a new how-to will be forthcoming any time soon.

Saturday, July 14, 2007

Off Topic: New Gun

OK, so this isn't about Linux, but this is too cool for words. I finally bought the gun I have wanted since I first heard of it. After first reading about this gun I went and found one to see how it felt and was surprised in that for a small cannon it felt like it was made for my hand. It fit perfectly. I'm talking about nothing other than the Smith and Wesson 500, a .50 caliber magnum handgun which has roughly three times the stopping power of a .44 magnum. Here are 2 pictures of this monster with a quarter in the picture for scale.



Sunday, July 8, 2007

Breaking Sabayon

OK, the learning curve is not as steep as I thought it would be, or its my ignorance talking. However I did a "world" update of the install I did from the 3.3 mini LiveCD and then immediately ran into a problem. This update basically brought everything in the system up to "testing" which I guess is a lot more testing than stable then I'm used to coming from Debian.

I wanted to back a few files off to DVD for later use. Namely all the files and updates to install World of Warcraft and Burning Crusade. This was so I could save myself some time later on if I had to reinstall, which I did and am doing as I write this. To do this backup though I fired up k3b, which I nearly always use and the system immediately hard locked and boy do I mean hard.

This is when I discovered that the system had been upgraded to the testing level. OK, can I downgrade my packages? Sure can, you can mix and match so easily its no even funny. you find out the package you want:
emerge -s *package name*

That will spit out available packages plus the one you have installed. The stable one is listed, usually the one thats available with a lower version number. To install that one instead all you have to do is:
emerge =*package name-version number*

Whammo your all fixed up.

OK I may be getting excited over nothing, but fixing and downgrading is something new and different for me. Who said Sabayon/Gentoo were for uber geeks? oh, wait I have, repeatedly. Its so much easier to reconfigure and/or fix screw ups its not even funny.

Anyway, More on the adventures of moving to Sabayon later.

till the have fun
~Az

Tuesday, July 3, 2007

Making the switch to Sabayon

For those readers who had read my old blog, or from elsewhere on the net you know that I am a huge fan of Debian. However I have become more and more disenchanted with it as time goes on. It started when I was doing a laptop installation and finished with a recent battle with my desktop.

Laptop issue:
Cpu frequency scaling (also an issue with my desktop). Its not enabled by default even if I selected laptop during the install. Come on guys every other distro out there enables scaling by default, and even when its not fully supported it defaults to the highest cpu speed not the lowest. Hell, even the Ubuntoids got that part right.

Desktop issues:
1: AM2 64x2 4600+ with either a abit AN9 32X or a Gigabyte M61P-S3 motherboard. CPU scaling AGAIN!!! With either board. Trying to get scaling to work on multiple installs fell on its face. Why you ask? It needs sysfs loaded, guess what didnt get loaded because my processor was misdetected on every install with either mobo and the wrong damn kernel got installed ... even using expert install.

2: CPU detection and kernel installation. Even though supposedly Debian now releases all the kernels with SMP support every time I install I get no SMP, I have to go and pick the kernel I want out of synaptic. Up to and including the testing (Lenny) net install as of 2 days ago.

These are things that arent just an annoyance for a desktop user, its a show stopper for anyone even thinking of deploying a server. If you cant get what every other distro in the world can get then your useless, wait let me say that again, useless, worthless, self absorbed, prissy prima donas. Debian used to have the reputation of being the best, you dont keep a reputation like that guys, you work at keeping it, and right now your loosing it.

PCLinuxOS, I love you guys even if you have a jerk or two doing forum moderation. Dig through my posts at LXer for that story. This is the distro that I have on my laptop, I installed on my 58 year old mothers laptop, and that I keep a couple of LiveCD's kicking around to hand out to people. Good job and well done. However there are things that I want to do that I cant with it. The documentation is SOOO wonderful that it took me 2 days to manage to get wine to compile from source correctly.

Back to the desktop, I ruled out Debian as the distro to go into it. So I went with Ubuntu 7.04, 6.10 worked well for me when I used it so what the heck I'll spin up the new one. That lasted less than 2 days, I cant even begin to describe just how clunky it felt. The speed wasnt there, the configuration options are worse not better. It just felt and acted wrong and after several lockups where I couldnt even 'ctrl alt f1' to get to a terminal to find and kill the offending culprit I decided it was as stable as a fart in high winds.

Enter Sabayon, a Gentoo derivative. Gentoo is NOT newbie friendly, I have tried it a couple of times and wandered off muttering "I'm not that big a geek". However when I first heard of Sabayon I went out and snagged the LiveCD and was suitably impressed. I liked its look and feel, as well as the overall approach to things. First off it loaded the nVidia drivers from the CD and also brought my wireless networking up (bcm4306) so all I had to do was enter the hex code I use for my router. Thats 2 really big pluses for it right there.

That test was a few months ago, so I decided to give their 3.3 livecd a look. On top of both the other pluses it came right up with KDE and Beryl working flawlessly (except I usually use fluxbox, so neither KDE or Beryl mean much to me. Except I hadnt seen Beryl work right out of the box before). I poked and prodded a bit (checked for cpu scaling) the decided to take the plunge. I knew just enough about source based distro's to know that I just entered into another steep learning curve. However 2 days later and the curve isnt as steep as I thought it would be. No real gotcha's so far ... well one, the user accounts I created during the live CD install never created the home folders so I had a little fixing to do once I figured out what happened.

All I can say is that 2 days in and Sabayon is fast, has taken my every little tweak without so much a cough, and blows the doors off of any other distro I have used before. I hope that it continues to do so, I'll get back later on that though. For the time being PCLOS is still staying on my laptop and will continue to be my newbie recomendation of choice.

~Az

Sunday, July 1, 2007

QEMU/KVM,and a trick

Ever wanted to play with a new distro without having to burn and then reboot into a liveCD or do an install into a spare partition that you may or may not have? QEMU has been an option for awhile, but lets face it, its slow. There are several options available to run up a virtual machine, i.e. a second operating system running inside and seperate from your already running operating system. Here we will be focusing on kqemu and kvm.

If your kernel is already 2.6.20 or higher you can run kvm, if its under then you will be using kqemu.

kvm is in sid/unstable so you will have to add that to your apt sources.
go root
nano /etc/apt/sources.list

add
deb http://ftp.debian.org/debian unstable

then
apt-get update
aptitude install kvm

After kvm and associated packages are installed it would be best to edit your sources.list again and comment out the line where you added in unstable with a # at the beginning of the line.

kqemu, which is technically a qemu accelerator instead of kernel level virtualization like kvm is available in Debian stable and there for as easy to install as:

aptitude install kqemu


You should have noticed if it wasn't already installed that qemu was installed regardless of whether you went with kvm or kqemu. Thats because both packages use qemu. So no worries, we need the qemu tools anyway.

OK so now we need to set a few things up.

If you installed kqemu then we need to load that module when we boot. I use nano, you can use what ever other editor you want.

Go root, then

nano /etc/modules


and add at the bottom of whatever list might be there

kqemu


For kvm you need to know something beforehand, whether you have an Intel or an AMD processor. It makes a difference in the module we are going to load on boot.

Go root, then

nano /etc/modules


If you have an Intel processor you will add at the end of the list

kvm-intel


If you have an AMD processor you will add at the end of the list

kvm-amd


Now that we have the modules ready to load, we need to make them accessible to you as a user.

adduser $USER kvm
adduser $USER kqemu

depending on which you installed.

Congratulations, right now you should have everything just about ready to go. The problem is, even if you modprobe the modules active right now they still wont be usable to you, they need to be loaded against the kernel when you boot, so bookmark this page and reboot your computer, I'll wait here while you do.

OK so now we need to create a virtual drive to install our test distro to. I'll explain the parts of it after. From here on out everything is applicable to QEMU, Kqemu, and KVM. It is done as a normal user, so no more need to be root.

qemu-img create debian.img -f qcow 5G


The first bit is self explanatory, create an image (virtual drive) named debian.img. The next bit -f qcow tells it to format it in an inflatable structure. The 5G means a maximum physical size of 5 gig real hard drive space. The nice thing about this format is, if your VM installed only takes up 2.5 gig, then the virtual drive only takes up 2.5 gig of space on your real hard drive.

I guess the next thing that you'll be wanting to do is actually spin this up and try it out. I should note that I have had problems on occasion with KVM locking up during the install process, if this should happen to you drop back and use qemu with the same command line arguments. If you are using kqemu instead of kvm use qemu in the command line instead of kvm, kqemu is a module called by qemu when it starts. I'll be using kvm for the command line, you use what works for you.

I'm not ready yet to tell you how to start. A few things first if you don't mind. I usually make a seperate directory for my VM's because there are usually one or two files other than just the .img file. Such as an overlay file or two, which I will cover shortly and a script that simplifies launching the VM after its made. There are tons of command line arguments that can be added to the basic ones I am using here to get you started, the script is a huge time saver.

There are two basic ways to start this off, either with an .iso image or a CD/DVD. Lets start with an .iso image, the debian net-inst image in this case. We will assume for the sake of argument that the .iso is in the same folder as the virtual drive that you created is, and that it is also our working directory.

kvm -cdrom net-inst.iso -hda debian.img -m 512 -boot d


First this calls kvm and tells it that the .iso image is actually a cd drive, then the -hda debian.img is its hard drive. The -m 512 tells it that its a computer with 512 meg of memory. Careful here because this is the amount of physical memory that its going to block out for itself. Rule of thumb is no more than ½ of your actual physical memory. The final bit is -boot d, it tells it to boot from the cdrom drive.

kvm -cdrom /dev/cdrom -hda debian.img -m 512 -boot d


The only difference here is that your pointing it to your real cd drive here. If /dev/cdrom doesn't work for you then you can cat /etc/fstab and look there to see what you cdrom drive really is.

Now I mentioned that you might have problems doing an install using kvm, if this happens you have to explicitly tell qemu to not use the kvm module in the command line like this:

qemu -no-kvm -cdrom /dev/cdrom -hda debian.img -m 512 -boot d


Lets move on with the thought that you have installed your new virtual operating system. Your going to want to get in and play with it. The command for this is simply:

kvm -hda debian.img -m 512


With that you will be up and running in your new OS running inside your existing. However there is another trick that is really handy that will let you do whatever you want without permanently breaking this new creation, overlay files. Which basically takes a snapshot of your virtual drive and then run it from the overlay instead of the virtual drive. Really handy if you want to have several versions accessible but only have to do the install process once. Say like having a version of stable a version of testing and a version of unstable all available from the same install. To do this its as simple as:

qemu-img create -b debian.img -f qcow stable.ovl


To boot into this you just change the command line a little bit and tell it to use the overlay file you just made.

kvm -hda stable.ovl -m 512


As you can see the easy way to run multiple versions off the same install would be to do a base install of stable and then make your overlay file for it. Next you would make an overlay file named something like testing.ovl and another for unstable.ovl all from the debian.img that we made to start.

Then simply fire each up in turn via the overlay files, edit your /etc/sources.list to what ever you want and update yourself into debian nirvana.

My thanks to Scott Ruecker over at lxer.com for asking the question that started the process for this how-to. As I said though there are tons of switches that will add functionality to your virtual machine. More than I can adequately explain as I haven't managed to figure them all out yet either. This how to was written with the whole intent to get someone armed and dangerous before kicking them out the door and isn't intended to be all inclusive.

For more information on this topic you can start at qemu's authors site at:
http://fabrice.bellard.free.fr/qemu/qemu-doc.html

Have fun.
~Az

Starting Out

OK, I just deleted my last blog, all posts and comments are mostly gone. There does exist a bit here and there that found itself posted on other sites on the net. I will move those back here as soon as feasible. For the most part though all this blog will be about will be my adventures in the lands of Linux.