Su Linux, in particolar modo sulle distribuzioni che contengono apt, ovvero il tool di pacchetti avanzato (come Debian, Ubuntu e le numerose derivate), l’utilizzo di questo potete programma è sicuramente enorme, smisurato.

Lo utilizziamo per installare un programma, un pacchetto, per rimuovere qualche app ormai inutile, per aggiornare la lista dei pacchetti disponibili, per controllare la disponibilità degli aggiornamenti, per inserire un kernel più recente ecc. ecc.

Capita però, come in tutte le cose, che apt…incorra in seri problemi. Problemi che gli impediscono di scaricare qualsiasi pacchetto o di bloccarsi ogni volta che tentate di installare/rimuovere un programma.

Che relazione c’è tra APT ed il Sources.list?

APT è l’advanced Packaging Tool, il sources.list invece è il file che APT utilizza per ricavare le sorgenti/gli indirizzi da cui ricevere il software. Ovvio che se questa lista è danneggiata, APT non farà altro che restituire errori e mazzate varie.

Il sources.list visto tramite un’interfaccia più chiara con GUI.

Come si ripara un Sources.list?

In linea di massa, piuttosto che cercare e modificare singolarmente le righe piene d’errori, è molto più facile e veloce andare a copiare il file originale.

Per iniziare, dovete digitare il seguente comando sul terminale, che aprirà appunto il sources.list (modificate gedit con il vostro editor di testo predefinito o preferito):

sudo gedit /etc/apt/sources.list

Come ripristinare il sources.list originale su Debian

Una volta aperto il file, cancellate tutto il contenuto ed incollate il seguente contenuto (per Debian 8 Jessie):

deb http://httpredir.debian.org/debian jessie main
deb-src http://httpredir.debian.org/debian jessie main

deb http://httpredir.debian.org/debian jessie-updates main
deb-src http://httpredir.debian.org/debian jessie-updates main

deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
deb http://httpredir.debian.org/debian jessie main contrib non-free
deb-src http://httpredir.debian.org/debian jessie main contrib non-free

deb http://httpredir.debian.org/debian jessie-updates main contrib non-free
deb-src http://httpredir.debian.org/debian jessie-updates main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

salvate, chiudete e riavviate. Fatto!

Come ripristinare il sources.list originale su Ubuntu e derivate

Stesso discorso di prima. Aprite il file ed incollate all’interno i seguenti indirizzi:

Per Ubuntu 17.10 Artful Aardvark (e derivate):

deb http://it.archive.ubuntu.com/ubuntu/ artful main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ artful main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu artful-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu artful-security main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu/ artful-updates main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ artful-updates main universe restricted multiverse

Per Ubuntu 17.04 Zesty Zapus (e derivate)

deb http://it.archive.ubuntu.com/ubuntu/ zesty main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ zesty main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu zesty-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu zesty-security main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu/ zesty-updates main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ zesty-updates main universe restricted multiverse
deb http://it.archive.ubuntu.com/ubuntu zesty-backports main restricted universe multiverse
deb-src http://it.archive.ubuntu.com/ubuntu zesty-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu zesty partner
deb-src http://archive.canonical.com/ubuntu zesty partner

Per Ubuntu 16.10 Yakkety Yak (e derivate)

deb http://it.archive.ubuntu.com/ubuntu/ yakkety main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ yakkety main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu yakkety-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu yakkety-security main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu/ yakkety-updates main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ yakkety-updates main universe restricted multiverse
deb http://it.archive.ubuntu.com/ubuntu yakkety-backports main restricted universe multiverse
deb-src http://it.archive.ubuntu.com/ubuntu yakkety-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu yakkety partner
deb-src http://archive.canonical.com/ubuntu yakkety partner

Per Ubuntu 16.04 Xenial Xerus (e derivate)

deb http://it.archive.ubuntu.com/ubuntu/ xenial main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ xenial main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu xenial-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu xenial-security main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu/ xenial-updates main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ xenial-updates main universe restricted multiverse
deb http://it.archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse
deb-src http://it.archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner

Per Ubuntu 14.04 LTS Trusty Tahr (e derivate):

deb http://it.archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu trusty-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu/ trusty-updates main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ trusty-updates main universe restricted multiverse
deb http://it.archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
deb-src http://it.archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu trusty partner
deb-src http://archive.canonical.com/ubuntu trusty partner