Sunday, June 17, 2007

Prevent Auto-Loading by Udev

1. To prevent services like net.eth0 from autoloading:

- Edit the file /etc/conf.d/rc
- Look for the line RC_PLUG_SERVICES=""
- Enter the name of the service that you don't want to be autoloaded in front of an exclamation sign: RC_PLUG_SERVICES="!net.eth0 !service2 !service3"

2. To prevent
modules like bcm43xx from autoloading:

- $mkdir /etc/modprobe.d (if the direcotry does not exist)
- create the file /etc/modprobe.d/blacklist
- Enter the name of the module: blacklist bcm43xx

Saturday, June 16, 2007

Information on Kernel Parameters

It can be found in this file:

/usr/src/linux/Documentation/kernel-parameters.txt

lspci: Unknown Device

If lspci shows a list of Unknown Device e.g.:

00:02.2 RAM memory: nVidia Corporation Unknown device 03ba (rev a1)
00:03.0 PCI bridge: nVidia Corporation Unknown device 03b7 (rev a1)


run "update-pciids" without the quotes. This will download a new version of the PCI ID list.

Friday, June 15, 2007

Installation of Wireless Card

After hours of trawling and sorting through the vast amount of information regarding this topic, I've finally managed to install my wireless card and get it working! First of all, some specs:

- lspci dermined the card to be: Broadcom Corporation BCM94311MCG WLAN Mini-PCI (rev 01) It is an 802.11 b/g WLAN
- PCI ID is 14e4:4311
- Laptop is Compaq Presario v3252AU running on AMD Turion 63 X2 and nVidia chipset

Two important things to do. Configure the driver from the kernel AND install the firmware with bcm43xx-fwcutter.

1. Using the driver provided by the kernel. Ndiswrapper is not needed. Configure the kernel to enable Generic IEEE 802.11 Networking Stack and the Software Mac add-on. This is important, because if the Software Mac is not included, the Broadcom driver will not be displayed in the kernel.

Networking --> [*] Networking support
Networking options --->
[ ] Amateur Radio support --->
< > IrDA (infrared) subsystem support --->
< > Bluetooth subsystem support --->
<*> Generic IEEE 802.11 Networking Stack
[ ] Enable full debugging output (NEW)
--- IEEE 802.11 WEP encryption (802.1x)
<*> IEEE 802.11i CCMP support
<*> IEEE 802.11i TKIP encryption
<*> Software MAC add-on to the IEEE 802.11 networking stack
[ ] Enable full debugging output
After that, check the Broadcom driver:

Device Drivers --> Network device support -->
Wireless LAN drivers (non-hamradio) & Wireless Extensions
<M> Broadcom BCM43xx wireless support
[ ] Broadcom BCM43xx debugging (RECOMMENDED)

(I'll update this part later. Not on my AMD com right now. So I am not sure if the display is the correct kernel configuration)
No 1 not finished.

2. After configuring the kernel to get bcm43xx loaded as module, install bcm43xx-fwcutter. We need to install the firmware using bcm43xx-fwcutter to make it work.

$ emerge bcm43xx-fwcutter (have to add net-wireless/bcm43xx-fwcutter ~amd64 to /etc/portage/package.keywords)

3. Installing the firmware
a. Get firmware from http://linuxwireless.org/en/users/Drivers/bcm43xx
The file is called wl_apsta.o
b. mkdir /lib/firmware
c. bcm43xx-fwcutter -w /lib/firmware /path/to/wherever_you_saved_the_firmware

- Either udev or hotplug is needed to load the firmware.

4. modprobe bcm43xx

Note:
1. The wireless toggle button and LED actually work. If I toggle the button to 'on', the LED changes from amber to blue when the module is loaded. If button is 'off', module loaded, card detected, but naturally the interface cannot detect any access point. I can also switch off the wireless using the button AFTER the interface has been detected. The only thing I cannot do, is to toggle the button to 'on' after booting and expect the interface to activate automatically. I have to reload the module again then, I think. Or restart net.eth1. I have to check which.

2. To do: Try to set up the wireless configuration. At the moment, very confused regarding iwconfig and wpa_supplicant.

Get rid of 'clock skew detected' error message

# go to your kernel source directory
cd /usr/src/
# update timestamp of all files
find . -exec touch \{\} \;
# delete old compiled stuff
make clean
# compile from scratch
make bzImage modules_install or whatever

Tuesday, June 05, 2007

Extract and cut audio from avi file

There's this particular clip in an avi file, whose audio I want to extract and convert to mp3.

1. mplayer movie.avi -edlout temp
- I can press 'i' to start to skip the sections that I don't want and 'i' again to 'unskip' the sections that I want.

2. mplayer -vc null -vo null -ao pcm -benchmark -edl temp movie.avi
- This will dump the audio as audiodump.wav according to the sections that I want in the edl file

* If I know the starting and stopping time of the section that I want extracted, I can skip step one and run this: (For example -ss 10 -endpos 26 = Stop at 1 minute 56 second... I think. Haven't tried this yet. Read it somewhere)

mplayer -vc null -vo null -ao pcm -benchmark -ss movie.avi

3. Then encode as mp3:

lame -h -b 128 audiodump.wav audio.mp3

Saturday, June 02, 2007

k3b cdrecord and cdrdao permission

K3b needs cdrecord and cdrdao to be given root permission. This can usually be done by clicking on k3bsetup. However, k3bsetup is only available when k3b is emerged with the kde flag, which will include the installation of kdesu which amounts to more than 23MB. I set the permission manually instead:

chown root:cdrom /usr/bin/cdrdao
chown root:cdrom /usr/bin/cdrecord

chmod 4755 /usr/bin/cdrdao
chmod 4755 /usr/bin/cdrecord

The first digit (4) after chmod selects the set-user-ID. What in the world does that mean? I found this explanation which I think is pretty clear:

SUID stands for Set User ID. This means that if the SUID bit is set for any application then your user ID would be set as that of the owner of application/file rather than the current user, while running that application. That means in case I have an application whose owner is ' root ' and it has its SUID bit set, then when I run this application as a normal user, that application would still run as root. Since the SUID bit tells Linux that the the User ID root is set for this application and whenever this application executes it must execute as if root was executing it (since root owns this file).

Just like SUID, setting the SGID bit for a file sets your group ID to the file's group while the file is executing. IT is really useful in case you have a real multi-user setup where users access each others files. As a single homeuser I haven't really found a lot of use for SGID. But the basic concept is the same as the SUID, the files whose SGID bit are set would be used as if they belong to that group rather than to that user alone.

Wednesday, May 30, 2007

USE Flags

I've just upgraded my profile to 2007.0 and then realised that many USE flags are missing. Then I switched the profile again to default-linux/x86/2007.0/desktop instead of just default-linux/x86/2007.0. (Note: no desktop in the latter). Anyway, to view the USE flags in a profile, just take a look at:

1. /usr/portage/profiles/default-linux/x86/2007.0/desktop/make.defaults

or

2. emerge --info

Here you get to see the configuration for emerging packages including the USE flags

Saturday, May 19, 2007

Encoding

The locale for my system is Unicode. Sometimes, when I use xchat or when I view a text file with xterm, umlauts are not displayed properly because the encoding is ISO-8859-1. So the commands are:

LC_ALL="en_US.ISO-8859-1" xterm

or

LC_ALL="en_US.ISO-8859-1" xchat

Thursday, April 19, 2007

Upgrade Kernel

I've read that it is not advisable to reuse the old kernel's configuration file unless it is just an upgrade from a kernel revision to another, ie 2.6.19-r1 to 2.6.9.19-r2. Apparently this is due to too many changes from one kernel release to another (Source: Gentoo Documentation Guide).

So here's a list of stuff that I should remember to edit when compiling a new kernel:

1. Change the processor to Pentium 4
2. Add NTFS support (I dual boot)
3. ATI open source drivers (as modules)
4. Sound modules

Will update the list whenever I remember something else

Fluxbox Alt-Tab

For some time I've noticed that when I minimise a window in Fluxbox, I cannot bring it up again with Alt-Tab. To solve this problem, enter the Deiconify option in ~/.fluxbox/keys:

Shift Tab :MacroCmd {Deiconify LastWorkspace} {NextTab 0}
Mod1 Tab :MacroCmd {Deiconify LastWorkspace} {NextGroup 0}

(Instead of just Mod1 Tab: NextGroup)

Monday, February 05, 2007

Subdirectories of Website

What a lousy title. What I wanted to jot down here is how you can prevent your webpage from showing the subdirectories and the contents of the directories online. For example, if someone has a geocities account and the webpage is geocities.com/XYZ with two subdirectories A and B. If A and B are used mainly for storing files and not part of the links to your webpage, you can prevent the files in those directories from being shown by adding an index.html file in the subdirectories. In the index.html file, you can enter whatever you want, e.g. Forbidden / No authorization to view this page / Go away / Whatever. Therefore, whenever someone opens geocities.com/XYZ/A, instead of getting a list of files which you have kept in A directory, they will only be able to view the index.html page. Ta da! That is probably elementary but it took me a while to figure it out.

Sunday, February 04, 2007

Vim Syntax Highlighting

I've been trying to understand how to get the syntax highlighting to work. I know that it works because when I create files like index.html or when I edit files like .bashrc or .bash_profile, there will be syntax highlighting. However, when I create a file for example 'fluxbox' in order to enter my startup script there, no colours appear even with setting ":syntax on". I was puzzled about that. After looking for a very long time, I finally found out:

1. The type of highlighting will depend on the extension of the file, which I have created. For example, if I create index.html, the colors will appear automatically. If the file was just named index, there will not be any automatic syntax highlighting even with html codes in it. I had to go through a few tutorials, before I found one which actually mention this!

2. You can force syntax highlighting for files with odd, different or no extension.
set: syntax=sh
set: syntax=html
set: syntax=php

and so on

3. You can check for the supported languages in /usr/share/vim/vim70/ftplugin

Thursday, February 01, 2007

Time

Being a time freak, I've started timing some of the processes using the command time.

1. $ time updatedb
real 11m23.021s
user 0m2.532s
sys 0m6.276s

2. $ time emerge qt
real 46m19.128s
user 28m45.472s
sys 3m7.316s

Monday, January 15, 2007

ATI Open Source Driver

Yesterday I finally ditched the ATI proprietary Linux driver and installed the open source driver. Two reasons:

1. ATI driver 8.27 does not work with the latest kernel. Have to install a newer version of the driver in order for it to work with the kernel.
2. However, ATI has dropped the support for radeon 9200/9250 SE from their latest driver.

Three methods to install the open source driver according to the Wikipedia.
1. Compile everything from the kernel.
2. Emerge the x11-drm module separately. I.e. do not choose 'Direct rendering support' while configuring the kernel.
3. Use the CVS drm source from xorg.

I chose the first method. After compiling kernel:
1. Edited my /etc/modules.autoload.d/kernel-2.6 file
via-agp
agpgart
radeon

2. Edited my /etc/X11/xorg.conf file

## Important bits
Section "DRI"
Mode 0666
EndSection

Section "Module"
Load "dbe"
SubSection "extmod"
Option "omit xfree86-dga"
EndSubSection
Load "freetype"
Load "dri"
Load "drm"
Load "glx"
EndSection

Section "Device"
Identifier "** ATI Radeon (generic) [radeon]"
Driver "radeon"
Option "BusType" "PCI" ## I added this because without this line, x server will start, but it will lock up after I open any application. For example, the computer locked up after I opened xterm and type 'ls' or 'dmesg'.
EndSection

3. I tried playing sauerbraten after installing this driver and it worked fine. Unlike the hiccups that I had trying to play this game using the proprietary driver.


Monday, December 11, 2006

Refilling ink cartridges

I guess, I still haven't gotten the knack of refilling colour ink cartridges. I was careful not to inject too much ink and I also let the cartridge stand for a while before inserting it back into the printer. However, I think I didn't insert the needle deep enough when I was injecting the magenta and cyan into the cartridge. As a result, my printer now prints black, yellow and purple. Sigh...

I found a website where one can download videos of how to refill ink cartridges. Very informative and useful.

Sunday, December 10, 2006

Udev

Usually when I plug in a usb drive, it will be allocated a slot at /dev/sda* (* denotes number 1, 2, 3 and so on). However if there were 2 usb drives or more, the drives will be allocated slots (nodes or slots? I don't know the correct terminology.) at /dev/sd* where * denotes the alphabet a, b, c and so on. This is troublesome as I mount my devices manually using the rules at /etc/fstab and it is a bother changing the rules everything to suite the alphabet sd*. Therefore now I use udev to customise the naming of device nodes. This was done by following instructions at the Gentoo Wiki.

1. My udev rules are kept in the file /etc/udev/rules.d/10-local.rules

2. Examples of rules in the file are: 

BUS=="usb", SYSFS{serial}=="00000000000000000182", KERNEL=="sd?1", NAME="%k", SYMLINK="pdrive"
BUS=="usb", SYSFS{serial}=="000000899406", KERNEL=="sd?2", NAME="%k", SYMLINK="ipod" 

3. The serial number in SYSFS{serial} is obtain as follows:

a. udevadm -a -p /sys/path/to/hardware/info - which for my pendrive and ipod is actually /dev/sda. Therefore:

i. $ udevadm -q path -n /dev/sda
That will result in /block/sda
ii. $ udevadm -a -p /sys/block/sda


b. (i) and (ii) can be combined : udevadm -a -p 'udevinfo -q path -n /dev/sda' 

4. My rules used to read 

BUS="usb", SYSFS{serial}="00000000000000000182", KERNEL="sd?1", NAME="%k", SYMLINK="pdrive" 

Note the single equal sign. That used to work until udev was upgraded to udev-103. After that the double equal signs have to be used or else the udev rules will not load with errors of 'invalid rules' and 'subsystem' not found (something like that).

Saturday, November 04, 2006

Ubuntu - Gripes

1. I can't bloody see anything during bootup. Just the Ubuntu word and a progress bar.
- to rectify by editing /boot/grub/menu.lst and removing the words 'quiet' and 'splash'

2. A whole load of modules and processes which are not needed.

3. Slightly messed up xorg.conf; the wacom and the font thing

4. Gnome login problems

5. Gnome login problems

6. Gnome login problems

7. Gnome login problems

8. ...

9. ...

10. ...

Ubuntu - Installation

I installed Ubuntu 6.10 on the old computer yesterday. Pentium III 667Mhz, 128 RAM with a 3dfx Voodoo graphic card and Soundblaster-I-forgot-the-model sound card. Dual-boot with Windows by the way. I encountered the paradise of problems - GDM, gnome and X server. I did this, did that, got nowhere, created new problems and the list goes on. So I reinstalled Ubuntu again today. And here goes the log:

1. No problems during installation. I had to use the text-mode installation method using the alternate-iso-cd because the other live-desktop-whatever-it-is-called-i386 iso needs 192 MB RAM.

2. Rebooted after installation. Arrived at login screen of gdm. Entered username and password. Gnome started. Halfway-through the startup, the login screen appeared again. Entered username and password. Gnome started, this time without a problem. But why do THREE Nautilus windows have to be started??

3. Update package manager popped up a screen with 2 new updates; imagemagick (I think) and something else. Updates completed without problem.

4. Checked .xsession-errors. Had to edit xorg.conf to:
a. remove all entries which had anything to do with wacom, stylus, cursor and can't-remember (something to do with tablet pc)
b. edit the Font paths in which 'X11' and 'fonts' were in reversed position

5. Checked all the other log files: Xorg.0.log, dmesg, faillog, ... no apparent errors.

6. Ran gdmsetup. Made sure 'Accessible login' was not enabled. Read somewhere that enabling this can cause some kind of errors.

7. Edited startup programs. Later saw some error messages which said that the autostart file cannot be edited. Have to check to see if ~/.config/autostart is under root.

8. Rebooted again. Say hello to 'PROBLEMS'.

7. Login screen keeps on appearing after I have entered username and password for Gnome Session.

8. Nautilus and nothing else pop up after logging into Gnome Failsave. Couldn't even find a way to bring up a terminal. I think I got an error message about Gnome Settings Daemon and dbus.

9. Login into Terminal Failsave successful but there was no detectable error messages.

10. Decided to call it a night.


Sunday, October 15, 2006

List of Installed Packages

$ equery list