Kode: Vælg alt
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $(uname -r | sed -r 's/-[a-z]+//') | sed ':a;N;$!ba;s/\n/ /g'); sudo apt-get install linux-generic
Kode: Vælg alt
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $(uname -r | sed -r 's/-[a-z]+//') | sed ':a;N;$!ba;s/\n/ /g'); sudo apt-get install linux-generic
Kode: Vælg alt
chr@chr:~$ kernelver=$(uname -r | sed -r 's/-[a-z]+//'); old=$(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver | sed ':a;N;$!ba;s/\n/ /g'); sudo apt-get purge $old
Indlæser pakkelisterne... Færdig
Opbygger afhængighedstræ
Læser tilstandsoplysninger... Færdig
Følgende pakker vil blive AFINSTALLERET:
linux-headers-3.13.0-24* linux-headers-3.13.0-24-generic*
linux-image-3.13.0-24-generic* linux-image-extra-3.13.0-24-generic*
0 opgraderes, 0 nyinstalleres, 4 afinstalleres og 4 opgraderes ikke.
Efter denne handling, vil 270 MB diskplads blive frigjort.
Do you want to continue? [Y/n] y
(Læser database ... 330617 filer og kataloger installeret i øjeblikket.)
Removing linux-headers-3.13.0-24-generic (3.13.0-24.47) ...
Removing linux-headers-3.13.0-24 (3.13.0-24.47) ...
Removing linux-image-extra-3.13.0-24-generic (3.13.0-24.47) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-24-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
Generating grub configuration file ...
Fandt linux-aftryk: /boot/vmlinuz-3.13.0-37-generic
Fandt initrd-aftryk: /boot/initrd.img-3.13.0-37-generic
Fandt linux-aftryk: /boot/vmlinuz-3.13.0-24-generic
Fandt Windows Boot Manager på /dev/sdb1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
færdig
The link /initrd.img is a damaged link
Removing symbolic link initrd.img
you may need to re-run your boot loader[grub]
The link /initrd.img.old is a damaged link
Removing symbolic link initrd.img.old
you may need to re-run your boot loader[grub]
Purging configuration files for linux-image-extra-3.13.0-24-generic (3.13.0-24.47) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
Removing linux-image-3.13.0-24-generic (3.13.0-24.47) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-24-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
Generating grub configuration file ...
Fandt linux-aftryk: /boot/vmlinuz-3.13.0-37-generic
Fandt initrd-aftryk: /boot/initrd.img-3.13.0-37-generic
Fandt Windows Boot Manager på /dev/sdb1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
færdig
The link /vmlinuz is a damaged link
Removing symbolic link vmlinuz
you may need to re-run your boot loader[grub]
Purging configuration files for linux-image-3.13.0-24-generic (3.13.0-24.47) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-24-generic /boot/vmlinuz-3.13.0-24-generic
chr@chr:~$
AJenbo skrev:tak, testede det også først på min arbejdsmaskine før jeg smed den her op. ville den ikke være god at tilføje til dit oprydnings script?
AJenbo skrev:Jeg har fjernet brug af shell variabler (bruger output direkte), det burde ikke have nogen betydning og jeg har testet på min maskine igen samt 2 servere og vil også lige køre det på 2 andre maskiner når jeg kommer hjem, og vil ikke ændre yderligere i den.
Kode: Vælg alt
0 opgraderes, 0 nyinstalleres, 24 afinstalleres og 0 opgraderes ikke.
Efter denne handling, vil 1.623 MB diskplads blive frigjort.
Kode: Vælg alt
chr@chr:~$ sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $(uname -r | sed -r 's/-[a-z]+//') | sed ':a;N;$!ba;s/\n/ /g')
[sudo] password for chr:
Indlæser pakkelisterne... Færdig
Opbygger afhængighedstræ
Læser tilstandsoplysninger... Færdig
Følgende pakker vil blive AFINSTALLERET:
linux-headers-3.13.0-37* linux-headers-3.13.0-37-generic*
linux-image-3.13.0-37-generic* linux-image-extra-3.13.0-37-generic*
linux-signed-image-3.13.0-37-generic*
0 opgraderes, 0 nyinstalleres, 5 afinstalleres og 18 opgraderes ikke.
Efter denne handling, vil 271 MB diskplads blive frigjort.
Do you want to continue? [Y/n] y
(Læser database ... 331693 filer og kataloger installeret i øjeblikket.)
Removing linux-headers-3.13.0-37-generic (3.13.0-37.64) ...
Removing linux-headers-3.13.0-37 (3.13.0-37.64) ...
Removing linux-signed-image-3.13.0-37-generic (3.13.0-37.64) ...
Generating grub configuration file ...
Fandt linux-aftryk: /boot/vmlinuz-3.13.0-39-generic
Fandt initrd-aftryk: /boot/initrd.img-3.13.0-39-generic
Fandt linux-aftryk: /boot/vmlinuz-3.13.0-37-generic
Fandt initrd-aftryk: /boot/initrd.img-3.13.0-37-generic
Fandt Windows Boot Manager på /dev/sdb1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
færdig
Purging configuration files for linux-signed-image-3.13.0-37-generic (3.13.0-37.64) ...
Removing linux-image-extra-3.13.0-37-generic (3.13.0-37.64) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-37-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
Generating grub configuration file ...
Fandt linux-aftryk: /boot/vmlinuz-3.13.0-39-generic
Fandt initrd-aftryk: /boot/initrd.img-3.13.0-39-generic
Fandt linux-aftryk: /boot/vmlinuz-3.13.0-37-generic
Fandt Windows Boot Manager på /dev/sdb1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
færdig
Purging configuration files for linux-image-extra-3.13.0-37-generic (3.13.0-37.64) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
Removing linux-image-3.13.0-37-generic (3.13.0-37.64) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
dkms: removing: bcmwl 6.30.223.141+bdcom (3.13.0-37-generic) (x86_64)
-------- Uninstall Beginning --------
Module: bcmwl
Version: 6.30.223.141+bdcom
Kernel: 3.13.0-37-generic (x86_64)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
wl.ko:
- Uninstallation
- Deleting from: /lib/modules/3.13.0-37-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod....
DKMS: uninstall completed.
dkms: removing: virtualbox 4.3.10 (3.13.0-37-generic) (x86_64)
-------- Uninstall Beginning --------
Module: virtualbox
Version: 4.3.10
Kernel: 3.13.0-37-generic (x86_64)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
vboxdrv.ko:
- Uninstallation
- Deleting from: /lib/modules/3.13.0-37-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
vboxnetadp.ko:
- Uninstallation
- Deleting from: /lib/modules/3.13.0-37-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
vboxnetflt.ko:
- Uninstallation
- Deleting from: /lib/modules/3.13.0-37-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
vboxpci.ko:
- Uninstallation
- Deleting from: /lib/modules/3.13.0-37-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod....
DKMS: uninstall completed.
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-37-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
Generating grub configuration file ...
Fandt linux-aftryk: /boot/vmlinuz-3.13.0-39-generic
Fandt initrd-aftryk: /boot/initrd.img-3.13.0-39-generic
Fandt Windows Boot Manager på /dev/sdb1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
færdig
Purging configuration files for linux-image-3.13.0-37-generic (3.13.0-37.64) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-37-generic /boot/vmlinuz-3.13.0-37-generic
chr@chr:~$