Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 02/01/2024, à 13:00

iznobe

Suite à differentes Mises à niveau , nettoyage de paquets obsolete

Bonjour , j ' aimerais nettoyer des mini serveur de paquets obsoletes qui ont subis differentes MAN car ils comportent maintenant des paquets inutiles .

Sauf que j' aimerais savoir comment etre sur que je puisse les supprimer sans risque .

Comment m' assurer du fait qu ' ils ne sont effectivement plus utiles pour le systeme ?
peut etre avec depend ou rdepend ?

voici la liste actuelle sur un des serveurs dont j' ai besoin de faire un peu de nettoyage :

pi@xxx:~ $ apt list ~o
En train de lister... Fait
cpp-4.9/now 4.9.3-14 armhf  [installé, local]
cpp-6/now 6.3.0-18+rpi1+deb9u1 armhf  [installé, local]
firmware-ralink/now 1:0.43+rpi6 all  [installé, local]
gcc-4.6-base/now 4.6.4-5+rpi1 armhf  [installé, local]
gcc-4.7-base/now 4.7.3-11+rpi1 armhf  [installé, local]
gcc-4.8-base/now 4.8.5-4 armhf  [installé, local]
gcc-4.9-base/now 4.9.3-14 armhf  [installé, local]
gcc-4.9/now 4.9.3-14 armhf  [installé, local]
gcc-6-base/now 6.3.0-18+rpi1+deb9u1 armhf  [installé, local]
gcc-6/now 6.3.0-18+rpi1+deb9u1 armhf  [installé, local]
gksu/now 2.0.2-9 armhf  [installé, local]
gnome-icon-theme-symbolic/now 3.12.0-2 all  [installé, local]
leafpad/now 0.8.18.1-5 armhf  [installé, local]
libapache2-mod-php5/now 5.6.40+dfsg-0+deb8u12 armhf  [installé, local]
libapt-inst1.5/now 1.0.9.8.6 armhf  [installé, local]
libapt-pkg4.12/now 1.0.9.8.6 armhf  [installé, local]
libasan1/now 4.9.3-14 armhf  [installé, local]
libasan3/now 6.3.0-18+rpi1+deb9u1 armhf  [installé, local]
libavcodec57/now 7:3.2.16-1+deb9u1 armhf  [installé, local]
libavformat57/now 7:3.2.16-1+deb9u1 armhf  [installé, local]
libavutil55/now 7:3.2.16-1+deb9u1 armhf  [installé, local]
libbluray1/now 1:0.9.3-4 armhf  [installé, local]
libboost-iostreams1.49.0/now 1.49.0-4+b2 armhf  [installé, local]
libboost-iostreams1.50.0/now 1.50.0-1+b2 armhf  [installé, local]
libboost-iostreams1.53.0/now 1.53.0-6+b2 armhf  [installé, local]
libboost-iostreams1.54.0/now 1.54.0-5 armhf  [installé, local]
libboost-iostreams1.55.0/now 1.55.0+dfsg-3 armhf  [installé, local]
libcryptsetup4/now 2:1.7.3-4 armhf  [installé, local]
libdns-export100/now 1:9.9.5.dfsg-9+deb8u19 armhf  [installé, local]
libenchant1c2a/now 1.6.0-11+b1 armhf  [installé, local]
libffi6/now 3.2.1-6 armhf  [installé, local]
libgcc-4.9-dev/now 4.9.3-14 armhf  [installé, local]
libgcc-6-dev/now 6.3.0-18+rpi1+deb9u1 armhf  [installé, local]
libgcc1/now 1:6.3.0-18+rpi1+deb9u1 armhf  [installé, local]
libgdbm3/now 1.8.3-14 armhf  [installé, local]
libgeoclue0/now 0.12.99-4+b1 armhf  [installé, local]
libgksu2-0/now 2.0.13~pre1-9 armhf  [installé, local]
libgnome-desktop-3-12/now 3.22.2-1 armhf  [installé, local]
libgnome-keyring-common/now 3.12.0-1 all  [installé, local]
libgnome-keyring0/now 3.12.0-1+b1 armhf  [installé, local]
libgnutls-deb0-28/now 3.3.30-0+deb8u1 armhf  [installé, local]
libgtop-2.0-10/now 2.34.2-1 armhf  [installé, local]
libhogweed2/now 2.7.1-5+deb8u2 armhf  [installé, local]
libhunspell-1.4-0/now 1.4.1-2 armhf  [installé, local]
libicu52/now 52.1-8+deb8u8 armhf  [installé, local]
libirs-export91/now 1:9.9.5.dfsg-9+deb8u19 armhf  [installé, local]
libisc-export95/now 1:9.9.5.dfsg-9+deb8u19 armhf  [installé, local]
libisccfg-export90/now 1:9.9.5.dfsg-9+deb8u19 armhf  [installé, local]
libisl15/now 0.18-1 armhf  [installé, local]
libjavascriptcoregtk-3.0-0/now 1:2.4.1-1rpi53rpi1g armhf  [installé, local]
libjson-c2/now 0.11-4+deb8u2 armhf  [installé, local]
liblogging-stdlog0/now 1.0.5-2 armhf  [installé, local]
liblognorm1/now 1.0.1-3 armhf  [installé, local]
libmpfr4/now 3.1.5-1 armhf  [installé, local]
libnettle4/now 2.7.1-5+deb8u2 armhf  [installé, local]
libonig2/now 5.9.5-3.2+deb8u4 armhf  [installé, local]
libpng12-0/now 1.2.54-6 armhf  [installé, local]
libprocps3/now 2:3.3.9-9+deb8u1 armhf  [installé, local]
libpsl0/now 0.5.1-1 armhf  [installé, local]
libreadline6/now 6.3-9 armhf  [installé, local]
libsigc++-1.2-5c2/now 1.2.7-2+b1 armhf  [installé, local]
libsndio6.1/now 1.1.0-3 armhf  [installé, local]
libssl1.0.0/now 1.0.1t-1+deb8u12 armhf  [installé, local]
libswresample2/now 7:3.2.16-1+deb9u1 armhf  [installé, local]
libubsan0/now 6.3.0-18+rpi1+deb9u1 armhf  [installé, local]
libva-drm1/now 1.7.3-2 armhf  [installé, local]
libva-x11-1/now 1.7.3-2 armhf  [installé, local]
libva1/now 1.7.3-2 armhf  [installé, local]
libvpx4/now 1.6.1-3+deb9u3 armhf  [installé, local]
libwebkitgtk-3.0-0/now 1:2.4.1-1rpi53rpi1g armhf  [installé, local]
libwebkitgtk-3.0-common/now 1:2.4.1-1rpi53rpi1g all  [installé, local]
libwebp5/now 0.4.1-1.2 armhf  [installé, local]
libwebpmux2/now 0.5.2-1+deb9u1 armhf  [installé, local]
libx264-148/now 2:0.148.2748+git97eaef2-1+rpi1 armhf  [installé, local]
libx265-95/now 2.1-2 armhf  [installé, local]
libxapian22/now 1.2.19-1+deb8u1 armhf  [installé, local]
libxtables10/now 1.4.21-2 armhf  [installé, local]
mountall/now 2.54 armhf  [installé, local]
mplayer2/now 3:0.23.0-2+deb9u2 all  [installé, local]
multiarch-support/now 2.24-11+deb9u4 armhf  [installé, local]
omxplayer/now 20190607+gitf06235c-1 armhf  [installé, local]
oracle-java8-jdk/now 8u65 armhf  [installé, local]
penguinspuzzle/now 20120902-1 armhf  [installé, local]
php5-cgi/now 5.6.40+dfsg-0+deb8u12 armhf  [installé, local]
php5-cli/now 5.6.40+dfsg-0+deb8u12 armhf  [installé, local]
php5-common/now 5.6.40+dfsg-0+deb8u12 armhf  [installé, local]
php5-json/now 1.3.6-1 armhf  [installé, local]
php5-readline/now 5.6.40+dfsg-0+deb8u12 armhf  [installé, local]
php5/now 5.6.40+dfsg-0+deb8u12 all  [installé, local]
python3-codebug-i2c-tether/now 0.2.3-1 all  [installé, local]
python3-pifacecommon/now 4.2.1-2 all  [installé, local]
python3-pifacedigital-scratch-handler/now 2.0.5-1 all  [installé, local]
python3-pifacedigitalio/now 3.1.0-2 all  [installé, local]
raspbian-archive-keyring/now 20120528.2 all  [installé, local]
rpd-icons/now 0.18 all  [installé, local]
wiringpi/now 2.50 armhf  [installé, local]
pi@xxx:~ $ apt list ~o | wc -l

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

97
pi@xxx:~ $ apt list php*cli
En train de lister... Fait
php-cli/oldstable 2:7.4+76 all
php-horde-cli/oldstable 2.3.0-6 all
php5-cli/now 5.6.40+dfsg-0+deb8u12 armhf  [installé, local]
php7.4-cli/oldstable,oldstable-security 7.4.33-1+deb11u4 armhf
pi@xxx:~ $

quelle difference doit on conclure des paquets comportant le suffixe "oldstable" par rapport a ceux ayant " now " ou encore " oldstable,oldstable-security " ?


pi@xxx:~ $ apt depends php5-cli
php5-cli
  Dépend: libbz2-1.0
  Dépend: libc6 (>= 2.15)
  Dépend: <libcomerr2> (>= 1.01)
    libcom-err2
  Dépend: libdb5.3
  Dépend: libgssapi-krb5-2 (>= 1.6.dfsg.2)
  Dépend: libk5crypto3 (>= 1.6.dfsg.2)
  Dépend: libkrb5-3 (>= 1.6.dfsg.2)
  Dépend: libonig2 (>= 5.9.5)
  Dépend: libpcre3 (>= 1:8.35)
  Dépend: libqdbm14 (>= 1.8.74)
  Dépend: libssl1.0.0 (>= 1.0.1)
  Dépend: libxml2 (>= 2.9.0)
  Dépend: zlib1g (>= 1:1.2.3.4)
  Dépend: mime-support
  Dépend: php5-common (= 5.6.40+dfsg-0+deb8u12)
  Dépend: php5-json
  Dépend: libmagic1
  Dépend: ucf
  Dépend: tzdata
  Dépend: libedit2 (>= 2.11-20080614-4)
  Recommande: php5-readline
  Suggère: php-pear
pi@xxx:~ $ apt rdepends php5-cli
php5-cli
Reverse Depends:
  Dépend: php5-readline (= 5.6.40+dfsg-0+deb8u12)
  Dépend: davical
  Dépend: php5-cgi
  Dépend: libapache2-mod-php5
  Recommande: libphutil
  Dépend: arcanist
pi@xxx:~ $ sudo apt remove -s  php5-cli
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Lecture des informations d'état... Fait      
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  libonig2 libqdbm14 php5-common php5-json
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets suivants seront ENLEVÉS :
  libapache2-mod-php5 php5 php5-cgi php5-cli php5-readline
0 mis à jour, 0 nouvellement installés, 5 à enlever et 0 non mis à jour.
Remv php5 [5.6.40+dfsg-0+deb8u12]
Remv libapache2-mod-php5 [5.6.40+dfsg-0+deb8u12]
Remv php5-cgi [5.6.40+dfsg-0+deb8u12]
Remv php5-readline [5.6.40+dfsg-0+deb8u12]
Remv php5-cli [5.6.40+dfsg-0+deb8u12]
pi@xxx:~ $

Comment puis je conclure que le paquet est supprimable sans risque ?

Dernière modification par iznobe (Le 02/01/2024, à 13:06)


retour utilisable de commande
MSI Z490A-pro , i7 10700 , 32 GB RAM .

Hors ligne

#2 Le 13/01/2024, à 22:43

jpoc

Re : Suite à differentes Mises à niveau , nettoyage de paquets obsolete

commencer par

sudo apt autoremove

Hors ligne

#3 Le 09/02/2024, à 12:03

iznobe

Re : Suite à differentes Mises à niveau , nettoyage de paquets obsolete

Salut jpoc et merci pour la suggestion .

Je cherche à faire le tri dans les paquets orphelins en fait .

par exemple on voit plusieurs versions de gcc installé je suppose que la dernière version , qui n' est pas : " [installé, local] " , mais juste " installé " fonctionne normalement .
Du coup est ce que je peux supprimer sans risque les versions  orphelines :

gcc-4.6-base/now 4.6.4-5+rpi1 armhf  [installé, local]
gcc-4.7-base/now 4.7.3-11+rpi1 armhf  [installé, local]
gcc-4.8-base/now 4.8.5-4 armhf  [installé, local]
gcc-4.9-base/now 4.9.3-14 armhf  [installé, local]
gcc-4.9/now 4.9.3-14 armhf  [installé, local]
gcc-6-base/now 6.3.0-18+rpi1+deb9u1 armhf  [installé, local]
gcc-6/now 6.3.0-18+rpi1+deb9u1 armhf  [installé, local]

avec par exemple :

sudo apt remove gcc-4* gcc-6*

?

Dernière modification par iznobe (Le 09/02/2024, à 12:04)


retour utilisable de commande
MSI Z490A-pro , i7 10700 , 32 GB RAM .

Hors ligne

#4 Le 09/02/2024, à 12:27

jplemoine

Re : Suite à differentes Mises à niveau , nettoyage de paquets obsolete

apt autoremove

laisse les fichiers de configurations.
Si on veut un nettoyage complet, il faut ajouter le paramètre purge

apt autoremove --purge

ou (sur cetains système dont Ubuntu)

apt autopurge

J'avais fait un script (voir si dssous) pour détecter les paquets installés manuellement et non via un dépôt.

#! /bin/bash
clear
echo "liste des paquets installés en manuel"
echo "-------------------------------------"
echo " "

# ----------       paramétrage  ---------------

# taille en pixels à mettre en négatif
col1=-35
col2=-17
# modulo pour affichage du pourcentage
modulo=5
# mode debug ou non
debug='N'
# ------- fin paramétrage -------------

# récupération du nombre de paquets installés
total=0
if [ $debug = 'O' ]; then
  # mettre un pattern pour limiter la sélection : on peut le modifier à volonté
  liste=$(dpkg --get-selections "a*" "g*" | awk '{print $1}')
else
  liste=$(dpkg --get-selections | awk '{print $1}')
fi

for line in $(echo "$liste")
do
  ((total++))
done

#echo " "
#echo " total = $total"
#echo " "

# s'il n'y a pas de paquets, on sort...
if [ $total = 0 ]; then
  echo " "
  echo " Il n'y a pas de paquet correspondant aux critères."
  echo " "  
  exit
fi

# lecture des infos des paquets
nb=0
pcnt=0
save=0
sortie=""

echo -n "0%"
for line in $(echo "$liste") 
do 
  ((nb++))
  var=$(echo "$line | $(apt-cache show $line | grep -c Filename:)" | grep "| 0" | awk -F '|' '{print $1}')
  if [ "1${var}" != "1" ]; then 
    ver=$(apt-cache show $(echo "$var") | grep "Version")
    
    if [ "1${sortie}" == "1" ]; then
      sortie=$(echo " |  $sortie")
    else
      sortie=$(echo "$sortie; |  ")
    fi
    var=$(printf "%*s" $col1 $var)
    ver=$(echo $ver | awk -F ':' '{print $2}')
    ver=$(printf "%*s" $col2 $ver)
    sortie=$(echo "$sortie$var | Version: $ver")
    sortie=$(echo "$sortie |")
  fi 

  # on remplace le ; par un CR
  sortie=$(echo "$sortie" | tr ';' '\012')
  # calcul du pourcentage
  pcnt=$(echo "scale=0; $nb*100/$total" | bc)
  mod=$(echo "scale=0; $pcnt % $modulo" | bc)
  # Si le poucentage a changé et s'il est multiple du modulo,
  # on l'affiche
  if [ $pcnt != $save ]; then
    if [ $mod = 0 ]; then
      echo -n "${pcnt}%"
    else
      echo -n "."
    fi
    save=$pcnt
  fi
done

# on cree le tableau
echo " "
echo " "
echo " |--------------------------------------|----------------------------|"
echo " |                                      |                            |"
echo " |            nom paquet                |      version installée     |"
echo " |                                      |                            |"
echo " |--------------------------------------|----------------------------|"
echo " |                                      |                            |"
echo "$sortie"
echo " |                                      |                            |"
echo " |--------------------------------------|----------------------------|"
echo " "
echo "fin du traitement. nombre de paquets traites : $nb"

Même remarque : il faut mieux faire un

apt purge

au lieu de

apt remove

.

Puis faire un

dpkg -l | grep -v ii

S'il y a des paquets en rc, ce sont des résidus de configuration : il faut faire un purge du paquet.


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne