====== Gestion des paquets sous Ubuntu ====== ===== Commandes utiles ===== ==== synchroniser la liste des paquets disponibles ==== ''sudo apt-get update'' mettre a jour la liste des paquets. ==== Mettre à jour les paquets non a jour ==== ''sudo apt-get upgrade'' mets a jour les paquets a mettre a jour. Un bon ''upgrade'' doit être précédé d'un ''update'' sudo apt-get update sudo apt-get upgrade ==== Nettoyage des paquets obsolètes ==== ''sudo apt-get autoclean'' supprime les paquets obsolètes ==== Installer des paquets ==== ''sudo apt install %PAQUETS%'' installe les paquets mentionnés, cette version est plus belle que ''apt-get install''. ==== Lister les paquets installés ==== Source : [[https://wiki.debian.org/fr/ListInstalledPackages]] ''dpkg-query -l'' ==== Supprimer des paquets ==== sudo apt remove mon_paquet sudo apt purge mon_paquet [[https://doc.ubuntu-fr.org/tutoriel/comment_supprimer_un_paquet]] ===== Problèmes ===== ==== Le fichier de cache des paquets est corrompu ==== === Symptômes === admin@admin:~$ sudo apt-get update Atteint :1 http://fr.archive.ubuntu.com/ubuntu bionic InRelease Atteint :2 http://fr.archive.ubuntu.com/ubuntu bionic-updates InRelease Atteint :3 http://security.ubuntu.com/ubuntu bionic-security InRelease Ign :4 http://download.webmin.com/download/repository sarge InRelease Atteint :5 http://dl.ubnt.com/unifi/debian stable InRelease Atteint :6 http://download.webmin.com/download/repository sarge Release Lecture des listes de paquets... Erreur ! E: Erreur de lecture - read (5: Input/output error) W: Vous pouvez lancer « apt-get update » pour corriger ces problèmes. E: Le fichier de cache des paquets est corrompu === Résolution === sudo rm /var/lib/apt/lists/* -vf // supprime tous les fichiers du dossier apt/lists sudo apt-get update ==== Input/output error ==== === Symptômes === Reading package lists... Building dependency tree... Reading state information... ... (Reading database ... 70% dpkg: unrecoverable fatal error, aborting: reading files list for package 'libgssapi3-heimdal:amd64': Input/output error E: Sub-process /usr/bin/dpkg returned an error code (2) === Résolution === Source -> [[https://askubuntu.com/questions/139377/unable-to-install-any-updates-through-update-manager-apt-get-upgrade]] >So the solution is the following: > >1 - Go into the ''/var/lib/dpkg directory'' >2 - Make a backup of the status file >3 - Edit the status file >4 - Search the package that gave the error >5 - Just delete the lines from this package (but let all other lines that concern other >packages even if they contains the broken package in their "Replaces" or "Depends" >fields) > >[…] > >6 - Save changes in the status file > >7 - Run: ''sudo dpkg --configure -a'' >Force the re-installation of missing dependencies (because now, there are some): > >8 - ''sudo apt-get -f install'' >I think that if the broken package does not depend on any other package (could be >rare), just reinstall it: > >9 - ''sudo apt-get install %the_package%'' >Everything is fine now can update, upgrade, or install new packages!