ubuntu恢復系統_Ubuntu恢復菜單:揭開Linux系統恢復神秘面紗

ubuntu恢復系統

Don’t try to convince yourself otherwise: along with all the good stuff, you’re going to have bad days with Linux.

否則,請不要試圖說服自己:與所有好的東西一起,您將在Linux上度過糟糕的日子。

  • You (or the users you support) are going to mistype commands and permanently destroy documents.

    您(或您支持的用戶)將輸錯命令并永久銷毀文檔。
  • You’re going to experience that sinking feeling when you realize that some really important piece of hardware or software has just gone and failed. That’s gratitude after everything you did for it all those years.

    當您意識到某些非常重要的硬件或軟件已經失效并失敗時,您將體驗到那種下沉的感覺。 這些年來,您所做的一切都是對您的感謝。

Being properly backed up means that you can walk away from a non-functioning OS or computer and rebuild it all somewhere else. But that’s always going to be Plan B. Plan A is to recover.

正確備份意味著您可以離開運行不正常的操作系統或計算機,然后在其他任何地方重建它們。 但這始終是計劃B。計劃A是要恢復。

在Ubuntu上使用恢復模式 (Using recovery mode on Ubuntu)

Linux not letting you log in normally (perhaps the boot process unexpectedly stops before displaying the login screen, for instance)? You’ll want some basic system administration tools.

Linux是否不允許您正常登錄(例如,引導過程在顯示登錄屏幕之前意外停止了?)? 您將需要一些基本的系統管理工具。

But wait: if Linux won’t load, how are you going to launch those tools? Well, even if Linux won’t load all the way to a normal command prompt, often it’ll get you to the GRUB menu. From there you can use the up and down arrow keys and then Enter to select a Linux kernel running in recovery mode which, as you’ll soon see, will open up a whole bag of tricks.

但是請稍等:如果Linux無法加載,您將如何啟動這些工具? 好吧,即使Linux不會一路加載到正常的命令提示符下,它通常也會帶您進入GRUB菜單。 從那里,您可以使用向上和向下箭頭鍵,然后按Enter選擇運行在恢復模式下的Linux內核,您很快就會看到,它將打開一整套竅門。

As you can see from the figure below, once Ubuntu is loaded in recovery mode, you’ll be shown a menu of tools that address some common boot-time problems. It’s worth trying each one that seems like it might address your root problem. “Clean”, for instance, will remove unused files if you suspect the trouble stems from a full disk. “dpkg” will attempt to fix any broken apt-based software packages that might be gumming things up. (The “dpkg” tool might require that you first enable networking.)

從下圖可以看出,以恢復模式加載Ubuntu后,將顯示一個工具菜單,該工具可以解決一些常見的啟動時問題。 值得嘗試似乎可以解決您的根本問題的每一個。 例如,如果您懷疑問題是由于磁盤已滿,“干凈”將刪除未使用的文件。 “ dpkg”將嘗試修復任何破壞了apt的軟件包,這些軟件包可能會使事情陷入困境。 (“ dpkg”工具可能要求您首先啟用網絡。)

The “root” option will open a root command line shell session for you where you’ll have Bash at your disposal. In general, using a simple shell session for recovery rather than a full GUI desktop makes a lot of sense, because the fewer complicated services you’ve got running, the more likely it is that you’ll be able to at least get your system running. Once you do manage to get a working command prompt, you can start poking around to see if you can identify and fix the problem.

“ root”選項將為您打開一個根命令行shell會話,您將在其中使用Bash。 通常,使用簡單的shell會話進行恢復而不是使用完整的GUI桌面很有用,因為您運行的復雜服務越少,至少能夠獲得系統的可能性就越大。運行。 一旦設法得到一個工作命令提示符下,你就可以開始閑逛,看看你是否能夠識別并解決問題。

But at the very least, you’ll look mighty cool doing it.

但是至少,這樣做會看起來非常酷。

But what are those tools? Got an Ubuntu machine running? Go take a look for yourself. The code running the menu must already exist somewhere within an Ubuntu file system. Use “locate” to find it.

但那些什么工具? 有Ubuntu計算機在運行嗎? 你自己去看看 運行菜單的代碼必須已經存在于Ubuntu文件系統中的某個位置。 使用“定位”找到它。

locate recovery-mode
/lib/recovery-mode
/lib/recovery-mode/l10n.sh
/lib/recovery-mode/options
/lib/recovery-mode/recovery-menu
/lib/recovery-mode/options/apt-snapshots
/lib/recovery-mode/options/clean
/lib/recovery-mode/options/dpkg
/lib/recovery-mode/options/failsafeX
/lib/recovery-mode/options/fsck
/lib/recovery-mode/options/grub
/lib/recovery-mode/options/network
/lib/recovery-mode/options/root
/lib/recovery-mode/options/system-summary

Note that the “l10n.sh” script sets appropriate environment variables for the menu. If you navigate over to the /lib/recovery-mode/ directory you’ll see that the “recovery-menu” file is the script that displays the menu interface that you saw above. The /lib/recovery-mode/options/ directory contains files for executing each of the menu items…like “fsck” that will check and, if possible, fix any broken file systems.

請注意,“ l10n.sh”腳本為菜單設置了適當的環境變量。 如果導航到/ lib / recovery-mode /目錄,您將看到“ recovery-menu”文件是顯示您在上面看到的菜單界面的腳本。 / lib / recovery-mode / options /目錄包含用于執行每個菜單項的文件,例如“ fsck”,它將檢查并(如果可能)修復損壞的文件系統。

Since, based on previous chapters in the book, you’re now an accomplished Bash scripting expert, why not take a look at each of the scripts in the options/ directory to see if you can figure out how they work. Here are the contents of the “fsck” script to get you going. Note the way the script is nicely documented (using the “#” character) to help you understand what’s going on.

由于根據您本書的前幾章,您現在是一名精通Bash腳本的專家,所以為什么不看看options /目錄中的每個腳本來看看您是否可以了解它們的工作原理。 以下是“ fsck”腳本的內容,可助您一臂之力。 請注意,腳本的記錄方式(使用“#”字符)可以很好地幫助您了解正在發生的事情。

cat /lib/recovery-mode/options/fsck
#!/bin/sh
. /lib/recovery-mode/l10n.sh  <1>
if [ "$1" = "test" ]; thenecho $(eval_gettext "Check all file systems")exit 0
fi
# Actual code is in recovery-menu itself  <2>
exit 0

Here are a couple of things you can try on your own:

您可以嘗試以下幾項:

  • Manually run the “clean” script on a Debian/Ubuntu machine. What happened?

    在Debian / Ubuntu機器上手動運行“ clean”腳本。 發生了什么?
  • Then try carefully editing the /lib/recovery-mode/recovery-menu script (make a backup copy first). Perhaps just change something simple, like the menu title or one of the script descriptions. Then reboot your machine and, from the GRUB menu, go into Recovery Mode to see what it looks like.

    然后嘗試仔細編輯/ lib / recovery-mode / recovery-menu腳本(首先制作備份副本)。 也許只需更改一些簡單的內容,例如菜單標題或腳本描述之一。 然后重新啟動計算機,然后從GRUB菜單進入“恢復模式”以查看其外觀。

With some variations and exceptions, you should be able to put those examples to good use elsewhere.

有了一些變體和例外,您應該能夠在其他地方充分利用這些示例。

This article is adapted from chapter 6 (Emergency tools: build a system recovery device) of my Manning “Linux in Action” book. There’s lots more fun where this came from, including a hybrid course called Linux in Motion that’s made up of more than two hours of video and around 40% of the text of Linux in Action. Who knows…you might also enjoy my Learn Amazon Web Services in a Month of Lunches.

本文改編自 Manning的《 Linux in Action》一書的 第6章(緊急工具:構建系統恢復設備) 這有很多有趣的地方,包括一個名為Linux in Motion的混合課程,該課程由兩個多小時的視頻和大約40%的 Linux in Action 文本組成 誰知道……您可能還會 在一個月的午餐中 享受我的 Learn Amazon Web Services

翻譯自: https://www.freecodecamp.org/news/the-ubuntu-recovery-menu-demystifying-linux-system-recovery/

ubuntu恢復系統

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/391408.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/391408.shtml
英文地址,請注明出處:http://en.pswp.cn/news/391408.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

linux與磁盤相關的內容

本節所講內容1.認識SAS-SATA-SSD-SCSI-IDE硬盤2.使用fdisk對磁盤進行操作&#xff0c;分區&#xff0c;格式化3.開機自動掛載分區4.使用parted操作大于等于4T硬盤5.擴展服務器swap內存空間 MBR(Master Boot Record)主引導記錄&#xff0c;也就是現有的硬盤分區模式。MBR分區的標…

leetcode 87. 擾亂字符串(dp)

使用下面描述的算法可以擾亂字符串 s 得到字符串 t &#xff1a; 如果字符串的長度為 1 &#xff0c;算法停止 如果字符串的長度 > 1 &#xff0c;執行下述步驟&#xff1a; 在一個隨機下標處將字符串分割成兩個非空的子字符串。即&#xff0c;如果已知字符串 s &#xff0c…

頁面布局

頁面布局兩大類&#xff1a;   主站&#xff1a; 1 <div classpg-header> 2 <div stylewidth:980px;margin:0 auto;> 3 內容自動居中 4 </div> 5 <div classpg-content></div> 6 <div classpg-footer></div&…

sonar:默認的掃描規則

https://blog.csdn.net/liumiaocn/article/details/83550309 https://note.youdao.com/ynoteshare1/index.html?id3c1e6a08a21ada4dfe0123281637e299&typenote https://blog.csdn.net/liumiaocn/article/details/83550309 文本版&#xff1a; soanr規則java版 …

多變量線性相關分析_如何測量多個變量之間的“非線性相關性”?

多變量線性相關分析現實世界中的數據科學 (Data Science in the Real World) This article aims to present two ways of calculating non linear correlation between any number of discrete variables. The objective for a data analysis project is twofold : on the one …

wp博客寫文章500錯誤_500多個博客文章教我如何撰寫出色的文章

wp博客寫文章500錯誤Ive written a lot of blog posts. Somewhere north of 500 to be exact. All of them are technical. 我寫了很多博客文章。 確切地說是在500以北的某個地方。 所有這些都是技術性的。 About two dozen of them are actually good. 實際上大約有兩打是不錯…

leetcode 220. 存在重復元素 III(排序)

給你一個整數數組 nums 和兩個整數 k 和 t 。請你判斷是否存在 兩個不同下標 i 和 j&#xff0c;使得 abs(nums[i] - nums[j]) < t &#xff0c;同時又滿足 abs(i - j) < k 。 如果存在則返回 true&#xff0c;不存在返回 false。 示例 1&#xff1a; 輸入&#xff1a…

ON DUPLICATE KEY UPDATE

INSERT INTO ON DUPLICATE KEY UPDATE 與 REPLACE INTO&#xff0c;兩個命令可以處理重復鍵值問題&#xff0c;在實際上它之間有什么區別呢&#xff1f;前提條件是這個表必須有一個唯一索引或主鍵。1、REPLACE發現重復的先刪除再插入&#xff0c;如果記錄有多個字段&#xff0c…

os.path 模塊

os.path.abspath(path) #返回絕對路徑os.path.basename(path) #返回文件名os.path.commonprefix(list) #返回list(多個路徑)中&#xff0c;所有path共有的最長的路徑。os.path.dirname(path) #返回文件路徑os.path.exists(path) #路徑存在則返回True,路徑損壞返回Falseos.path…

探索性數據分析(EDA):Python

什么是探索性數據分析(EDA)&#xff1f; (What is Exploratory Data Analysis(EDA)?) If we want to explain EDA in simple terms, it means trying to understand the given data much better, so that we can make some sense out of it.如果我們想用簡單的術語來解釋EDA&a…

微服務框架---搭建 go-micro環境

1.安裝micro 需要使用GO1.11以上版本 #linux 下 export GO111MODULEon export GOPROXYhttps://goproxy.io # windows下設置如下環境變量 setx GO111MODULE on setx GOPROXY https://goproxy.io # 使用如下指令安裝 go get -u -v github.com/micro/micro go get -u -v github.co…

angular dom_Angular 8 DOM查詢:ViewChild和ViewChildren示例

angular domThe ViewChild and ViewChildren decorators in Angular provide a way to access and manipulate DOM elements, directives and components. In this tutorial, well see an Angular 8 example of how to use the two decorators.Angular中的ViewChild和ViewChild…

浪潮之巔——IT產業的三大定律

http://www.cnblogs.com/ysocean/p/7641540.html轉載于:https://www.cnblogs.com/czlovezmt/p/8325772.html

DStream算子講解(一)

先把目錄列好&#xff0c;方便有條理的進行整理轉載于:https://www.cnblogs.com/leodaxin/p/7507600.html

aws 靜態網站_如何使用AWS托管靜態網站-入門指南

aws 靜態網站When I created my first portfolio last year, I based it on what I had learned from freeCodeCamp (HTML, CSS and a little JavaScript). 去年創建我的第一個投資組合時 &#xff0c;我基于從freeCodeCamp (HTML&#xff0c;CSS和一些JavaScript)中學到的知識…

leetcode 27. 移除元素(雙指針)

給你一個數組 nums 和一個值 val&#xff0c;你需要 原地 移除所有數值等于 val 的元素&#xff0c;并返回移除后數組的新長度。 不要使用額外的數組空間&#xff0c;你必須僅使用 O(1) 額外空間并 原地 修改輸入數組。 元素的順序可以改變。你不需要考慮數組中超出新長度后面…

使用TVP批量插入數據

TVP&#xff08;全稱 :Table-Valued Parameter&#xff09; 叫做表值參數(Table-Valued Parameter)是SQL2008的一個新特性。顧名思義&#xff0c;表值參數表示你可以把一個表類型作為參數傳遞到函數或存儲過程里。 第一步&#xff1a;創建一個Type類型和寫入數據的原始表結構相…

python:找出兩個列表中相同和不同的元素(使用推導式)

#接口返回值 list1 [張三, 李四, 王五, 老二] #數據庫返回值 list2 [張三, 李四, 老二, 王七]a [x for x in list1 if x in list2] #兩個列表表都存在 b [y for y in (list1 list2) if y not in a] #兩個列表中的不同元素print(a的值為:,a) print(b的值為:,b)c [x for x …

springcloud(六):配置中心git示例

隨著線上項目變的日益龐大&#xff0c;每個項目都散落著各種配置文件&#xff0c;如果采用分布式的開發模式&#xff0c;需要的配置文件隨著服務增加而不斷增多。某一個基礎服務信息變更&#xff0c;都會引起一系列的更新和重啟&#xff0c;運維苦不堪言也容易出錯。配置中心便…

寫作工具_4種加快數據科學寫作速度的工具

寫作工具I’ve been writing about data science on Medium for just over two years. Writing, in particular, technical writing can be time-consuming. Not only do you need to come up with an idea, write well, edit your articles for accuracy and flow, and proofr…