33dots

Posts RSS Comments RSS

Archive for the 'Cent OS' Category

Enabling mic to work on Cent OS 5 for Skype

It was not possible to get mic working in my Skype in CentOS 5.
I did a lot of play with the Gnome Volume Control. Tried changing the device from Alsamixer to OSS Mixer back and forth. Tried with all the settings inside skype voice settings.. Messed with the Gnome System > Preferences > Sound . etc etc.

But nothing seemed to work. And my mic was working perfectly in windows with skype, so it was sure that its not related to mic but something related to alsa or skype.

Now the solution,
Most probably, it is because our Mic is not set as the ‘Capturing device’ in alsa.

So first check, whether your mic and sound recording is working.

Alsa comes with a program to record voice. Plug in your mic and do a,
[tony@localhost ~]$ arecord -vv -d 10 test.wav
speak something and it should get recorded. the -vv option shows a VU meter of your recording sound.

Now try to play it,
[tony@localhost ~]$ aplay -vv test.wav

If you hear it back, then your mic is properly working and sound recording is fine.
Then it should be a problem with Skype.

If not, as in the case with me, You will need to mess with alsamixer.
Start alsamixer in a new terminal
[tony@localhost ~]$ alsamixer

Press tab to go to ‘Capture’, This will list all the capture related stuffs. Pressing tab cycles between view modes like Playback, Capture and All.

Now, there will be items like Mic, Mic boost, Capture, Line, CD, Digital, Aux etc etc. Some of these devices will have a text called Capture written in red at the bottom of the volume bar. This is called Capture flag and this enables the recording on the device. .
Make sure you have Capture flag set on the devices Capture, and Mic. You could do this selecting the correct item(by Left/Right arrow keys] and by pressing space. When i checked mine it was incorrectly set on ‘Line’ only.

Also make sure you have max volume in in Mic boost, Capture and Digital. [Check the screenshot]

Capture settings in alsamixer

Now try recording, again.

If things work you could adjust the volume levels properly.
Also to can mute your mic so that sound is not produced by your speakers when you use Mic. Do this by going back to Playback [by pressing tab again] and selecting Mic and by pressing ‘m’. You will see a ‘MM’ if a device is muted and ‘00′ if its not. [check the screen shot]

Alsa mic muted

Take skype back and do the test call again to see f there is any change. :)

You can find more info at,
http://www.alsa-project.org/main/index.php/SoundcardTesting

7 responses so far

Revisiting File Access Modes in Linux

I recently found out that I’ve a messed up understanding of linux file access mode [or file permissions] :(
Like, i thought it was possible to rename/delete a file if we have the write permission on that file. Also i thought it was not possible to delete/rename a file if we[or our groups] don’t own, cant read or write a file. Both of them seems to be false.. pretty bad right?

Back to learning basics,
A file or directory(folder) is owned by a User(u) and a Group(g). There are three permissions read(r), write(w) and execute(x), which has different meaning for files and directories. Each of these permissions can be set for the user(u), the group(g) and others(o).
The root user, the one with UID = 0 has full access irrespective of any set permissions.

Lets take the case of files,
r(read) : Read the file, and also copy the file.
See the shell examples. Comments are included beginning with a #

[john@localhost test]$ ls -l
total 4
-r-------- 1 john john 9 Jul 29 12:18 testfile		#we only have read permission
[john@localhost test]$ cat testfile			#we read it
abcde...
[john@localhost test]$ cp testfile testfile2		#we copy it
[john@localhost test]$ ls -l
total 8
-r-------- 1 john john 9 Jul 29 12:18 testfile
-r-------- 1 john john 9 Jul 29 12:20 testfile2

w(write) :Write to the file. Add/change/append/remove content to it.

[john@localhost test]$ ls -l
total 8
--w-r-xr-x 1 john john 9 Jul 29 12:18 testfile	 #we have only write set on these files
--w-r-xr-x 1 john john 9 Jul 29 12:20 testfile2
[john@localhost ~]$ echo "abcde" > testfile
[john@localhost ~]$ echo "abcdef" >> testfile
[john@localhost ~]$ cat testfile		#we can write to the file
abcde
abcdef

But this does not mean we have the rights to rename/move/delete the file. This is actually controlled by the write permissions in the directory on which the file resides.

[john@localhost test]$ chmod u-w .	#we remove the write on the current directory
[john@localhost test]$ ls -l
total 8
-rwxr-xr-x 1 john john 9 Jul 29 12:18 testfile    #we have write access on these files
-rwxr-xr-x 1 john john 9 Jul 29 12:20 testfile2
[john@localhost test]$ mv testfile testfile3
mv: cannot move `testfile' to `testfile3': Permission denied
[john@localhost test]$ rm testfile
rm: remove write-protected regular file `testfile'? y
rm: cannot remove `testfile': Permission denied   #we cant rename/delete the file

x(Execute) : Run the script or program.

[john@localhost ~]$ touch script	#we create a file and try to run but fails
[john@localhost ~]$ ./script
-bash: ./script: Permission denied
[john@localhost ~]$ chmod u+x scrip	#we also set execute and runs it fine
[john@localhost ~]$ ./script
[john@localhost ~]$

Note that it is also required to have read permission for execution.

[john@localhost ~]$ chmod u-r script	#we remove the read
[john@localhost ~]$ ./script
bash: ./script: Permission denied	#not allowed

Now, the case of directories,

r(read) : List the contents of the directory. Also this enables TAB completion feature.

[john@localhost ~]$ chmod u=r test/	#we set only read access to directory test/
[john@localhost ~]$ ls  test/
testfile  testfile2			#listing works fine

Listing doesn’t mean we can read/access the files inside. Nor we could cd into the directory. These are controlled by the execute permission of the directory.

[john@localhost ~]$ cat test/testfile
cat: test/testfile: Permission denied
[john@localhost ~]$ cd test/
-bash: cd: test/: Permission denied
[john@localhost ~]$ find test/
test/
find: test/: Permission denied		#as you can see find/cat/cd etc not allowed.
[john@localhost ~]$ ls -l test/
total 0					#ls -l doesnt show details bcoz it cant
?--------- ? ? ? ?            ? testfile	#access the file for more details

This read permission only affects the directory which it is set and not its subdirectories. We can have an unreadable directory with readable subdirectories. However the execute permission must be set on the parent directory.

[john@localhost ~]$ chmod u-r test/	#remove read on directory test/
[john@localhost ~]$ ls test/		#we cant list test/
ls: test/: Permission denied
[john@localhost ~]$ ls test/sub/	#but we can list test/sub/
sub  subfile  subfile2

w(write) : Create, rename, move, delete files/folders. But we also need the Execute permission set, to do all these operations.

[john@localhost ~]$ chmod u=wx test/	#we enable both write and execute for test/
[john@localhost ~]$ touch test/testfile4
[john@localhost ~]$ mv test/testfile4 test/testfile5	#we are able to create and rename files

Its possible to delete/move/rename the files/folders that we[or our groups] don’t own, cant read or write.

[john@localhost ~]$ su
Password:
[root@localhost john]# touch test/testfile6	#we create a file as root user
[root@localhost john]# chmod a= test/testfile6	#we remove all the permission on this file
[root@localhost john]# ls -l test/testfile6
---------- 1 root root 0 Jul 30 13:00 test/testfile6
[root@localhost john]# exit
exit
[john@localhost ~]$ rm test/testfile6
rm: remove write-protected regular empty file `test/testfile6'? y
[john@localhost ~]$		#as you can see we were able to delete it as john.

A user can remove directories created by anyone, if he has write and execute permission on its parent directory. However, if it contains files, this is not possible.

[john@localhost test]$ ls -ld .		#we see that user john has write and execute
drwxr-xr-x 3 john john 4096 Jul 30 13:20 .
[john@localhost test]$ su
Password:
[root@localhost test]# mkdir test1 test2	#we make an empty and
[root@localhost test]# touch test1/testfile	#a non empty directory as root
[root@localhost test]# ls -l
total 20
drwxr-xr-x 2 root root 4096 Jul 30 17:17 test2
drwxr-xr-x 2 root root 4096 Jul 30 17:17 test1
[root@localhost test]# exit
exit
[john@localhost test]$ rm -R test2
rm: remove write-protected directory `test2'? y		#delete success as normal user
[john@localhost test]$ rm -R test1
rm: descend into write-protected directory `test1'? y
rm: remove write-protected regular empty file `test1/testfile'? y
rm: cannot remove `test1/testfile': Permission denied	#we cant delete the one with contents

The write permission too only affects the directory on which it is set and not its subdirectories. We can have an unwritable directory with writable subdirectories. However the execute permission must be set on the parent directory.

[john@localhost ~]$ chmod u=x test1/		#we enable only execute for the directory 'test1/'
[john@localhost ~]$ touch test1/subfile3	#cant write to test1/
touch: cannot touch `test1/subfile3': Permission denied
[john@localhost ~]$ touch test1/sub/subfile	#still we are able to create files in test1/sub/
[john@localhost ~]$ mkdir test1/sub/sub
[john@localhost ~]$ ls -l test1/sub
total 8
drwxrwxr-x 2 john john 4096 Aug  3 12:09 sub
-rw-rw-r-- 1 john john    0 Aug  3 12:39 subfile
-rw-rw-r-- 1 john john    0 Aug  3 12:04 subfile2

x(execute) :Access the files in the directory for reading, writing etc. Enables cd to it.

[john@localhost ~]$ chmod u=x test/		#we set execute on the directory
[john@localhost ~]$ cd test
[john@localhost test]$ cat testfile
abcde...
[john@localhost test]$ ls -l testfile		#cd/reading files  are possible
-rwxr-xr-x 1 john john 9 Jul 29 12:18 testfile
[john@localhost test]$ ls
ls: .: Permission denied		#listing not possible as we dont have read set

This also enables accessing the directory for write operations.

[john@localhost test]$ chmod u=wx .	# we set write and create items
[john@localhost test]$ mkdir test
[john@localhost test]$

Though directory execute permissions only affects the directory on which it is set, we are not allowed to access its subdirectories even if we have the appropriate permissions on the subdirectory. So we can say that execute permission on a directory has a fall through effect to all its child directories at any depth.

[john@localhost ~]$ ls -ld test1/
drwxrwxr-x 3 john john 4096 Aug  3 12:04 test1/
[john@localhost ~]$ ls -ld test1/sub/
drwxrwxr-x 4 john john 4096 Aug  3 12:41 test1/sub/
[john@localhost ~]$ ls -ld test1/sub/sub/
drwxrwxr-x 2 john john 4096 Aug  3 12:09 test1/sub/sub/
[john@localhost ~]$ chmod u-x test1/		#we remove execute on test1/
[john@localhost ~]$ touch test1/testfile
touch: cannot touch `test1/testfile': Permission denied
[john@localhost ~]$ touch test1/sub/testfile
touch: cannot touch `test1/sub/testfile': Permission denied
[john@localhost ~]$ touch test1/sub/sub/testfile
touch: cannot touch `test1/sub/sub/testfile': Permission denied
[john@localhost ~]$ ls test1/sub/
ls: test1/sub/: Permission denied
[john@localhost ~]$ mkdir test1/sub/sub2
mkdir: cannot create directory `test1/sub/sub2': Permission denied
[john@localhost ~]$	#as you can see we cant do anything in its child directories

By default read and execute permission is given in all directories for all users, except /root and user’s home directories and a few others. With read permission we can list the items and with the execute permission we can cd to them and access the items.
Without the execute bit set in / and /home we would not be able to create any files/folders in our home directory ~/ even though we have full permissions on ~/.

A directory with only execute set allows us to access the files but not list or write to it. This scenario is particularly useful in a ~/public_html/ directories where we allow a webserver to access our files but not list them.

[john@localhost ~]$ chmod u=x test1/
[john@localhost ~]$ ls test1/
ls: test1/: Permission denied
[john@localhost ~]$ cat test1/testfile
abcde...
[john@localhost ~]$ ls -l test1/testfile	#ls -l works bcoz ls can access the file
-rw-rw-r-- 1 john john 0 Aug  3 11:54 test1/testfile	#file to get its details..

Sticky bit
The sticky bit is used to avoid the default behavior of delete/rename/move the items inside a directory. When sticky bit is set, items inside the directory can be renamed or deleted only by the item’s owner, the directory’s owner, or the superuser. Without the sticky bit set, as we’ve seen earlier, any user with write and execute permissions for the directory can rename or delete contained files, regardless of owner.
Sticky bit is set on the /tmp directory to prevent ordinary users from deleting or moving other users’ files

[john@localhost ~]$ ls -ld /tmp			#/tmp has full permission for everyone
drwxrwxrwt 32 root root 4096 Jul 30 13:18 /tmp	#the last t shows that sticky bit is set
[john@localhost ~]$ touch /tmp/test		#we create files with two users
[john@localhost ~]$ su tony
Password:
[tony@localhost john]$ touch /tmp/test1
[tony@localhost john]$ exit
exit
[john@localhost ~]$ rm /tmp/test	#john is able to remove the file created by him
[john@localhost ~]$ rm /tmp/test1	#but not the one created by tony
rm: remove write-protected regular empty file `/tmp/test1'? y
rm: cannot remove `/tmp/test1': Operation not permitted
[john@localhost ~]$

Thanks to,
Introduction to Linux by Machtelt Garrels
Understanding Access Permissions by znx
And the Linux Info pages

No responses yet

Setting up Intel Pro 3945 ABG Wireless in CentOS 5

Mine is a Wipro Little Genius laptop, Model WLG7110, with the wireless card being Intel 3945 ABG.

The process involves installing Intel wireless driver iwl3945, Intel iwl3945-firmware, and enabling NetworkManager daemon to use it.

CentOS 5.3 or newer (ie, kernel 2.6.18-128 or newer) includes Intel iwl3945 driver by default. If you have an older version do a system update.

Some modern laptops require firmware to make the wireless network connection work on CentOS. The main reason for this is that wireless device manufacturers do not allow the free redistribution of the firmware that is required to make the device work.
Intel-firmware is available in RPMforge repository and not in default CentOS repositories. If you have not added RPMforge, do it now by installing yum-priorities and RPMforge as detailed in the below two steps.

Install yum-priorities, enable it and setup priorities by following the steps here. Yum priorities is required to prevent package conflicts between CentOS and third party repositories like RPMforge.

Install RPMforge by following these step. Make sure you have done everything correctly.

Then, install the intel wireless firmware by
yum install iwl3945-firmware

Reload the iwl3945 module:
rmmod iwl3945; modprobe iwl3945

Start the NetworkManager.
service NetworkManager start

Now the NetworkManager icon should be shown in the system notification area. Clicking on this icon, should list your wireless network (It may not be shown if you have SSID broadcast disabled in your router).
If it is not listed, there are options to  ‘Create a new network’ or ‘Connect to a hidden network‘ in case you have SSID broadcast disabled. You can specify your security settings like WPA/WPA2/WEP etc and other settings like DHCP/StaticIP here. Remember to add DNS info here.
[Please note that you do not need to try using iwconfig, ifup, wpa_supplicant etc etc. NetworkManager will handle all that.]

If things go fine, configure your CentOS system to automatically start the NetworkManager on startup.
chkconfig NetworkManager on

I was able to use WPA2 AES with SSID broadcast disabled.

The wireless LED remain off always. This led me into some troubles initially as i thought things were not working.
That’s all in it!

==================================

Some of the error’s I got,

“SIOCSIFFLAGS: No such file or directory Linux…”
I got this error message whenever i tried ‘ifup wlan0′ ‘iwconfig’ etc. In my case it was because the firmware was not installed. Once the firmware was installed it disappeared. In CentOS you can test whether the firmware is installed successfully by
ls /lib/firmware
This should list a file with name something like iwlwifi-3945-1.ucode

NetworkManager keeps on asking for keyring unlock password. This can be solved by exactly following the steps outlined here.

If i do a iwconfig i get the following error,
“Warning: Driver for device wlan0 recommend version 21 of Wireless Extension,
but has been compiled with version 20, therefore some driver features
may not be available…”
Still have not found out why this happens and how to solve this..

==================================

Sources:
CentOS wiki on laptop wireless – http://wiki.centos.org/HowTos/Laptops/Wireless

9 responses so far

Resetting a saved gnome-session

Gnome saved-sessions may not work well with Compiz.

When i saved a session and when i tested it after logging out and in, the screen was black with only mouse pointer displayed. After 2-3 minutes the session [windows] that i saved were displayed but all windows were without title-bars, and also without borders. There was also problem with the menu and panels. The windows can be bought back to shape by disabling Compiz [from System>Preferences>Desktop Effects].

But I wanted to delete this saved session and make things as they were after installation.

The trick is to delete the session file in the ~/.gnome2. Or to be safer try renaming it to something else.


cd .gnome2
mv session oldsession

Logout and in to see the results.

No responses yet

Installed CentOS 5.2; I am back to linux

Why CentOS?
I want an enterprise class linux that is free. Having used RedHat and Fedora earlier, I prefer a distro from the same league. CentOS is bit by bit RHEL that is built from the free RHEL source code [with its branding and artwork removed]. I also want to install VMWare, and CentOS is is supported by them.

My Hardware,
Wipro Little Genious laptop, Model WLG7110.
Intel Celeron M CPU 430 @ 1.73GHz , 1.5 GB RAM, 80GB Fujitsu HDD, 1280×800 wide screen display, Syntek 1.3MP webcam, Intel Pro 3945 wireless, Realtek RTL 8139 NIC, bluetooth, Ricoh 5 in 1 card reader, TSSTCORP CD/DVD RW, Intel ICH7 soundcard etc

Downloaded the CentOS 5.2 DVD .iso using bit-torrent with Vuze.

I already have WinXP installed. So deleted a partition at the end to create a 15GB space.
Just glanced through the Installation guide and thats when i learned about Logical Volume Managements (LVM). Decided to use LVM’s this time. LVM can be resized, moved to another harddisk etc without affecting the OS installed or data residing in it.

I always use the hard drive installation as i am too lazy to burn CD’s.

We need a boot CD or USB to begin the installation program from harddisk. Created a boot USB from the diskboot.img file provided in the .iso using using the dd utility in an another linux system.
dd if=diskboot.img of=/dev/sdb

Reboot and started the installation program from USB.

Chose linux askmethod to use harddrive installation medium and specified the partition containing .iso [/dev/sda5]

Next comes partitioning, this is where we create LVMs
Created a /boot of 100mb type ext3
Created a Volume Group CentOsVG
Created two Logical Volumes, SwapLV 2GB for swap
and RootLV 13GB type ext3 for /

Grub to MBR

Installation done and when i rebooted to the new system, there were a few problems, sound was not properly working [gets muted randomly] and wireless card was not even detected.

Decided to do an update before trying anything to fix them. Setup a wired network and did a system update using yum
yum update

Yum showed 508mb to download and the whole update took 5hrs in my 256kbits/sec line.

Now i have CentOS 5.3 the latest version. This can be checked it by the command
rpm -q centos-release

Sound is perfect after that.

Wireless card is detected but still cant connect. Followed the steps at CentOS wireless how-to wiki to install card’s firmware and enable NetworkManager to use it. There were a problem with NetworkManager asking for keyring password every time, but the solution to it was also in the same wiki.
I was able to use wireless with WPA2 AES with SSID broadcast disabled. More details can be found here.

To Do:
Check the webcam.
Check the card reader. (it is detected)
Check IEEE 1394 port(Firewire)

No responses yet

« Prev