woensdag 31 oktober 2007

Using proxy with Debian for apt-get(or Ubuntu) and other apps

If you are in a corporate environment you probably need to pass through a proxy to get on the internet.

The same for getting your debian/ubuntu packages.
You can easily configure this.

There are two possibilities:
  1. Define http_proxy variable for HTTP
    export http_proxy="http://user:password@proxy-dns-name-or-ip:portnumber"
    If you want to use this in a script, make sure you run it as follows:
    . ./proxy-script
    For FTP it is slightly different:
    export ftp_proxy="http://user:password@proxy-dns-name-or-ip:portnumber"
    For RSYNC (NOTICE that there is NO http:// at the start of the value):
    export rsync_proxy="user:password@proxy-dns-name-or-ip:portnumber"
  2. Adding this to the apt.conf file (does only makes apt-get to use the proxy)
    Aqcuire::http::Proxy "http://user:password@proxy-dns-name-or-ip:portnumber"
This will work for alot of shell tools (ftp, wget, ...) but some programs do create there own system for using a proxy.
  1. Firefox: "Edit", "Preferences", "Advanced", "Network", "Settings" and then select "Auto-detect proxy settings for this network"
  2. In KDE you can also change the proxy using the Control Center. Just search on proxy and you will find it
  3. (to be continued)

Hopes this is helpful.

Using Debian Lenny (testing)

I needed Debian Lenny (testing) to get my graphics working.

This is how you do it:
  1. edit /etc/apt/sources.list and replace "etch" with "lenny"
  2. update the apt cache
    apt-get update
  3. Now you can upgrade your packages:
    apt-get upgrade
  4. And finally:
    apt-get dist-upgrade


Ain't that easy?

HDA Intel Audio on Dell Latitude D630 (tested on Debian)

First let us look what hardware my audio card is:
lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 02)

More detailed:
lspci -vv | grep -i audio
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller
(rev 02)
Subsystem: Dell Unknown device 01f9
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Step
ping- SERR+ FastB2B-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort-
<MAbort- >SERR- <PERR-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 21
Region 0: Memory at fe9fc000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3ho
t+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [60] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0
Enable-
Address: 0000000000000000 Data: 0000
Capabilities: [70] Express Unknown type IRQ 0
Device: Supported: MaxPayload 128 bytes, PhantFunc 0, ExtTag-
Device: Latency L0s unlimited, L1 unlimited
Device: Errors: Correctable- Non-Fatal- Fatal- Unsupported-
Device: RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
Device: MaxPayload 128 bytes, MaxReadReq 128 bytes
Link: Supported Speed unknown, Width x0, ASPM unknown, Port 0
Link: Latency L0s <64ns, L1 <1us
Link: ASPM Disabled CommClk- ExtSynch-
Link: Speed unknown, Width x0
Capabilities: [100] Virtual Channel
Capabilities: [130] Unknown (5)

Ok, it seems that I need the hda-intel modules.
But it looks like the necessary modules are already loaded.

This is what you have to do to fix this:
Download this source tarball:
wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.15rc3.tar.bz2
tar jxvf alsa-driver-1.0.15rc3.tar.bz2
cd alsa-driver-1.0.15rc3
./configure
make
make install # as root


Source: http://forum.ubuntu-nl.org/topic/14940/1

To configure alsa for your audio card use alsaconf:
apt-get install alsa-utils
alsaconf

Select the appropriate card (hda-intel)
Be sure your audio channels aren't muted
alsamixer

See for the "front" channel, it should have "00" at the bottom.
If there is "MM" instead of "00" under the channel it is muted; use the "m" on your keyboard to unmute.

That's it!

HINT: if you have problems getting your audio to work it is always good to use the testing (lenny branch) for apt-get and update your system(or only the packages that have to do with alsa).

Powered by ScribeFire.

Installing Debian 4.0r (amd64) on KVM (KQEMU)

First you create a image to install debian on:
qemu-img create -f qcow debian.img 5G

The -f option tells what the format of this image is.
vmdk is for VMware compatible images.
raw does create the image and allocates the whole size immediately.

The qcow advantages:
  1. qcow does only allocates the size that is used. So if you create an image of 5GB (like above) and install a 200MB distro on it, the file will only be 200MB
  2. Snapshot support, where the image only represents changes made to an underlying disk image
  3. Optional zlib based compression
  4. Optional AES encryption
Source: http://www.gnome.org/~markmc/qcow-image-format.html

So I use qcow.
If you want to see image information use:
qemu-img info debian.img

Now we can start the virtual machine:
/usr/bin/qemu-system-x86_64 -hda cluster-node.img -cdrom /dev/cdrom -m 348 -localtime -boot d -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,macaddr=00:18:8B:D9:41:2F,script=/mnt/vm/qemu-ifup

Note the "-boot d" which selects that I want to boot from the cdrom-drive that is defined by "-cdrom /dev/cdrom".
The -net part does has to do with network bridging and it depends on what networking you want for your VM.

I can boot into the net-install disk just fine.
But after selecting my language and keyboard layout Qemu crashes with an "unknown return code":(.
This will probably a bug, so lets try to install without kqemu support (KVM) and see after installation if all goes fine:
/usr/bin/qemu-system-x86_64 -hda cluster-node.img -cdrom /dev/cdrom -m 348 -localtime -boot d -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,macaddr=00:18:8B:D9:41:2F,script=/mnt/vm/qemu-ifup -no-kqemu

Now the installation goes fine... UNTIL installing GRUB (the bootloader).
grub-install just hangs there (retried it and let it wait for like half an hour).
Eventually I killed the processes and tried it manually:
grub-install /dev/hda

This gives following error:
/dev/sda does not have any corresponding BIOS drive

So first I tried this to rebuild the devices.map file:
grub-install --recheck /dev/hda

Didn't help, let's try it the ultra-manual way :p (the way I love it the most). Run grub and then:
install (hd0,0)/grub/stage1 (hd0) (hd0,0)/grub/stage2 p (hd0,0)/grub/menu.lst

Same problem :(

Now I looked what the mounts were, and /boot was not the hard drive partition.
So I mounted the /boot partition on my hard disk to /boot:
NOTE: Boot with a linux rescue cd and mount the hard drive... the install environment is clumsy because it is so limited.
mkdir /mnt/tmpboot
mount /dev/hda1 /mnt/tmpboot
mount -o bind /boot /mnt/tmpboot
grub-install /dev/hda

This went smoothly.


After installation I started the VM (same command as above but without "-boot d") and that went fine.
But when removing the -no-kqemu I it did crash again.


TODO:
  1. Try with kqemu on my arch-linux system (maybe the bug does not exist there)
  2. If the first does not solve it, try another boot cd
  3. Try with i386 boot cd instead of amd64

maandag 29 oktober 2007

KVM, KQEMU on Debian (Lenny)

On my arch linux I had a virtual machine for using Windows (I use Windows at work).
So I wanted this also on Debian.

I have to say it took me some time to get it done. But in the end it seemed a ./configure misconfigure.

NOTICE that your hardware should support the vanderpool extensions (intel; dont know for amd).
Check this by doing:
cat /proc/cpuinfo | grep vmx

And also be sure that it is enabled in your BIOS!
DO CORRECT all values according to your kernel version etc.


We need kvm and kqemu(kvm enables the virtualization of your hardware).

First we need the kernel sources:
- search the correct package name with:
apt-cache search linux-source
Then, in the results I see the exact package name. Install:
apt-get install linux-source-2.6.22
We also need the sources for kqemu:
apt-cache search kqemu
Install:
apt-get install kqemu-common kqemu-source kvm
Despite what is on the qemu website, I've found that the kqemu accelerator does not compile if you have not at least compiled a kernel in the kernel source directory.
==> http://blog.unixlore.net/2006/03/using-qemu-and-kqemu-under-debian-or.html

Compiling it is enough, you dont need to install it.
cd /usr/src
tar xjf kernel-source-*.bz2
ln -s kernel-source-* linux
cp /boot/config-2.6.22-2 /usr/src/linux/.config
cd /usr/src/linux && make oldconfig && make bzImage

Now we can configure, compile and install kqemu (dont use the symlink "linux" because it points to the kernel headers):
NOTE: In later versions --kernel-path is changed to --kernel-dir
./configure --kernel-path=/usr/src/linux-source-2.6.22

If you don't specify the kernel path you will get this while compiling (make):
ld -r -o ../kqemu-mod-x86_64.o kernel.o x86_64/kernel_asm.o
make[1]: Leaving directory `/usr/src/modules/kqemu/common'
make -C /lib/modules/2.6.22-2-amd64/build M=`pwd` modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.22-2-amd64'
Makefile:275: /usr/src/linux-headers-2.6.22-2-amd64/scripts/Kbuild.include: No such file or directory
make[1]: *** No rule to make target `/usr/src/linux-headers-2.6.22-2-amd64/scripts/Kbuild.include'. Stop.
make[1]: Leaving directory `/usr/src/linux-headers-2.6.22-2-amd64'
make: *** [kqemu.ko] Error 2
Do this to clean and start the correct way to solve this:
make clean
Compile and install:
make
make install # as root user

Now you should be able to load the module:
modprobe kqemu
Also load kvm for your CPU:
modprobe kvm-intel # for Intel CPUs
modprobe kvm-amd # for AMD CPUs
You will need this:
apt-get install libsdl1.2-dev
Do this for auto loading the necessary modules:

cat >> /etc/modules
kqemu
tun
^D

NOTE ^D is CTRL-D

Let's create our virtual disk(a dedicated disk will provide far better performance; also be sure you have alot of memory):
qemu-img create disk.img 10G


Start the Virtual Machine:
qemu-system-x86_64 -m 384 disk.img -cdrom cdimg.img -localtime


-m tells qemu how much memory should be reserved for the VM.
-cdrom determines what your cdrom drive is in the virtual machine.
You could also use /dev/cdrom here but sometimes this gives some problems.
-localtime gives the time on your hostmachine as the time for your VM.


I will later talk about howto setup networking for your virtual machine.

dinsdag 16 oktober 2007

How to install Intel GM965 Graphics (X3100 chip; intel video driver) on Ubuntu

Unfortunately the Ubuntu install CD does not supports the 965 chipset graphics card yet so the graphical install will not work.

This is how to install ubuntu anyway, and after it install the graphics driver

  1. Download the Alternate Installation ISO and install it

  2. Then download and install these packages:

    • gcc-4.2-base_4.2.1-5ubuntu4_amd64.deb
    • libc6_2.6.1-1ubuntu9_amd64.deb
    • libgcc1_4.2.1-5ubuntu4_amd64.deb
    • tzdata_2007f-3ubuntu1_all.deb
    • xserver-xorg-core_1.3.0.0.dfsg-12ubuntu8_amd64.deb
    • xserver-xorg-video-intel_2.1.1-0ubuntu6_amd64.deb
    If you have downloaded them, go to the directory where you put them.
    Now install all of them by doing this in a terminal (console; tty):
    sudo dpkg -i libgcc1_4.2.1-5ubuntu4_amd64.deb gcc-4.2-base_4.2.1-5ubuntu4_amd64.deb libc6_2.6.1-1ubuntu9_amd64.deb
    sudo dpkg -i tzdata_2007f-3ubuntu1_all.deb xserver-xorg-core_1.3.0.0.dfsg-12ubuntu8_amd64.deb
    sudo dpkg -r --force-depends xserver-xorg-video-i810
    sudo dpkg -i xserver-xorg-video-intel_2.1.1-0ubuntu6_amd64.deb
    The dpkg -r --force-depends removes the i810 driver even if the intel driver isnt installed. You should have OR i810 OR intel. This is why I first force to remove it, even if the intel driver is not there. After it I install the intel driver.
    (mind that with package removal there is no version number and architecture, only the name)


  3. You can test if it works by doing
  4. sudo X -configure
    and then
    sudo X -config /root/xorg.conf.new
    Now if you get a grey background with a pointer then it is working :D
    Now end X and copy the config by doing:
    CTRL-ALT-BACKSPACE
    sudo cp /root/xorg.conf.new /etc/X11/xorg.conf
    Does linux rocks? HELL YEAH :D

    Probably you have to install your windowmanager and loginmanager ( kde+kdm / gnome+gdm / ... + xdm ).

Gentoo vs Sabayon

I have been a Gentoo user for a while but lately gave it up and tried ArchLinux.
The reason was that packages sometimes break and all the compiling and the lengthy install process.
What I really really like about gentoo is the package management. For each package you can choose whether you want the stable (extensively tested) or the unstable (you shouldn't take this unstable not very literally; ~x86) version.
Further, it is possible for each package to determine which specific version you want. Or if a version does not work, you can just mask it and it will go back to the old version.
If there is a newer version (than the masked one) it will be installed.

Now, Sabayon Linux is based on Gentoo.
But it uses an overlay (package repository that the Sabayon team have made available).
Also it has a very easy and fast installation. It let's you choose between a desktop (KDE, Gnome, Fluxbox) install and for example a server (core install).
Sabayon has announced Enthropy, which is a package manager which uses precompiled packages. Yes, indeed this has some disadvantages for optimizing all packages for your architecture but it saves you loads of time and it will still be possible to compile the packages.

So be ready for some post about Sabayon Linux

My test system

My test system is a Dell Latitude D630.
As the hardware is quite new there are some problems getting everything to work.
But this makes it even more interesting.

Here is the hardware present shown by the lspci output:

00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 0c)
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Contoller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 02)
00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 02)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 02)
00:1c.5 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 6 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f2)
00:1f.0 ISA bridge: Intel Corporation 82801HEM (ICH8M) LPC Interface Controller (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 02)
03:01.0 CardBus bridge: O2 Micro, Inc. Cardbus bridge (rev 21)
03:01.4 FireWire (IEEE 1394): O2 Micro, Inc. Firewire (IEEE 1394) (rev 02)
09:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5755M Gigabit Ethernet PCI Express (rev 02)
0c:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)

If someone wants the lspci -vv output you can ask me.

Introduction

Hi all,

I am a Linux/BSD enthousiast. Some of the distros I used where Ubuntu, Fedora, Gentoo, FreeBSD, ...
I would like to do my part to make the world a better place, but murder is illegal. :)
So instead I will document my experiments here so it can be of use for other people.

But there is more in life than Linux/BSD (is there actually? :p )
So once in a while you will find some thoughts coming straight from my disturbed mind. ;)

I hope I, and you will enjoy this blog and/or find it useful.

Comments are always greatly appreciated!