Difference between revisions of "Gentoo"

From Alessandro's Wiki
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Gentoo Linux ==
*; ''' Gentoo Linux '''
 
[http://www.gentoo.org/ Gentoo.org]
[http://www.gentoo.org/ Gentoo.org]


== Note sulla Distribuszione ==
= bla bla =
* Qusta è la distribuzione + robusta, ''linuxosa'' e fricchettona che ho mai usato in vita mia. Si basa su un principio fondamentale:
 
'''''Tutto (ma tutto tutto) il software, anche il sistema, viene scaricato sotto forma di sorgente e poi compilato con il proprio hardware.'''''
*; Gentoo Linux: benefits and reasons, why do I use it:
== Gestione del Software e repositorio (portage) ==
* ''I have it installed only on my main computer at home. Not at workplace.''
* Il comando per lavorare sul software installao/installabile di Gentoo è emerge.  
* every new or updating package, has to be done running through its internal parts. VLC for example could be [[compiled]] to support only a video/audio codec or visual interface.
=== Portage Overlays ===
* gives me an historical-technical view of the open-source evolution and its communities interactions.
 
= Gestione de Software e repositori (portage) =
* Il comando per lavorare sul software installao/installabile di Gentoo è emerge.
 
== Portage Overlays ==
 
Un Portage overlay serve ad estendere il portage ufficiale di gentoo:
Un Portage overlay serve ad estendere il portage ufficiale di gentoo:
Si imposta dichiarando e assognando gli la/le directory addizionali alla variabile in make.conf
Si imposta dichiarando e assognando gli la/le directory addizionali alla variabile in make.conf
Line 14: Line 21:
  /etc/make.conf
  /etc/make.conf


*Si possono aggiungere rami al protage anche con layman.
* Si possono aggiungere rami al protage anche con layman.
  layman -L list
  layman -L list
  * bangert                  [Subversion] (source: http://overlays.gentoo.org...)
  * bangert                  [Subversion] (source: http://overlays.gentoo.org...)
Line 20: Line 27:
  * chtekk-apps
  * chtekk-apps


=== Masking ===
* thanks to [http://nthrbldyblg.blogspot.com/2010/01/listing-packages-installed-from.html nthrbldyblg]
  for i in /var/db/pkg/*/*; do if ! grep gentoo $i/repository >/dev/null; then echo -e "`basename $i`\t`cat $i/repository`"; fi; done
 
== Masking ==
* il sistema è un po complesso ma molto efficace e personalizzabile: tutti i pacchetti hanno dei ''tipi'' di versione; '''''stable, unstable, masked e hard masked'''''
* il sistema è un po complesso ma molto efficace e personalizzabile: tutti i pacchetti hanno dei ''tipi'' di versione; '''''stable, unstable, masked e hard masked'''''


* analizzo il pacchetto kdebase, che è una bella ''sbranda di robba''
=== Unstable packages ===
 
* to mask ..
/etc/portage/package.keywords
 
* or, if you have it in directory structure,
/etc/portage/package.keywords/package
 
=== Masked packages ===
* to unmask a package, add its atom in
/etc/portage/package.unmask
 
* to mask ..
/etc/portage/package.mask
=== License Masked ===


==== "Smascherare" più pacchetti ====
!!! The following installed packages are masked:
- dev-java/blackdown-jdk-1.4.2.03-r15 (masked by: sun-bcla-java-vm license(s))


#!/bin/bash
* to accept all licences, add:
  cd /usr/portage/kde-base
  ACCEPT_LICENSE="*"
ls */*3.*.* | sed 's/.ebuild//g' | sed 's/\// /g' | awk '{print "kde-libs/"$2" ~x86"}' | sed 's/-3.[0-9].[0-9]/ /g' | sed 's/-r[0-9]//g' | sed 's/  / /g' | uniq >> /etc/portage/package.keywords
to /etc/make.conf
cd -


=== emerge ===
== emerge command ==
* Aggiornare tutto il sistema
* Aggiornare tutto il sistema
questi comandi calcolano le dipendenze e ci mostrano gli aggiornamenti, senza installare niente
questi comandi calcolano le dipendenze e ci mostrano gli aggiornamenti, senza installare niente
Line 40: Line 64:
  emerge --deep --update world
  emerge --deep --update world
  emerge --deep --update system
  emerge --deep --update system
emerge --update --newuse --deep @world  --with-bdeps y -pvt


* this option will do emerge skip packages that not compile
* this option will do emerge skip packages that not compile
  emerge --keep-going  
  emerge --keep-going  


* manual command line version...
* manual command line version of the "keep-going" option ...
  emerge <options> world || until emerge --resume --skipfirst; do :; done
  emerge <options> world || until emerge --resume --skipfirst; do :; done
* Or
* Or
Line 51: Line 77:
  while true; do read a; ( [ $a == "q" ] || [ $a == "x" ] ) && break; done
  while true; do read a; ( [ $a == "q" ] || [ $a == "x" ] ) && break; done


* Ricostruire le dipendenze
=== dependencies ===
 
* Rebuild broken connection between packages
  revdep-rebuild -p
  revdep-rebuild -p


=== USE Flags ===  ''script comodo per controllare o interrogare le use flags:''
== eix utility ==
 
 
* list all packages installed:
eix-I
* list in compact mode
eix -c
* list installed packages from a given overlay
eix -I --installed-from-overlay OVERLAY_NAME
 
== USE Flags ==
 
* Use flags are words associated to a package controlling its composing parts and the interaction with other packages.
** example use flag:
USE="bluetooth"
Will enable the inclusion of bluetooth support in all the applications compiled into the system.
USE="'''-'''bluetooth"
Will instead disable the support for all packages.
 
=== globals (all system) ===
* A global use flag, to say it poorly, is the one you set only once and has effect on all the packages in your system.
 
You can set it in the ([[VIF]]) file
 
  /etc/[[Make.conf]]
 
=== locals (package) ===
 
documentation of each local flag is in the file ''/usr/portage/profiles/use.local.desc''
 
== script "''comodo''" to check use flags ==
 
* see also
[[Script gentoo use flags]]


*'''restituisce le use definite globalmente, prima descrivendone una per una
*'''restituisce le use definite globalmente, prima descrivendone una per una
Line 63: Line 124:
** ''! use_name'' --> ''Use flag NOT FOUND !''  '''Use non trovata nel file /usr/portage/profiles/use.desc
** ''! use_name'' --> ''Use flag NOT FOUND !''  '''Use non trovata nel file /usr/portage/profiles/use.desc


'''cat `which uses`|grep -v ^#'''


  source /etc/make.conf
<syntaxhighlight lang="bash" >
  . /etc/make.conf
  USEfile=/usr/portage/profiles/use.desc
  USEfile=/usr/portage/profiles/use.desc
  if ! [ "x$1" == "x" ]  
  if ! [ "x$1" == "x" ]  
Line 85: Line 146:
  done
  done
  echo "newuses:  $newuses"
  echo "newuses:  $newuses"
</syntaxhighlight>


* mad ''''questa use aggiunge il supporto per mpeg2 audio, xile-lib per esempio''''
* mad ''''questa use aggiunge il supporto per mpeg2 audio, xile-lib per esempio''''


=== ebuild ===
== equery command ==
 
* get package name from give file (with full path)
equery b /path/to/the/file
* get packages depending on given package, it also guess wich use flag pulls it.
equery d package-name
 
== ebuild command ==
 
* if you have an '''.ebuild''' package to push into the portage, you can do it with this command.
ebuild beautiful-program-0.1.ebuild digest
* then install the package
emerge beautiful-program
 
''if you don't know what it means, just forget it''
 
=== creating an ebuild for a new package ===
 
Installare un programma che non è nel portage, con un .ebuild:
Installare un programma che non è nel portage, con un .ebuild:
* La prima cosa è creare una directory, stile portage, dove copiare il file .ebuild del programma da installare:
* La prima cosa è creare una directory, stile portage, dove copiare il file .ebuild del programma da installare:
come esempio userò il pacchetto "media-soud/xmms2":
come esempio userò il pacchetto "media-soud/xmms2":
==== creo il portage tree ====
  vi /etc/make.conf
  vi /etc/make.conf
con la variabile $PORTDIR_OVERLAY specifico uno o + (separati da spazi) portage addizionali.
 
con la variabile  
$PORTDIR_OVERLAY
specifico uno o + (separati da spazi) portage addizionali.
Quindi aggiungo in coda a make.conf questa linea (se non c'è già, in quel caso alcuni passi si possono saltare)
Quindi aggiungo in coda a make.conf questa linea (se non c'è già, in quel caso alcuni passi si possono saltare)
  PORTDIR_OVERLAY="/usr/local/portage"
  PORTDIR_OVERLAY="/usr/local/portage"
Line 116: Line 197:
e infine  
e infine  
  emerge xmms2
  emerge xmms2
=== Automontare periferiche esterne ===
emerge kioslaves , dbus, hal
rc-update add hald default
rc-update add dbus default
/etc/init.d/hald start
/etc/init.d/dbus start
a volte può essere necessario:
  ln -s /usr/lib/libdbus-1.so.3 /usr/lib/libdbus-1.so.2
per un problema di versioni di dbus/KDE
* Problema HAL:
con la versione >= 0.5.9 spesso il processo hald
entra in un loop unfinito:
/etc/init.d/hald stop
hald --daemon=no --verbose=yes
device_info.c:983: Unhandled rule (0)!
device_info.c:983: Unhandled rule (0)!
...
Il problema è un file che crea libgphoto2 in
/usr/share/hal/fdi/information/10freedesktop/10-camera-libgphoto2.fdi
commentando l'interno di questo file si risolve il problema.
Secondo me funziona anche aggiungendo la use flag:
media-libs/libgphoto2 -hal
in
/etc/portage/package.use


== Kernel ==
== cleaning up the system ''(brute way)'' ==
  eix sys-kernel/git-sources
  eclean-dist --destructive
* cambia <arch> con la tua architettura ( ~amd64 ~x86 ... )
* portage temp files: '''be very careful with this commands, they DESTROY everywhere they go''
  echo 'sys-kernel/git-sources <arch>' >> /etc/portage/package.keywords
 
# first upgrade the system, repair all broken dependencies with revdep-rebuild.
# then ''cd'' to '''/var/tmp''' and purge temporary files
  cd /var/tmp
 
  rm -rf portage/* ccache/* binpkgs/* genkernel/*
 
== ... It's not working ==
 
* 99% of the times when something does not work on Gentoo linux is because some broken link between packages/applications. And at ''these'' times, the 99% of the times the solution is to re-compile (re-[[emerge]]) the package.
 
=== the mouse/keyboard does not work anymore ===
 
  emerge -1 x11-drivers/xf86-input-evdev
... or whatever...
 
= Kernel management =
 
* get a list of available ''vanilla'' sources from kernel.org:
  eix sys-kernel/git-sources
  eix sys-kernel/git-sources
* get available gentoo patched kernel:
eix sys-kernel/gentoo-sources
  emerge -D sys-kernel/git-sources
  emerge -D sys-kernel/git-sources
== Lista pacchetti installati ==


emerge -v gdm gdm-themes ximian-artwork redhat-artwork
== genkernel ==
* [[Genkernel]] tool

Latest revision as of 01:26, 24 February 2013

  • Gentoo Linux

Gentoo.org

bla bla

  • Gentoo Linux
    benefits and reasons, why do I use it:
  • I have it installed only on my main computer at home. Not at workplace.
  • every new or updating package, has to be done running through its internal parts. VLC for example could be compiled to support only a video/audio codec or visual interface.
  • gives me an historical-technical view of the open-source evolution and its communities interactions.

Gestione de Software e repositori (portage)

  • Il comando per lavorare sul software installao/installabile di Gentoo è emerge.

Portage Overlays

Un Portage overlay serve ad estendere il portage ufficiale di gentoo: Si imposta dichiarando e assognando gli la/le directory addizionali alla variabile in make.conf

PORTDIR_OVERLAY 

nel file

/etc/make.conf
  • Si possono aggiungere rami al protage anche con layman.
layman -L list
* bangert                   [Subversion] (source: http://overlays.gentoo.org...)
* cell                      [Subversion] (source: http://overlays.gentoo.org...)
* chtekk-apps
 for i in /var/db/pkg/*/*; do if ! grep gentoo $i/repository >/dev/null; then echo -e "`basename $i`\t`cat $i/repository`"; fi; done

Masking

  • il sistema è un po complesso ma molto efficace e personalizzabile: tutti i pacchetti hanno dei tipi di versione; stable, unstable, masked e hard masked

Unstable packages

  • to mask ..
/etc/portage/package.keywords
  • or, if you have it in directory structure,
/etc/portage/package.keywords/package

Masked packages

  • to unmask a package, add its atom in
/etc/portage/package.unmask
  • to mask ..
/etc/portage/package.mask

License Masked

!!! The following installed packages are masked:
- dev-java/blackdown-jdk-1.4.2.03-r15 (masked by: sun-bcla-java-vm license(s))
  • to accept all licences, add:
ACCEPT_LICENSE="*"

to /etc/make.conf

emerge command

  • Aggiornare tutto il sistema

questi comandi calcolano le dipendenze e ci mostrano gli aggiornamenti, senza installare niente

emerge --deep --update -pvt world
emerge --deep --update -pvt system
  • se tutto va bene, aggiorniamo.
emerge --deep --update world
emerge --deep --update system
emerge --update --newuse --deep @world  --with-bdeps y -pvt
  • this option will do emerge skip packages that not compile
emerge --keep-going 
  • manual command line version of the "keep-going" option ...
emerge <options> world || until emerge --resume --skipfirst; do :; done
  • Or
while true; do emerge --resume --skipfirst && break; done 
  • or
while true; do read a; ( [ $a == "q" ] || [ $a == "x" ] ) && break; done

dependencies

  • Rebuild broken connection between packages
revdep-rebuild -p

eix utility

  • list all packages installed:
eix-I
  • list in compact mode
eix -c
  • list installed packages from a given overlay
eix -I --installed-from-overlay OVERLAY_NAME

USE Flags

  • Use flags are words associated to a package controlling its composing parts and the interaction with other packages.
    • example use flag:
USE="bluetooth"

Will enable the inclusion of bluetooth support in all the applications compiled into the system.

USE="-bluetooth"

Will instead disable the support for all packages.

globals (all system)

  • A global use flag, to say it poorly, is the one you set only once and has effect on all the packages in your system.

You can set it in the (VIF) file

/etc/Make.conf

locals (package)

documentation of each local flag is in the file /usr/portage/profiles/use.local.desc

script "comodo" to check use flags

  • see also

Script gentoo use flags

  • restituisce le use definite globalmente, prima descrivendone una per una
poi tutte su una riga, togliendo quelle non trovate nel use.desc ( $USEfile ).
    • Output
    • use_name - Use description
    • NOT> use_name - Use description Use Negata, ovvero con il segno "-" davanti. es. -kde , -gnome
    • ! use_name --> Use flag NOT FOUND ! Use non trovata nel file /usr/portage/profiles/use.desc


 . /etc/make.conf
 USEfile=/usr/portage/profiles/use.desc
 if ! [ "x$1" == "x" ] 
 then USES="$1"
 else USES=$USE; fi
  newuses=""
 for thisuse in $USES; do
        desc=""
        ABSflag=`echo $thisuse|sed -e s/-//`
        # echo ">> Use Flag [ $a ] "
        if ( `grep -q ^$ABSflag $USEfile` )
        then
                [ "$ABSflag" == "$thisuse"  ] || desc="NOT> "
                desc="$desc "`grep "^$ABSflag" $USEfile`
                newuses="$newuses $thisuse"
        else
                desc="!$ABSflag --> Use flag NOT FOUND !" ;   fi
        echo $desc
 done
 echo "newuses:  $newuses"
  • mad 'questa use aggiunge il supporto per mpeg2 audio, xile-lib per esempio'

equery command

  • get package name from give file (with full path)
equery b /path/to/the/file
  • get packages depending on given package, it also guess wich use flag pulls it.
equery d package-name

ebuild command

  • if you have an .ebuild package to push into the portage, you can do it with this command.
ebuild beautiful-program-0.1.ebuild digest
  • then install the package
emerge beautiful-program

if you don't know what it means, just forget it

creating an ebuild for a new package

Installare un programma che non è nel portage, con un .ebuild:

  • La prima cosa è creare una directory, stile portage, dove copiare il file .ebuild del programma da installare:

come esempio userò il pacchetto "media-soud/xmms2":

vi /etc/make.conf

con la variabile

$PORTDIR_OVERLAY

specifico uno o + (separati da spazi) portage addizionali. Quindi aggiungo in coda a make.conf questa linea (se non c'è già, in quel caso alcuni passi si possono saltare)

PORTDIR_OVERLAY="/usr/local/portage"

creo la directory (portebbe già esistere)

mkdir -p /usr/local/portage/

ci entro

cd /usr/local/portage/

creo la directory per xmms.

mkdir -p media-sound/xmms2/

..ci entro

cd media-sound/xmms2/

scarico l' ebuild

wget http://stuge.se/gentoo/media-sound/xmms2/xmms2-0.2.ebuild
  • ora con il comando ebuild e il parametro "digest", lo facciamo "digerire" al sistema.
ebuild xmms2-0.2.7.ebuild digest

io uso eix per sfogliare il repositorio, comunque il pacchetto xmms2 ora è pronto per essere emerg-ato.

update-eix
emerge -pvtD xmms2

e infine

emerge xmms2

cleaning up the system (brute way)

eclean-dist --destructive
  • portage temp files: 'be very careful with this commands, they DESTROY everywhere they go
  1. first upgrade the system, repair all broken dependencies with revdep-rebuild.
  2. then cd to /var/tmp and purge temporary files
 cd /var/tmp 
 rm -rf portage/* ccache/* binpkgs/* genkernel/*

... It's not working

  • 99% of the times when something does not work on Gentoo linux is because some broken link between packages/applications. And at these times, the 99% of the times the solution is to re-compile (re-emerge) the package.

the mouse/keyboard does not work anymore

emerge -1 x11-drivers/xf86-input-evdev

... or whatever...

Kernel management

  • get a list of available vanilla sources from kernel.org:
eix sys-kernel/git-sources
  • get available gentoo patched kernel:
eix sys-kernel/gentoo-sources
emerge -D sys-kernel/git-sources

genkernel