Saturday, September 29, 2007

WPA Supplicant

My /etc/wpa_supplicant/wpa_supplicant.conf:

#####

ctrl_interface_group=0

ap_scan=2

network={
ssid="My_SSID"
proto=WPA2
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk=This_is_a_64-character_PSK_generated_using_wpa-passphrase
}

#####

What I found out only after a very long time:

For example, if:
SSID = home
passphrase (the password you enter in your modem / router) = mypassword

The psk to be entered in wpa_supplicant.conf is generated using:
 

wpa_passphrase home mypassword

I.e: Do not enter your original password in the psk column, instead, use the psk generated using wpa_passphrase

If you want to enter your original password in the psk column, the password must be in quotation marks:

psk="mypassword"

Saturday, September 01, 2007

Download From YouTube

Here's a tool to download video clips from YouTube:

1. Download the python script youtube-dl

2. To use, just chmod 744 youtube-dl and then run the command

youtube-dl http://the-website-of-the-clip-you-want-to-save

3. The file will be saved as an *.flv extension and can be viewed with mplayer or player that has ffmpeg support.

Friday, July 27, 2007

View / Extract files in *.iso

The files in an *.iso file can be viewed without burning the image into a cd / dvd.

Execute as root: mount -o loop -t iso9660 /path-to-iso-file /mnt/cdrom (or wherever the cdrom device is mounted to)

nfg files

Files ending with .nfg can be converted to .iso by using the program nfg2iso

Installation of PC Bibliothek

1. Run ./setup

2. There may be an error regarding gcc. That can be solved by removing
/opt/officebib/libgcc_s.so manually.

3. Run officebib

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.