Ubuntu 18.04 进入 Recovery 模式
Ubuntu 18.04 進入 Recovery 模式
- Ubuntu 18.04 進入 Recovery 模式, 只需要在開機時一直按住 Shift 鍵,就會進入 GNU GRUB 界面
- 查看磁盤占用情況
- uname -a (查看當前使用的內核版本)
- 查看已安裝的內核版本
- 刪除多余的內核文件
- 使用du -h再次查看/boot空間
- sudo apt-get update下載最新的軟件列表。
- sudo apt-get upgrade 更新系統的更新
- sudo apt-get autoremove 自動刪除多余的安裝包文件
- ubuntu卸載軟件命令,apt-get remove
Ubuntu 18.04 進入 Recovery 模式, 只需要在開機時一直按住 Shift 鍵,就會進入 GNU GRUB 界面
如果是雙系統則選擇ubuntu高級選項
然后選擇 Advanced options for Ubuntu,回車:
 再選擇一個 (recovery mode) 即可:
最后根據自己的需求來進行選擇:
 resume: 退出 recovery 模式,然后正常啟動;
 clean: 嘗試清理垃圾文件,騰出更多的空間;
 dpkg: 修復損壞的包;
 fsck: 檢查所有文件系統;
 grub: 更新 grub 的啟動載入器;
 network: 啟動網絡;
 root: 進入命令行模式; (如果沒有網絡,則要先選擇 network)
 system-summary: 系統概覽,查看電腦的基本信息;
查看磁盤占用情況
df -h Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p5 181M 141M 27M 85% /boot /dev/nvme0n1p8 71G 26G 41G 39% /home /dev/nvme0n1p1 96M 48M 49M 50% /boot/efi tmpfs 1.6G 16K 1.6G 1% /run/user/121 tmpfs 1.6G 44K 1.6G 1% /run/user/1000發現/boot確實占用率很高。
uname -a (查看當前使用的內核版本)
lenmom@M1701:~$ uname -a Linux M1701 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64查看已安裝的內核版本
lenmom@M1701:~$ dpkg --get-selections |grep linux binutils-x86-64-linux-gnu install console-setup-linux install libselinux1:amd64 install linux-base install linux-firmware install linux-generic install linux-headers-4.15.0-39 install linux-headers-4.15.0-39-generic install linux-headers-4.15.0-43 install linux-headers-4.15.0-43-generic install linux-headers-generic install linux-image-4.15.0-29-generic deinstall linux-image-4.15.0-39-generic install linux-image-4.15.0-43-generic install linux-image-generic install linux-libc-dev:amd64 install linux-modules-4.15.0-29-generic deinstall linux-modules-4.15.0-39-generic install linux-modules-4.15.0-43-generic install linux-modules-extra-4.15.0-29-generic deinstall linux-modules-extra-4.15.0-39-generic install linux-modules-extra-4.15.0-43-generic install linux-signed-generic install linux-sound-base install pptp-linux install syslinux install syslinux-common install syslinux-legacy install util-linux install能看到已經安裝的版本,其中帶image的一般就是舊版本,其中
a)deinstall 代表是已經刪除的舊版本
 b) install 是還沒有刪除的舊版本內核??
刪除多余的內核文件
通過uname -a可以查看到當前正在使用的內核版本,把不是當前版本的處于install狀態的image-xxx-generic文件卸載掉,對于本例中linux-modules-extra-4.15.0-39-generic是多余的內核文件,正在使用的是linux-modules-extra-4.15.0-43-generic,開始卸載。
卸載命令為sudo apt-get remove linux-modules-xxx-generic,其中xxx為要卸載的內核版本號
lenmom@M1701:~$ sudo apt-get remove linux-modules-4.15.0-39-generic Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED:linux-image-4.15.0-39-generic linux-modules-4.15.0-39-generic 0 upgraded, 0 newly installed, 2 to remove and 105 not upgraded. 1 not fully installed or removed. After this operation, 74.6 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 187447 files and directories currently installed.) Removing linux-image-4.15.0-39-generic (4.15.0-39.42) ... I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.15.0-43-generic I: /initrd.img.old is now a symlink to boot/initrd.img-4.15.0-43-generic /etc/kernel/postrm.d/initramfs-tools: update-initramfs: Deleting /boot/initrd.img-4.15.0-39-generic /etc/kernel/postrm.d/zz-update-grub: Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.15.0-43-generic Found initrd image: /boot/initrd.img-4.15.0-43-generic Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi Adding boot menu entry for EFI firmware configuration done Removing linux-modules-4.15.0-39-generic (4.15.0-39.42) ... Setting up initramfs-tools (0.130ubuntu3.5) ... update-initramfs: deferring update (trigger activated) Processing triggers for initramfs-tools (0.130ubuntu3.5) ... update-initramfs: Generating /boot/initrd.img-4.15.0-43-generic W: APT had planned for dpkg to do more than it reported back (6 vs 10).Affected packages: initramfs-tools:amd64u can execute the following command to ensure all useless files are deleted:sudo dpkg -P linux-modules-4.15.0-46-generic -- the kernel name depend to your concret condition使用du -h再次查看/boot空間
lenmom@M1701:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p5 181M 75M 94M 45% /boot /dev/nvme0n1p8 71G 26G 41G 39% /home /dev/nvme0n1p1 96M 48M 49M 50% /boot/efi tmpfs 1.6G 16K 1.6G 1% /run/user/121 tmpfs 1.6G 44K 1.6G 1% /run/user/1000sudo apt-get update下載最新的軟件列表。
從軟件源(也就是服務器)下載最新的軟件包列表文件,更新本地軟件包緩存信息(包含軟件名,版本,校驗值,依賴關系等)。
sudo apt-get upgrade 更新系統的更新
sudo apt-get autoremove 自動刪除多余的安裝包文件
ubuntu卸載軟件命令,apt-get remove
第一步,apt-get remove xxx ;就是卸載xxx
   或者 apt-get remove --purge xxx ;卸載xxx并清除配置。
   這兩條命令對于依賴則是不管的。因為別的軟件可能和此軟件有相同的依賴,當然對依賴不能管了。
 第二步,apt-get autoremove ;就是來對付那些不再被“依賴”的包, 自動檢測并刪除他們(任何時候都可以執行此條命令)。
   autoremove: is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed.
   [注釋]: 這條命令不帶任何參數。另外還有一條命令apt-get autoremove xxx ; 即加上軟件名稱。經測試這條命令和apt-get remove xxx相比,會多
  出很多卸載內容,apt-get autoremove xxx 可能是 第一步和第二步 命令的綜合寫法,但不確定。慎用,可能會導致其他軟件不可用!
總結
以上是生活随笔為你收集整理的Ubuntu 18.04 进入 Recovery 模式的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 二进制数的算术运算
- 下一篇: SwiftUI 音乐类App之Tune
