Archive for October, 2009

Karmic Koala su MSI Wind U100


2009
10.30

Dato che andava reinstallato, ho deciso di testare Karmic.

Le mie impostazioni sono:

  • Partizione / da 30.00 GB
  • Swap da 2048 MB
  • Partizione /home cifrata con lo spazio restante

Ho provveduto subito ad installare con pacchetti esterni DropBox e TrueCrypt, mentre da repository ho installato:

kismet gpsd gpsdrive wireshark sox festival alsaplayer-text ntfsprogs network-manager-openvpn pamusb-tools libpam-usb powertop ubuntu-restricted-extras emacs23-nox ssh

Il problema dello sfarfallio della luminosità (descritto in questo bug) l’ho “risolto” aggiungendo l’applet per il controllo della luminosità al pannello, quindi cliccando su di esso e regolandola a mano. In questo modo smette di sfarfallare fino al login successivo. Spero che rilascino presto un update per questo…

Non mi piace molto il fatto che non si possa configurare il comportamento della schermata di login, disabilitando la lista degli utenti. E’ un problema di sicurezza bello e buono e da Ubuntu non me lo aspettavo.
Comunque la cosa può essere risolta tramite il comando:

sudo gconftool-2 –direct –config-source xml:readwrite:/etc/gconf/gconf.xml.defaults –type bool –set /apps/gdm/simple-greeter/disable_user_list true

Su firefox ho ovviamente installato immediatamente XMarks e DownloadStatusBar, mentre ho modificato il file .emacs per adattarlo ai miei gusti:


;; Disabilita la schermata iniziale
(setq inhibit-startup-message t)
;; Abilita l'indicatore del numero di colonna in fondo allo schermo
(column-number-mode 1)
;; Alcuni comandi abbreviati
(global-set-key [f3] 'kill-this-buffer)
;; Abilita la rotella del mouse
(mouse-wheel-mode t)
;; Abilita la funzione di evidenziazione della selezione
(transient-mark-mode t)
;; SavePlace- this puts the cursor in the last place you edited
;; a particular file. This is very useful for large files.
(require 'saveplace)
(setq-default save-place t)
;; replace highlighted text with what I type rather than just
;; inserting at a point
(delete-selection-mode t)
;; Abilita la funzione per evidenziare la riga su cui si trova il cursore
;(global-hl-line-mode 1)
;(set-face-background 'hl-line "Blue")
;; personalizzano l'aspetto generale di emacs
(set-background-color "Black")
(set-foreground-color "White")
;;(set-cursor-color ("Yellow")
;;Usa C-l per il Goto-line
(global-set-key "\C-l" 'goto-line)
;; Per scrivere solo y o n al posto di yes o no
(fset 'yes-or-no-p 'y-or-n-p)
;;
;;
;; Put autosave files (ie #foo#) in one place, *not*
;; scattered all over the file system!
(defvar autosave-dir
(concat "/tmp/emacs_autosaves/" (user-login-name) "/"))
(make-directory autosave-dir t)
(defun auto-save-file-name-p (filename)
(string-match "^#.*#$" (file-name-nondirectory filename)))
(defun make-auto-save-file-name ()
(concat autosave-dir
(if buffer-file-name
(concat "#" (file-name-nondirectory buffer-file-name) "#")
(expand-file-name
(concat "#%" (buffer-name) "#")))))
;; Put backup files (ie foo~) in one place too. (The backup-directory-alist
;; list contains regexp=>directory mappings; filenames matching a regexp are
;; backed up in the corresponding directory. Emacs will mkdir it if necessary.)
(defvar backup-dir (concat "/tmp/emacs_backups/" (user-login-name) "/"))
(setq backup-directory-alist (list (cons "." backup-dir)))
;;
;;
;;
;; ========== Line by line scrolling ==========
;; This makes the buffer scroll by only a single line when the up or
;; down cursor keys push the cursor (tool-bar-mode) outside the
;; buffer. The standard emacs behaviour is to reposition the cursor in
;; the center of the screen, but this can make the scrolling confusing
(setq scroll-step 1)
;;
;;
;;
;; Make pair of {,[ and (
(setq skeleton-pair t)
(setq skeleton-pair-on-word t)
(global-set-key "(" 'skeleton-pair-insert-maybe)
(global-set-key "[" 'skeleton-pair-insert-maybe)
(global-set-key "{" 'skeleton-pair-insert-maybe)
;; cperl-mode is preferred to perl-mode
(defalias 'perl-mode 'cperl-mode)
(autoload 'mode-compile "mode-compile"
"Command to compile current buffer file based on the major mode" t)
(global-set-key "\C-cc" 'mode-compile)
(autoload 'mode-compile-kill "mode-compile"
"Command to kill a compilation launched by `mode-compile'" t)
(global-set-key "\C-ck" 'mode-compile-kill)

Update:

Un fix temporaneo al problema della luminosità “sfarfallante” è quello di deselezionare il power manager dalla lista delle applicazioni da lanciare all’avvio (menu System->Preferences->Startup Applications).
Ovviamente in questo modo si perdono tutti i vantaggi (sospensione, ibernazione, ecc…) del gnome-power-manager, ma in compenso ora i tasti per la luminosità funzionano ottimamente sul mio Ubuntu Studio!

Emacs calendar mode


2009
10.25

Just type M-x calendar to access the Emacs calendar mode.

Do you want to know the sunset/sunrise time? Press S !

Do you wanto to know the exact moment for the last moon quarter? Press M

Have you a disloyal girlfriend?

Calendar

Vodka martini


2009
10.11

Da sempre uno dei miei preferiti, ecco la ricetta piu’ comune:vodka-martini

  • 8/10 Vodka
  • 2/10 Dry vermouth
  • Olive verdi
  • Scorza di limone

Raffreddare un martini glass ed un boston con del ghiaccio, versare nel boston 2/10 di Vermouth e 8/10 di Vodka, agitare con uno spoon, eliminare il ghiaccio dal martini glass e versare il cocktail filtrandolo con lo strainer.

Aggiungete una o due olive verdi e una scorza finissima di limone.

NB. Fare ben attenzione che non ci sia acqua di residuo dal ghiaccio in entrambi i bicchieri!

Bonding delle interfacce di rete su Ubuntu e CentOS


2009
10.10

Un piccolo riassunto su come effettuare velocemente il bonding delle interfacce di rete su sistemi Debian (Ubuntu 8.04 nella fattispecie) e RH (Centos 5.3).

Come tutti sanno il bonding serve per “unire” in diversi modi piu’ interfacce di rete al fine di migliorare le prestazioni e fornire ridondanza e bla bla bla.

L’unica cosa di cui abbiamo bisogno sono due interfacce di rete (possibilmente identiche) da aggregare. Ovviamente possono essere piu’ di due…

Per Ubuntu:

Su Ubuntu dobbiamo anzitutto installare il pacchetto ifenslave-2.6 che servira’ a dare i comandi di aggregazione/scioglimento delle interfacce. Si puo’ fare tranquillamente con apt-get.

Quindi andiamo a creare il file /etc/modprobe.d/bond che riempiremo in questo modo:


alias bond0 bonding
options bond0 mode=1 miimon=80

La prima riga non fa che associare il nome “bond0” al modulo “bonding“. La seconda riga invece specifica le opzioni per bond0 che sono la modalita’ (vedi sotto per ulteriori dettagli su questo punto) e il parametro miimon che settato ad 80 dice che il polling delle interfacce (per verificare se sono attive regolarmente) viene eseguito ogni 80 millisecondi.

Andiamo quindi a modificare il file /etc/network/interfaces commentando eventuali interfacce presenti (eccetto lo, ovviamente) e inserendo invece:


auto bond0
iface bond0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
network xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
post-up ifenslave bond0 eth0 eth1
pre-down ifenslave -d bond0 eth0 eth1

Sostituite con i vostri valori le x e riavviate la macchina. A questo punto dovreste avere le interfacce aggregate in un’unica interfaccia virtuale chiamata bond0. Controllate che tutto sia in ordine con ifconfig e con il comando cat /proc/net/bonding/bond0

Per CentOS

Le cose qui sono leggermente piu’ semplici: non e’ infatti necessario installare alcun pacchetto, basta semplicemente modificare il file /etc/modprobe.conf aggiungendo come prima:


alias bond0 bonding
options bond0 mode=1 miimon=80

E quindi andando a creare il file /etc/sysconfig/network-scripts/ifcfg-bond0 con all’interno:


DEVICE=bond0
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
NETWORK=xxx.xxx.xxx.xxx
BROADCAST=xxx.xxx.xxx.xxx
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

Infine dobbiamo modificare i due file delle interfacce esistenti, poniamo /etc/sysconfig/network-scripts/ifcfg-eth0 e eth1 lasciando solo quanto segue:


DEVICE=eth0 (oppure eth1)
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes

Infine riavviamo la macchina e testiamo che le due interfacce siano risalite correttamente con i comandi elencati prima.

Modalita’ di bonding:

Queste sono le modalita’ di bonding che possono essere usate, spudoratamente copiate da qui:

mode=0

This mode uses the Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.

mode=1

This mode uses an Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond’s MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.

mode=2

Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.

mode=3

Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.

mode=4

IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.

*Pre-requisites:

1. Ethtool support in the base drivers for retrieving the speed and duplex of each slave.

2. A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require    some type of configuration to enable 802.3ad mode

mode=5

Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.

*Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.

mode=6

Adaptive load balancing: includes balance-transmit load balancing plus receive load balancing for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.

Personalizzare il GDM di Karmic


2009
10.02

Una delle cose che mi ha colpito dalla alpha 6 di Karmic è la pochissima possibilità di configurazione, rispetto alle precedenti versioni, del GDM. In relatà, come ha appena suggerito qualcuno su identi.ca, è solo una cosa apparente: vedere questo post per credere.