Je! Ninawezaje kuweka nafasi zaidi katika / boot?


Nenda kwa jibu lililokubaliwa


/boot Ugawaji wangu ni karibu kamili na mimi kupata onyo kila wakati mimi kuanza mfumo wangu. Tayari nilifuta vifurushi vya zamani vya kernel (linux-headers ...), kwa kweli nilifanya hivyo kusanidi toleo mpya la kernel ambalo lilikuja na sasisho za moja kwa moja.

Baada ya kusanidi toleo hilo jipya, kuhesabu karibu kulijaa tena. Kwa hivyo ni nini kingine ambacho ninaweza kufuta? Je! Kuna faili zingine zinazohusiana na picha za zamani za kernel?

Hapa kuna orodha ya faili ambazo ziko kwenye /boot kizigeu changu :

 :~$ ls /boot/
abi-2.6.31-21-generic         lost+found
abi-2.6.32-25-generic         memtest86+.bin
abi-2.6.38-10-generic         memtest86+_multiboot.bin
abi-2.6.38-11-generic         System.map-2.6.31-21-generic
abi-2.6.38-12-generic         System.map-2.6.32-25-generic
abi-2.6.38-8-generic          System.map-2.6.38-10-generic
abi-3.0.0-12-generic          System.map-2.6.38-11-generic
abi-3.0.0-13-generic          System.map-2.6.38-12-generic
abi-3.0.0-14-generic          System.map-2.6.38-8-generic
boot                          System.map-3.0.0-12-generic
config-2.6.31-21-generic      System.map-3.0.0-13-generic
config-2.6.32-25-generic      System.map-3.0.0-14-generic
config-2.6.38-10-generic      vmcoreinfo-2.6.31-21-generic
config-2.6.38-11-generic      vmcoreinfo-2.6.32-25-generic
config-2.6.38-12-generic      vmcoreinfo-2.6.38-10-generic
config-2.6.38-8-generic       vmcoreinfo-2.6.38-11-generic
config-3.0.0-12-generic       vmcoreinfo-2.6.38-12-generic
config-3.0.0-13-generic       vmcoreinfo-2.6.38-8-generic
config-3.0.0-14-generic       vmcoreinfo-3.0.0-12-generic
extlinux                      vmcoreinfo-3.0.0-13-generic
grub                          vmcoreinfo-3.0.0-14-generic
initrd.img-2.6.31-21-generic  vmlinuz-2.6.31-21-generic
initrd.img-2.6.32-25-generic  vmlinuz-2.6.32-25-generic
initrd.img-2.6.38-10-generic  vmlinuz-2.6.38-10-generic
initrd.img-2.6.38-11-generic  vmlinuz-2.6.38-11-generic
initrd.img-2.6.38-12-generic  vmlinuz-2.6.38-12-generic
initrd.img-2.6.38-8-generic   vmlinuz-2.6.38-8-generic
initrd.img-3.0.0-12-generic   vmlinuz-3.0.0-12-generic
initrd.img-3.0.0-13-generic   vmlinuz-3.0.0-13-generic
initrd.img-3.0.0-14-generic   vmlinuz-3.0.0-14-generic
 

Hivi sasa, ninatumia 3.0.0-14-generic kernel.


566





2011-12-22




Idadi ya majibu: 22


Una kernels nyingi zisizotumiwa. Ondoa kernels zote za mwisho na:

 sudo apt-get purge linux-image-{3.0.0-12,2.6.3{1-21,2-25,8-{1[012],8}}}
 

Hii ni wazi kwa:

 sudo apt-get purge linux-image-3.0.0-12 linux-image-2.6.31-21 linux-image-2.6.32-25 linux-image-2.6.38-10 linux-image-2.6.38-11 linux-image-2.6.38-12 linux-image-2.6.38-8
 

Kuondoa linux-image-x.x.x-x kifurushi pia kitaondoa linux-image-x.x.x-x-generic .

Vichwa vimewekwa ndani /usr/src na hutumiwa wakati wa kujenga moduli za kernel ya miti (kama dereva wa nvidia wa wamiliki na kisanduku cha kawaida). Watumiaji wengi wanapaswa kuondoa vifurushi vya kichwa ikiwa kifurushi cha kernel ( linux-image-* ) hakijasanikishwa.

Ili kuorodhesha kernels zote zilizosanikishwa, run:

 dpkg -l linux-image-\* | grep ^ii
 

Amri moja ya kuonyesha kerneli zote na vichwa ambavyo vinaweza kutolewa, ukiondoa kernel inayoendesha sasa :

 kernelver=$(uname -r | sed -r 's/-[a-z]+//')
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver
 

Ni kuchagua vifurushi vyote aitwaye kuanzia na linux-headers-<some number> au linux-image-<some number> , prints majina ya vifurushi kwa furushi imewekwa na kisha haihusishi sasa kubeba / mbio kernel (sio karibuni kernel!). Hii inafaa katika pendekezo la kujaribu kernel mpya kabla ya kuondoa kingo za zamani, zinazojulikana za kufanya kazi.

Kwa hivyo, baada ya kusasisha kernels na kuanzisha tena ili kuijaribu, unaweza kuondoa kerneli zingine zote na:

 sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
 

631


2011-12-24

Ugawanyaji wako wa boot umejaa. Kwa kuwa huu ni sasisho la kernel, faili hizi zitakiliwa kwa kizigeu cha boot hivyo unahitaji kusafisha nje. Hapa kuna chapisho la blogi ambalo litakuonyesha jinsi ya kusafisha picha za zamani za kernel na amri moja. Nitatoa maelewano ya kimsingi ya njia hiyo. Tumia amri hii kuchapisha toleo la kisasa la kernel yako:

 uname -r
 

Kisha utumie amri hii kuchapisha kerneli zote ulizo kusanikisha ambazo sio kerneli yako mpya:

 dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]'
 

Hakikisha kerneli yako ya sasa haiko kwenye orodha hiyo. Ona jinsi hii ni idadi ya amri ya mwisho (chini chini). Kuondoa na kufuta kerneli hizi za zamani utataka kusambaza hoja hizi kwa:

 sudo apt-get -y purge
 

Sasa tunaweza kufanya kila kitu tunachotaka kwa kuchanganya amri hizi mbili za mwisho ndani ya fujo hili lisilo takatifu:

 dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' | xargs sudo apt-get -y purge
 

Na kwamba amri moja itashughulikia kila kitu kwako. Nitathibitisha kuwa hii inafanya kazi kikamilifu lakini kamwe usimwamini mtu yeyote kwenye mtandao. :) Kwa habari zaidi, chapisho la blogi linatoa maelezo mazuri ya nini kila sehemu ya amri hufanya hivyo kusoma kupitia hivyo umeridhika kuwa hufanya kile unachotaka ifanye.


220


2013-02-21

 sudo apt-get autoremove
 

Amri hii inafanya kazi hiyo kiatomati.


112


2012-11-05

Kidhibiti cha Kifurushi cha Synaptic kinaweza kutumika kuchagua kwa urahisi na kuondoa picha za zamani za kernel.
Picha ya skrini ya Meneja Ufungaji wa Synaptic

Ikiwa tayari haujasanikisha Synaptic:

 sudo apt-get install synaptic
 

Anzisha programu na uchague chaguzi zilizoonyeshwa.

Unastahili kuonyesha vifurushi vyote "linux-" na toleo "2.6.x" ambapo x ni kati ya 31 hadi 38 kulingana na faili kwenye folda yako / boot.

Bonyeza kulia kwa kila moja ya vifurushi hivyo na uchague chaguo "Alama ya Kuondoa Kamili". Mwishowe bonyeza kitufe cha kuomba. Hii itaondoa faili zote na faili yoyote inayohusika. /boot Folda yako sasa inapaswa kuwa kidogo.


40


2011-12-24

Asante kwa chapisho lako la kina la shida yako, hii ilinifanya niende kwa mwelekeo sahihi. Ingawa ni muhimu kuweka faili za kernel za zamani unaweza kuziondoa kwa njia moja, angalia chapisho hili:
Jinsi ya Ondoa Vichwa Vya Nyongeza vya Linux Kernel, Picha na Moduli

Imekamilika kupitia mstari wa amri. Ikiwa unafanya hivi kupitia kitu cha mbali tumia kitu kama WINSCP kufungua kikao cha terminal na kuiweka tu, inafanya kazi vizuri.

Hapa imenakiliwa kutoka kwa kiungo cha makala, ninapendekeza usome nakala kamili:

 dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
 

25


2012-06-01

Hii ni jibu mpya kwa swali la zamani, lakini njia rahisi ya kusafisha kitu hiki (na zaidi) ni kufunga Ubuntu Tweak . Ili kuisakinisha :

 sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak
 

basi unaweza kukimbia Ubuntu Tweak, Kwenda kwenye kichupo cha "janitor", na kutoka hapa ni suala la kubofya tatu:


Ubuntu tweak janitor kwa kernels za zamani

Ni bora kuacha kernel ya mwisho (haujui kamwe) au kernel inayojulikana ya kufanya kazi kwa usalama, ingawa; lakini hiyo inaweza kurahisishwa kwa urahisi.

Unaweza kutumia zana moja kusafisha vitu vingi-- kumbuka tu kwamba ikiwa utakasa kashe ya kijipicha au kache ya kifua kikuu basi mfumo utalazimika kuziunda tena ikiwa zinahitajika.


23


2014-11-25

Niliweza kurekebisha shida kwa kutumia dpkg kuondoa vifurushi moja kwa moja. Ingawa vifurushi bado zimeorodheshwa dpkg -l , faili huondolewa /boot , kutolewa nafasi.

 [email protected]:/boot$ sudo dpkg --remove linux-image-2.6.32-30-server
(Reading database ... 145199 files and directories currently installed.)
Removing linux-image-2.6.32-30-server ...
Running postrm hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-35-server
Found linux image: /boot/vmlinuz-2.6.32-34-server
Found initrd image: /boot/initrd.img-2.6.32-34-server
Found linux image: /boot/vmlinuz-2.6.32-33-server
Found initrd image: /boot/initrd.img-2.6.32-33-server
Found linux image: /boot/vmlinuz-2.6.32-32-server
Found initrd image: /boot/initrd.img-2.6.32-32-server
Found linux image: /boot/vmlinuz-2.6.32-31-server
Found initrd image: /boot/initrd.img-2.6.32-31-server
Found memtest86+ image: /memtest86+.bin
done

# Repeat for kernels -31 and -32 and -33, up to (but not including)
# the version listed by `uname -a`
 

Baada ya hayo, apt-get -f install nilirekebisha shida zangu za utegemezi, na yote yalikuwa vizuri na ulimwengu.

Sitakubali jibu langu hili, hata hivyo, kwani bado ninahitaji kujua ikiwa ninapaswa kuongeza /boot saizi yangu au kufanya kitu kingine.


19


2011-12-03

Unaweza kuacha kutumia kizigeu tofauti / cha boot, basi hautakuwa na nafasi ndogo huko. Ili kufanya hivyo, futa kizigeu, kisha uiweke mahali pengine na unakili faili zote hapo kwenye saraka / boot kwenye kizigeu chako cha mizizi, kisha uondoe kiingilio kutoka / nk / fstab na uweke tena kwenye grub. Kwa mfano (utahitaji kutumia kizigeu sahihi):

 sudo -s
umount /boot
mount /dev/sda2 /mnt
cp -a /mnt/* /boot/
umount /mnt
gedit /etc/fstab
grub-install /dev/sda
 

Kisha unaweza kutumia gpart kufuta kizigeu cha zamani / cha boot, na uwezekano wa kupanua kizigeu cha mizizi kutumia nafasi hiyo. Ili kupanua kizigeu cha mizizi utahitaji kuzima kutoka kwa sekunde, na nafasi ya bure inahitaji kuwa mara moja kulia. Ikiwa kizigeu / boot sasa ni upande wa kushoto wa kizigeu cha mizizi, basi utahitaji kwanza kusonga kizigeu cha mkono kushoto, kisha uiongeze, lakini hii inaweza kuchukua muda mrefu sana, kwa hivyo haifai shida.


15


2011-12-22

Kuchukua bora kutoka kwa majibu hapo juu, mbinu yangu iliyojaribu na ya kweli ni hii:

  • uname -a kupata kernel inayoendesha.
  • dpkg -l linux-{headers,image}-\* | grep ^ii kuorodhesha vifurushi vyote vinavyohusiana na kernel. Hii itajumuisha kernel inayoendesha.
  • sudo apt-get purge linux-{image,headers}-3.16.0-{xx,yy,zz} kuondoa kingo za zamani. Badilika xx,yy,zz na orodha ya kernel inayojenga unayotaka kuondoa- haya yote ni vifaa vilivyoorodheshwa na amri ya zamani ambayo ni mzee kuliko kernel inayoendesha sasa. Hakikisha hautaondoa kernel inayoendesha kwa sasa - mfumo wako hautaweza kushibishwa . Unaweza pia kuhitaji kubadilisha toleo la kernel kutoka 3.16.0 kwa chochote kilichowekwa kwenye mfumo wako.
  • Kwa hiari, fanya ziada sudo apt-get autoremove - itaondoa utegemezi wowote wa mabaki ya kerneli ambazo hazihitajiki tena na ule wa sasa, ukitoa nafasi zaidi.

Unaweza kuwa na faili za kichwa bila kulinganisha matoleo ya kernel iliyosanikishwa, au kinyume chake - ingiza matoleo haya yote katika amri. APT italalamika kwamba vifurushi vingine haziwezi kuondolewa kwa sababu hazijasanikishwa, lakini hiyo haitaumiza.

Ikiwa kitu kitashindwa ...

  • Ikiwa amri ya apt itashindwa kwa sababu hakuna nafasi iliyoachwa kwenye kosa la kifaa , tumia amri ya dpkg inayolingana : sudo dpkg --purge linux-{image,headers}-3.16.0-{xx,yy,zz} .
  • Ikiwa amri ya dpkg bado haifanyi kazi kwa sababu linux-image vifurushi zinahitajika na linux-headers vifurushi vya toleo lile lile (ambalo pia unataka kufuta), dpkg inaweza kuwa imeshindwa kusuluhisha hiyo. Angalia tena mazao dpkg -l na taja sauti yoyote ya jina la kifurushi kwenye mstari wa amri. Kwa mfano, kwenye moja ya mifumo yangu amri ambayo hatimaye ilifanya kazi ilikuwa sudo dpkg --purge linux-{image,headers}-3.16.0-{xx,yy,zz}-generic-pae .
  • Ukipata hitilafu nyingine yoyote, tafuta msaada-unaweza kuwa na shida tofauti na vile ulivyofikiria.

10


2015-07-09

Kwangu mimi apt-get purge na dpkg --remove wote wawili nilishindwa. Kwa hivyo ilibidi nikafute picha kadhaa za zamani za kernel kutoka / boot na rm -f .


5


2013-10-14

Orodhesha kern zote:

 dpkg --list 'linux-image*'
 

Onyesha kernel ya sasa:

 uname -r
 

Orodhesha kernels zote EXCEPT moja ya sasa:

 dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]'
 

Hakikisha kerneli yako ya sasa haiko kwenye orodha hiyo.

Ondoa kernels zote EXCEPT moja ya sasa:

 dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' | xargs sudo apt-get -y purge
 

Futa vitu vingine:

 sudo apt-get autoremove
 

Ikiwa bado inakupa kosa la nafasi ya diski ya boot kwa kusanikisha / kufungua faili basi futa moja kwa moja picha moja ya OLD kutoka / saraka ya boot,

 ls -lh /boot/*-3.13.0-119*;

rm /boot/*-3.13.0-119*; 
 

KUMBUKA: Tafadhali kagua picha ya sasa ya kernel kabla ya kufuta picha yoyote.


5


2018-07-10

Tayari nilifuta vifurushi vya zamani vya kernel (vifuniko vya kichwa vya ...

linux-headers-* sio kingo. Vifurushi vya Kernel ndio waliotajwa linux-image-* . Waliopewa jina linux-headers-* ni vifurushi vya ukuzaji vya kuunda moduli za kernel: hawaishi kwenye saraka / boot na hazihitajiki kwa matumizi ya siku yako ya kila siku ya mfumo wako.

Faili waliotajwa katika / Boot kufanya ni pamoja na picha kadhaa zamani kernel ( vmlinuz* ) na imeandaliwa picha initrd ( initrd.img* ) kwa ajili ya kokwa hizo, ambayo ni dalili kuwa bado una mengi ya vifurushi zamani kernel imewekwa.

Unapaswa kuwa na uwezo wa kuorodhesha kernels zako zilizosanikishwa

 aptitude search ~ilinux-image
 

(Kumbuka kuwa hii itarudisha vifurushi ambavyo sio kerneli, pia).

Kawaida hakuna haja ya kernels zaidi ya mbili kusanikishwa - ile inayotumika sasa na ile iliyotangulia kwa hiyo (kama kurudi nyuma). Kwa hivyo unaweza kuanza kuondoa wazee, moja kwa moja, kama hii:

 sudo apt-get autoremove linux-image-3.2.0-23-generic
 

Hakikisha unabadilisha "3.2.0-23-generic" na toleo halisi la kernel ambalo unataka kuondoa! Pia, usiondoe vifurushi kama vile linux-image-generic . Lazima uwe mwangalifu sana ili usiondoe kernel inayoendesha hivi sasa au hautaweza ku Boot (Ubuntu anaweza au asiweze kukuonya juu ya kufanya hivi).

Unaweza kupata kernel yako inayoendelea hivi sasa na:

 uname -r
 

2


2014-08-29

Nilikuwa na shida hii na zaidi nilipoondoa initrd-img-xxx faili kadhaa kwa mikono kutoka kwa boot / na nilikuwa na shida kwamba matoleo haya ya zamani yanaendelea kuzalishwa na kujaza /boot folda. Ili kuirekebisha nilifuata yafuatayo:

  • Niliondoa toleo la zamani la kernel kwa mikono ili nafasi ya bure.
  • Utakuwa ukihariri faili ya usanidi wa maandishi kama superuser, kwa hivyo kubandika yafuatayo kwenye terminal:

     sudo gedit /etc/initramfs-tools/update-initramfs.conf
     
  • Pata mstari update_initramfs=yes na ubadilishe kuwa update_initramfs=no . Hifadhi na utupe faili, kisha kukimbia:

     sudo dpkg --configure -a
     

Hiyo ilitatua shida yangu. Hiyo ilikuwa msingi wa blogi hii

Kwa matumaini, kila kitu kinapaswa kuwa sawa wakati unapoanza upya, na baadaye unaweza kujaribu kubadilisha no nyuma kuwa yes ndani update-initramfs.conf .


1


2017-03-23

Ninaonyesha kuwa bado mnamo 2017 swali hili lina maoni na majibu mapya lakini inakosa jibu moja ambalo nadhani ni muhimu sana hapa:

Ubuntu kama OS ya desktop ya utumiaji rahisi wa kila siku haina sababu ya kusanikishwa na kizigeu tofauti \ na kitu kama hiki HATAKUToa kitu kwa "mtumiaji wa kawaida" ... kwa hivyo suluhisho ni usanidi mpya bila kizigeu cha boot \ na hii njia hautawahi kuwa na shida kama hiyo

PS: Jibu langu linaweza kufutwa au kuongezwa katika jibu lililokubaliwa ... (Nadhani itasaidia watu wengine hivi)


1


2017-08-20

Huduma inayosaidia sana ambayo itaondoa kizigeu chako cha boot

 git clone https://github.com/erichs/bootnukem.git
cd bootnukem
sudo ./install.sh
 

Tumia kwa hatari yako mwenyewe, lakini ilinifanyia kazi:

 sudo bootnukem
 

1


2016-08-14

Kwa usawa au upatanisho kuna sehemu "ya zamani au imewekwa kwa mikono". Lazima kuwe na vifurushi vya zamani vya linux hapo.


0


2011-12-22

Kuna maandishi ya bash ambayo niliandika yape hapa ambayo hufanya mchakato huo urahisike zaidi.

YMMV - ilitengenezwa kwa Mint 14. Bado unajifunza BASH kwa hivyo labda ni kidogo. Tumia kwa hatari yako mwenyewe, lakini inanifanyia kazi!

 #!/bin/bash

endCol='\e[0m'
bold_red='\e[1;31m'
bold_green='\e[1;32m'
bold_yellow='\e[1;33m'

title_color='\e[0;30;47m'

function show_kernel_info {
clear
current_kernel=$(uname -r)
echo "Current ACTIVE kernel is:"
echo -e "  "$bold_yellow$current_kernel$endCol
echo "This kernel will be TOTALLY EXCLUDED from all actions in this script."
echo "Also, one fallback non-active kernel will be always left untouched."
echo ""
echo "These are the non-active kernels stored in /boot:"
count_of_old_kernels_in_boot=$(ls -o /boot/initrd* | grep -c -v "$current_kernel")
if [ $count_of_old_kernels_in_boot = 0 ]; then
  echo " * No non-active kernels found! *"
else
  ls -o /boot/initrd* | grep -v "$current_kernel"
fi
echo ""
list_of_old_kernels=$(dpkg --list | grep linux-image | awk -F' ' '{ print $2 }' | grep -v "$current_kernel" | grep -v "linux-image-generic")
current_old_kernel=$(dpkg --list | grep linux-image | awk -F' ' '{ print $2 }' | grep -v "$current_kernel" | grep -v "linux-image-generic" | head -n 1)
count_of_old_kernels_installed=$(dpkg --list | grep linux-image | awk -F' ' '{ print $2 }' | grep -v "$current_kernel" | grep -c -v "linux-image-generic")
echo "Listing of all unused kernels still installed in the system (these may not exist in /boot):"
if [ $count_of_old_kernels_installed = 0 ]; then
  echo " * No unused kernel installs found! *"
else
  dpkg --list | grep linux-image | awk -F' ' '{ print $2 }' | grep -v "$current_kernel" | grep -v "linux-image-generic"
fi
echo ""
}

function exit_script {
free_space_after=$(df -BM /boot | tail -n 1 | awk -F' ' '{ print $4 }' | tr -d M)
let freed_space=$free_space_after-$free_space_before
echo ""
echo "Results (in MB)"
echo "---------------"
echo "Free space in /boot before script was run: "$free_space_before
echo "Free space now: "$free_space_after
echo ""
echo "Amount of space freed up = "$freed_space
echo ""
echo "Press any key to exit."
read -s -n 1
echo ""
exit
}

# Main code
echo ""
echo -e $title_color" --------------------------- "$endCol
echo -e $title_color" -   Kernel Cleanup v1.0   - "$endCol
echo -e $title_color" --------------------------- "$endCol
echo ""
echo "Maximise this window for readability."
echo "Press any key to continue."
read -s -n 1
echo ""
echo "This script will remove old unused kernels, but it will prompt you before removing each one."
echo "It will never remove the current running kernel, and will also leave one fallback kernel."
echo "It can also remove source files from /usr/src for each kernel removed."
echo "This is normally safe to do and will free up lots more space."
echo ""
echo "Do you want that done as well? (y/n, enter=yes)"
valid_input=0
while [ "$valid_input" = "0" ]; do
  read -s -n 1 YesNo_input
  if [ "$YesNo_input" = "" ]; then
    YesNo_input="y"
  fi
  case $YesNo_input
  in
    y)
    RemoveSource="y"
    valid_input=1
    ;;

    Y)
    RemoveSource="y"
    valid_input=1
    ;;

    n)
    RemoveSource="n"
    valid_input=1
    ;;

    N)
    RemoveSource="N"
    valid_input=1
    ;;
  esac
done

free_space_before=$(df -h /boot | tail -n 1 | awk -F' ' '{ print $4 }' | tr -d M)
show_kernel_info
while [ $count_of_old_kernels_in_boot -gt 1 ]; do
  # failsafe check if somehow the current kernel is about to be removed!
  if [ "$current_old_kernel" = "$current_kernel" ]; then
    echo -e $bold_red"ERROR!"$endCol" Somehow the current kernel has crept into the removal process!"
    echo "I refuse to do that! Aborting script."
    exit_script
  fi
  # failsafe check if somehow a linux-image-generic entry is about to be removed
  if [ "$current_old_kernel" = "linux-image-generic" ]; then
    echo -e $bold_red"ERROR!"$endCol" Somehow one of the linux-image-generic entries has crept into the removal process!"
    echo "I refuse to do that! Aborting script."
    exit_script
  fi
  echo "Command about to be executed is:"
  echo "  $ sudo apt-get purge \"$current_old_kernel\""
  check_in_boot=$(echo $current_old_kernel | sed 's/linux-image/initrd.img/g')
  if [ -e /boot/$check_in_boot ]; then
    echo -e $bold_yellow"Note:"$endCol" This kernel exists in /boot but it NON-active, so it's OK to remove."
  else
    echo -e $bold_green"Totally safe to remove:"$endCol" This kernel does NOT exist in /boot."
  fi
  echo ""
  echo "Are you sure you want to remove this kernel?"
  echo "(*upper case* Y=yes / any other key will exit the script)"
  read -s -n 1 yes_no
  echo ""
  # Only entering a single upper case Y will work!
  if [ "$yes_no" != "Y" ]; then
    echo "Aborting script."
    exit_script
  fi
  echo "Removing kernel "$current_old_kernel"..."
  sleep 1
  sudo apt-get -y purge $current_old_kernel
  if [ "$RemoveSource" = "y" ]; then
    current_old_source=$(echo $current_old_kernel | sed 's/linux-image/linux-headers/g')
    current_old_source=$(echo $current_old_source | sed 's/-generic//g')
    current_old_source=$(echo $current_old_source | sed 's/-pae//g')
    sudo apt-get -y purge $current_old_source
  fi
  show_kernel_info
done

if [ $count_of_old_kernels_in_boot = 0 ]; then
  echo -e $bold_red"There are no NON-active kernels to remove!"$endCol
else
  echo -e $bold_red"There is only one NON-active kernel left in /boot!"$endCol
  echo "This script will not remove the last non-active kernel so that you have at least one backup kernel."
fi
echo "Aborting script."
exit_script
 

0


2014-03-08

[Kama swali la AskUbuntu noob siwezi kutoa maoni hadi sifa = 50 kwa hivyo usichukue kura kwa sababu ya hii.]

Seva yangu ilikuwa ikifanya hivi, pia. Kwa kweli hakuna majibu yoyote yanayotarajiwa hapa kufanywa kwani haya yanahitaji chumba cha kufanya kazi / buti ili wao wamalize. Ikiwa kizigeu cha boot kimejaa, ghafla kitaisha bila kufuta yoyote ya picha.

Kitu pekee ambacho kilinifanyia kazi ni kukagua picha ya sasa, kisha kuorodhesha sudo rm filename faili za picha za kongwe (kila mmoja alikuwa na -3.16.0-30 kwa majina yao). Mara tu hiyo ikifanyika, basi sudo apt-get autoremove ilikuwa na chumba cha wiga kinachohitajika kufanya kazi yake. Ilionyesha makosa kadhaa yanayohusiana na toleo hilo, kwa mfano: "depmod: FATAL: hakuweza kupakia /boot/System.map-3.16.0-30-generic: Hakuna faili kama hiyo au saraka" lakini hiyo inapaswa kutarajiwa.

Inapomalizika, df iliyorudishwa 42% inatumika kwa / boot kuashiria kuwa ni afya tena.


0


2017-02-08

Niliandika maandishi haya ya kuchagua kuchagua kernels za zamani wakati wote:


rm kernels kawaida

Nambari zote za bash na maagizo ni pamoja na kwenye kiunga.


0


2017-07-30

Hifadhi maandishi haya kama /usr/local/bin/remove_kernels.sh (kumbuka kutoa ruhusa za kutekeleza sudo chmod 755 /usr/local/bin/remove_kernels.sh ):

 #!/bin/sh
if test $(id -u) != 0; then
 echo Error: You must be root to run this script!
 exit 1
fi
apt purge $( dpkg --list | grep -P -o "linux-image-\d\S+" | grep -v $(uname -r | grep -P -o ".+\d") )
update-grub
 

Kisha kuondoa kerneli zote za zamani tu aina: sudo remove_kernels.sh


0


2018-10-08

/ kizigeu boot inaweza kuwa ya kushangaza wakati mwingine

usianzie moja kwa moja kufuta faili za kernal.

Hatua za kufuata

  1. Angalia kernal iliyosanikishwa sasa inatumiwa na mfumo wa linux

    uname -r

    hii inapaswa kukupa jina la picha ya kernal iliyosanikishwa sasa kwenye mfumo

  2. Sasa anza kufuta faili za ziada isipokuwa tu maalum moja iliyosanikishwa kwenye mfumo wako

    apt-get remove linux-image-XXXXX

  3. Pia ondoa faili ya kichwa pia

    apt-get remove linux-headers-XXXXX

  4. Pia kunaweza kuwa na hali ambayo apt imeacha kufanya kazi, kwa njia hiyo badilisha kwa / Boot

    cd /boot

  5. Anza kuondoa faili kwa mikono lakini kwa uangalifu pia kuweka akilini sio kufuta installed one's faili za kernal kutoka kwenye mfumo wako.

    rm linux-image-XXXXX

    rm linux-image-extra-XXXXXX

  6. Baada ya kuondoa ufungaji sahihi wa sehemu za faili ikiwa kuna yoyote

    apt-get -f install

  7. Ondoa faili za ziada zilizoketi hapo kama faili za boot husafishwa mwenyewe

    apt-get autoremove

  8. Sasisha grub

    update-grub

  9. Sasisha mwishowe vifurushi vya mfumo wako

    apt-get update


0


2019-05-03

Ikiwa huwezi kuondoa faili zaidi ambazo hazikutumika na ikiwa una kizigeu kingine na / au nafasi ya bure kwenye kifaa kimoja, unaweza kubadilisha ukubwa wa kizigeu cha boot / kugawanywa / gpart . (Imejumuishwa kwenye media ya ufungaji, pia.)

Onyo : Resizing ya kuhesabu ni operesheni hatari , kuokoa data yako muhimu kwenye media zingine kabla ya kuifanya!


-1


2015-01-02