Thursday, August 27, 2009

How do you update you gentoo ?

You have to update your gentoo frequently.
Here is some steps you have to do :

1) Update portage

$ emerge --sync


2) Update the System

$ emerge -p system
$ emerge -u system

3) Update Software

$ emerge -p world

$ emerge -u world



4) Launch Optimisation

If you want that executable start faster, try this :
$ prelink -amR (Very Very Useful ! see my documentation about installation and use prelink)

5) Search Optimisation

$ update-eix
See on eix.This command will permit you to run faster.

Important notes :
- It is possible to update your configuration file with etc-update.
If you are a beginner, use it carrefully because you can destroy you configuration.Make a backup before !
- -p permit to check if they are some packets to update.

Sunday, August 16, 2009

emerge x11-drivers/nvidia-drivers compilation failed Could not find a usable .config

Problem :
When you update x11-drivers/nvidia-drivers, the compilation fails.
Example :
* Could not find a usable .config in the kernel source directory.
* Please ensure that /usr/src/linux points to a configured set of Linux sources.
* If you are using KBUILD_OUTPUT, please set the environment var so that
* it points to the necessary object directory so that it might find .config.
*
* ERROR: x11-drivers/nvidia-drivers-185.18.31 failed.

Solution :

You aren't on the good kernel.This is because during update the link is change.
If you do :
ls -al /usr/src/
lrwxrwxrwx 1 root root 22 Aug 16 16:30 linux -> linux-2.6.30-gentoo-r1
drwxr-xr-x 22 root root 4096 Nov 29 2008 linux-2.6.26-gentoo-r3
drwxr-xr-x 23 root root 4096 Dec 6 2008 linux-2.6.27-gentoo-r4
drwxr-xr-x 23 root root 4096 Aug 9 13:36 linux-2.6.30-gentoo-r1

You see that the link points on an other kernel and you have'nt compile source for this kernel.
That's why there is no .config files.
So there is two solutions :
- Compile new kernel sources.
- Point on good kernel.

We will take the easier solution : Select your kernel.
To do that :
# eselect kernel list
Available kernel symlink targets:
[1] linux-2.6.26-gentoo-r3
[2] linux-2.6.27-gentoo-r4
[3] linux-2.6.27-gentoo-r5
[4] linux-2.6.27-gentoo-r7
[5] linux-2.6.28-gentoo
[6] linux-2.6.28-gentoo-r1
[7] linux-2.6.29-gentoo-r2
[8] linux-2.6.29-gentoo-r4
[9] linux-2.6.30-gentoo-r1 *
[10] linux-2.6.30-gentoo-r2

Then you can point on the good kernel :
# eselect kernel set 9

If you execute eselect kernel list, you will see a start on the select kernel.
Then you can make an update of the package :
#emerge -u x11-drivers/nvidia-drivers

Thursday, August 13, 2009

shell read properties file



Problem :

You want to read a properties files that is similar to :

vi test.properties

VAR1=zest
VAR2=blop
VAR3=toto
MAIL=test@ty
ALIAS=monalias

You want also use this variable.


Solution

You have to read line by line and make an export of each line.
Note : It's just a test method.


#!/bin/ksh
#-----------------------------
------------------------------
# Methode qui lit les proprietes d un fichier de properties.
#-----------------------------------------------------------

readFileProperties()
{
FILE="test.properties"

test -f $FILE
if [ $? -ne 0 ];then
echo "Fichier de propriete inexistant:$FILE"
exit 1
fi

echo "Lecture..."
while read ligne
do
if echo "$ligne" |grep "=" 1>/dev/null
then
VARNAME=`echo $ligne |cut -f1 -d=`
#echo $VARNAME
VARVALUE=`grep "^$VARNAME=" $FILE`
export $VARVALUE
#echo "export $VARVALUE"
fi
done < $FILE echo "VAR1:$VAR1" echo "VAR2:$VAR2" echo "VAR3:$VAR3" echo "ALIAS:$ALIAS" echo "MAIL:$MAIL" } readFileProperties

Sunday, August 9, 2009

cannot set LC_CTYPE locale (gentoo)

Problem :

cannot set LC_CTYPE locale
environment variable LANG is fr_FR.utf8@euro
please check that your locale name is correct

Solution :


The problem is that LC_CTYPE was unknown.
In fact, you have to check that this variable value is correctly spell.
To do that, you can do : locale -a


Example :
$ locale -a
C

POSIX
fr_FR fr_FR.iso88591
fr_FR.iso885915@euro
fr_FR@euro



Next, you have to check in the configuration file :
On gentoo :
vi /etc/env.d/02locale


Example :
vi /etc/env.d/02locale

LANG="fr_FR.iso885915@euro"
LC_COLLATE="C"

=> You must have LANG variable initializes with one of the result of the command : locale -a

If you want, you can also let every Linux user to configure their own variable.


vi ~/.bashrc

Example :
vi ~/.bashrc
export LANG="fr_FR.iso885915@euro"
export LC_ALL=C

svn: warning: cannot set LC_CTYPE locale

This is a small but useful tips which permits to solve my problem : (http://armenianeagle.com/2008/03/18/svn-warning-cannot-set-lc_ctype-locale-solution/)

Problem :

You type : svn status
And you've got this error message :
svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LANG is fr_FR.utf8@euro
svn: warning: please check that your locale name is correct
svn: warning: '.' is not a working copy

Solution :

export LC_ALL=C