TagKernel

Clean up old kernels

Do you want to save 15 Gb of space?

I have an old laptop from 2008, which is running ubuntu. Everytime a new kernel is released, this gets installed, however the older kernels and their image do remain available and they do not get automatically uninstalled. I guess this is a security feature, however if the installation is done only once, and years and years of new kernels are stacked, the space taken may start to be excessive and also big enough that reclaim it is a good idea.

Starting point

As you can see from below, my / partition was quite full

mattions@triton:~$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/sda1                 46G   43G  1.3G  98% /
udev                     2.0G  4.0K  2.0G   1% /dev
tmpfs                    396M  1.1M  395M   1% /run
none                     5.0M  8.0K  5.0M   1% /run/lock
none                     2.0G  260K  2.0G   1% /run/shm
cgroup                   2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda6                176G  166G  1.7G 100% /home
/home/mattions/.Private  176G  166G  1.7G 100% /home/mattions

The images stored in the boot partition were also taking quite a bit of space:

mattions@triton:~$ du /boot -sh
2.3G /boot

Purge the old kernels

To purge the old kernels, you can either do it by hand via ubuntu software center, or by synaptic, or use a script to do it for you. After a bit of googling, I’ve discovered the following script, aptly named purge-old-kernels, which I have also uploaded as a gist on git, just not to loose. Feel free to download it and use it if you want

When I ran the script, this is the list of the kernels that will be eliminated in my case (yours maybe will differ):


mattions@triton:~$ sudo bash Desktop/purge-old-kernels.sh Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-3.13.0-32 linux-headers-3.13.0-34 linux-headers-3.13.0-35 linux-headers-3.13.0-43 linux-headers-3.13.0-39 linux-headers-3.13.0-46 linux-headers-3.13.0-49 linux-headers-3.11.0-17 linux-headers-3.11.0-18 Use 'apt-get autoremove' to remove them. The following packages will be REMOVED linux-generic-lts-saucy* linux-headers-3.11.0-17-generic* linux-headers-3.11.0-18-generic* linux-headers-3.11.0-19-generic* linux-headers-3.11.0-20-generic* linux-headers-3.11.0-22-generic* linux-headers-3.11.0-23-generic* linux-headers-3.11.0-24-generic* linux-headers-3.11.0-26-generic* linux-headers-3.13.0-32-generic* linux-headers-3.13.0-33-generic* linux-headers-3.13.0-34-generic* linux-headers-3.13.0-35-generic* linux-headers-3.13.0-36-generic* linux-headers-3.13.0-37-generic* linux-headers-3.13.0-39-generic* linux-headers-3.13.0-43-generic* linux-headers-3.13.0-44-generic* linux-headers-3.13.0-45-generic* linux-headers-3.13.0-46-generic* linux-headers-3.13.0-48-generic* linux-headers-3.13.0-49-generic* linux-headers-3.13.0-51-generic* linux-headers-3.13.0-52-generic* linux-headers-3.2.0-23-generic* linux-headers-3.2.0-24-generic* linux-headers-3.2.0-25-generic* linux-headers-3.2.0-26-generic* linux-headers-3.2.0-27-generic* linux-headers-3.2.0-29-generic* linux-headers-3.2.0-30-generic* linux-headers-3.2.0-31-generic* linux-headers-3.2.0-32-generic* linux-headers-3.2.0-33-generic* linux-headers-3.2.0-34-generic* linux-headers-3.2.0-35-generic* linux-headers-3.2.0-36-generic* linux-headers-3.2.0-37-generic* linux-headers-3.2.0-38-generic* linux-headers-3.2.0-39-generic* linux-headers-3.2.0-40-generic* linux-headers-3.2.0-41-generic* linux-headers-3.2.0-43-generic* linux-headers-3.2.0-44-generic* linux-headers-3.2.0-45-generic* linux-headers-3.2.0-48-generic* linux-headers-3.2.0-49-generic* linux-headers-3.2.0-51-generic* linux-headers-3.2.0-52-generic* linux-headers-3.2.0-53-generic* linux-headers-3.2.0-54-generic* linux-headers-3.2.0-55-generic* linux-headers-3.2.0-56-generic* linux-headers-3.2.0-57-generic* linux-headers-3.2.0-58-generic* linux-headers-3.2.0-59-generic* linux-headers-3.2.0-60-generic* linux-headers-3.2.0-61-generic* linux-headers-3.2.0-63-generic* linux-headers-3.2.0-64-generic* linux-headers-3.2.0-65-generic* linux-headers-3.2.0-67-generic* linux-headers-3.2.0-68-generic* linux-headers-3.2.0-69-generic* linux-headers-3.2.0-70-generic* linux-headers-3.2.0-74-generic* linux-headers-3.2.0-75-generic* linux-headers-3.2.0-76-generic* linux-headers-3.2.0-77-generic* linux-headers-3.2.0-79-generic* linux-headers-3.2.0-80-generic* linux-headers-3.2.0-82-generic* linux-headers-3.2.0-83-generic* linux-headers-3.8.0-36-generic* linux-headers-generic-lts-saucy* linux-image-3.11.0-17-generic* linux-image-3.11.0-18-generic* linux-image-3.11.0-19-generic* linux-image-3.11.0-20-generic* linux-image-3.11.0-22-generic* linux-image-3.11.0-23-generic* linux-image-3.11.0-24-generic* linux-image-3.11.0-26-generic* linux-image-3.13.0-32-generic* linux-image-3.13.0-33-generic* linux-image-3.13.0-34-generic* linux-image-3.13.0-35-generic* linux-image-3.13.0-36-generic* linux-image-3.13.0-37-generic* linux-image-3.13.0-39-generic* linux-image-3.13.0-43-generic* linux-image-3.13.0-44-generic* linux-image-3.13.0-45-generic* linux-image-3.13.0-46-generic* linux-image-3.13.0-48-generic* linux-image-3.13.0-49-generic* linux-image-3.13.0-51-generic* linux-image-3.13.0-52-generic* linux-image-3.2.0-23-generic* linux-image-3.2.0-24-generic* linux-image-3.2.0-25-generic* linux-image-3.2.0-26-generic* linux-image-3.2.0-27-generic* linux-image-3.2.0-29-generic* linux-image-3.2.0-30-generic* linux-image-3.2.0-31-generic* linux-image-3.2.0-32-generic* linux-image-3.2.0-33-generic* linux-image-3.2.0-34-generic* linux-image-3.2.0-35-generic* linux-image-3.2.0-36-generic* linux-image-3.2.0-37-generic* linux-image-3.2.0-38-generic* linux-image-3.2.0-39-generic* linux-image-3.2.0-40-generic* linux-image-3.2.0-41-generic* linux-image-3.2.0-43-generic* linux-image-3.2.0-44-generic* linux-image-3.2.0-45-generic* linux-image-3.2.0-48-generic* linux-image-3.2.0-49-generic* linux-image-3.2.0-51-generic* linux-image-3.2.0-52-generic* linux-image-3.2.0-53-generic* linux-image-3.2.0-54-generic* linux-image-3.2.0-55-generic* linux-image-3.2.0-56-generic* linux-image-3.2.0-57-generic* linux-image-3.2.0-58-generic* linux-image-3.2.0-59-generic* linux-image-3.2.0-60-generic* linux-image-3.2.0-61-generic* linux-image-3.2.0-63-generic* linux-image-3.2.0-64-generic* linux-image-3.2.0-65-generic* linux-image-3.2.0-67-generic* linux-image-3.2.0-68-generic* linux-image-3.2.0-69-generic* linux-image-3.2.0-70-generic* linux-image-3.2.0-74-generic* linux-image-3.2.0-75-generic* linux-image-3.2.0-76-generic* linux-image-3.2.0-77-generic* linux-image-3.2.0-79-generic* linux-image-3.2.0-80-generic* linux-image-3.2.0-82-generic* linux-image-3.2.0-83-generic* linux-image-3.8.0-36-generic* linux-image-generic-lts-saucy* 0 to upgrade, 0 to newly install, 149 to remove and 1 not to upgrade. After this operation, 13.0 GB disk space will be freed. Do you want to continue [Y/n]?

Results

After I’ve choosen yes, it took quite a bit but at the end it was worth it

mattions@triton:~$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/sda1                 46G   28G   17G  63% /
udev                     2.0G  4.0K  2.0G   1% /dev
tmpfs                    396M  1.1M  395M   1% /run
none                     5.0M  8.0K  5.0M   1% /run/lock
none                     2.0G   37M  1.9G   2% /run/shm
cgroup                   2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda6                176G  166G  1.7G 100% /home
/home/mattions/.Private  176G  166G  1.7G 100% /home/mattions

And the Boot partition is just 70 Mb:

mattions@triton:~$ du /boot -sh
70M /boot

So from 45 Gb to 25 GB, and the boot partition itself from 2.3 Gb to 70 Mb.

Pretty good I think.

Ubuntu: Black screen at the login

Today I’ve got a black (sad) screen after restarting the computer. The boot process was fine but everything seems to hang when the nvidia drivers was supposed to kick in and Xorg start.

It was impossible to fall back to any console text login type.

I’ve searched the internet here and there, but I was not able to find any solution or bug report, so I come up with an workaround.

I think the problem is due to the new kernel that I’ve installed following one of the suggested update and the incompatibility with the nvidia drivers. I don’t know if it is the true problem, but I have an hint that this can be true.

As the matter of fact I’ve changed the kernel at the boot time  (Push Esc when GRUB is showing the timeout for the default choice) and I choose the previous version (i.e. Ubuntu 8.10, kernel 2.6.27-12-generic).

With this one I was able to login and my system seems to be completely functional, up and running again.

For the time being I decided to stick with this kernel.  I edited the grub menu list (/boot/grub/menu.lst) changing the default 0 (Ubuntu 8.10, kernel 2.6.27-13-generic) with the second option (Ubuntu 8.10, kernel 2.6.27-12-generic).

Here my current menu.lst


# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 2

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 3

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu

# Pretty colours
#color cyan/blue white/blue

...
TRIM
...

## ## End Default Options ##

title Ubuntu 8.10, kernel 2.6.27-13-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.27-13-generic root=UUID=6e98c429-d480-44bd-a689-83114a227939 ro quiet splash
initrd /boot/initrd.img-2.6.27-13-generic
quiet

title Ubuntu 8.10, kernel 2.6.27-13-generic (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.27-13-generic root=UUID=6e98c429-d480-44bd-a689-83114a227939 ro single
initrd /boot/initrd.img-2.6.27-13-generic

title Ubuntu 8.10, kernel 2.6.27-12-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.27-12-generic root=UUID=6e98c429-d480-44bd-a689-83114a227939 ro quiet splash
initrd /boot/initrd.img-2.6.27-12-generic
quiet

title Ubuntu 8.10, kernel 2.6.27-12-generic (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.27-12-generic root=UUID=6e98c429-d480-44bd-a689-83114a227939 ro single
initrd /boot/initrd.img-2.6.27-12-generic

### END DEBIAN AUTOMAGIC KERNELS LIST

Note that default 0 takes always the latest.
HIH.

Update: Found the BUG https://bugs.launchpad.net/ubuntu/+source/linux/+bug/337019/

Laptop con linux preinstallato

Dell non vuole vendere laptop con Linux preinstallato. Tuttavia c’è che ha intenzione di creare delle aziende/fondazioni per farlo: ubuntista.it e chi invece già lo vende ma a prezzi troppo alti IMHO http://system76.com/

Non ho capito poi che senso ha la guerra delle distribuzioni…. Il kernel è uno ed a meno di patches specifiche se funziona con una distro dovrebbe funzionare anche con un’altra.

Per quanto riguarda le “patches custom” se queste risolvono funzionalità verranno introdotte nel kernel e quindi ci sarà la piena compatibilità in poco tempo. Quindi è solo marketing.

Comunque la necessità di comprare un buon Laptop per diciamo 700 € invece che 1200 €, risparmiando il costo di Vista sarebbe una possibilità realmente allettante e giusta.

Perché dovrei pagare per un sistema operativo che non voglio e che non voglio nemmeno utilizzare?

NVIDIA ATI e le violazioni della GPL

linux GPL

Ecco qua un chiaro e semplice sguardo sui driver ATI e NVIDIA…
sul perché ci sono tanti casini a metterli su
sul perché i distributori Linux (okkey… le distribuzioni) non possono (non dovrebbero) darli subito installati, ma è necessario che lo faccia l’utente..
http://kororaa.org/static.php?page=gpl

In breve si riassume così :
Il kernel è GPL (v2)
se scrivi un modulo per il kernel questo deve essere GPL. Altrimenti non lo puoi fare (potresti).

I driver ATI escono con licenza ATI ed i driver NVIDIA con licenza NVIDIA che nn sono GPL.
In teoria i driver ATI ed NVIDIA non dovrebbero essere scritti in questo modo, poichè essedno un lavoro derivato derivated work, dovrebbero rimanere compatibili con la GPL ed essere rilasciati come GPL.
Per non violare la licenza ATI e NVIDIA non danno il precompilato, perché in questo modo violerebbero la licenza, ma danno la possibilità di compilarlo.
Ed il trucco è tutto qui.

Chi compila il driver, linkandolo ai sorgenti del proprio kernel praticamente viola la licenza.

ATI e NVIDIA si guardano bene dal farlo, i distributori vorrebbero farlo per venire incontro agli utenti, ma non possono farlo, a meno di non violare la licenza ed essere intimati dagli sviluppatori del kernel a desistere (vedi caso Kororaa).
E allora?

Allora è l’utente finale che, compilando il modulo e linkandolo al kernel, viola la GPL del kernel.

Quindi se il nostro utente vuole l’accelerazione 3D, come è giusto che sia, visto che ha pagato per quel pezzo di hardware, è costretto a violare la GPL, pena accelerazione 3D disabilitata.

Ci sono altri modi o vie per avere la 3D abilitata senza violare la GPL?
In teoria si, in pratica no.
A livello ATI ci sono i radeon, i driver open che escono con il kernel… che però coprono solo alcun delle funzionalità ed alcuni giochi semplicemente non funzionano con questi, per quel che riguarda NVIDIA non lo so perché non ho una NVIDIA.

Il problema è quindi alla fonte. Se la ATI e la NVIDIA rilasciassero dei driver GPL tutto questo non avverrebbe. Le posizioni delle due case è:
non rilasciamo i driver GPL perché dobbiamo proteggere le nostre proprietà intellettuali.
La posizione degli sviluppatori del kernel è:
nessuno ti obbliga ad utilizzare LINUX ed il suo kernel.
Se lo fai, devi allinearti con le sue regole.

Chi perde, alla fine, è sempre l’utente finale.