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恢复系统

ubuntu恢复系统_Ubuntu恢复菜单:揭开Linux系统恢复神秘面纱相关推荐

  1. linux系统正常停机的命令,Linux系统重启命令大全

    在进行Linux系统操作的时候,如果出现更换硬件.更改系统配置及死机等情况时,就需要对电脑进行重启,而不同的情形重启的方式也不同,即使用的命令不同,接下来是小编为大家收集的Linux系统重启命令大全, ...

  2. linux操作系统说课稿,信息技术《揭开LINUX的神秘面纱》教案范文

    信息技术<揭开LINUX的神秘面纱>教案范文 教学目标: 1.会启动LINUX系统: 2.会关闭LINUX系统: 3.LINUX基本界面的认识. 教学重点: 1.会启动LINUX系统: 2 ...

  3. 删除双系统linux分区,双系统时如何正确删除Linux系统

    双系统时如何正确删除Linux系统 (2012-07-23 21:37:24) 标签: 杂谈 一直用的是win7和Ubuntu的双系统,上次在win7系统下重新区分了硬盘大小,结果开机时两个系统都不能 ...

  4. linux 内核 课程,Linux内核分析课程-全面剖析Linux内核技术 揭开Linux内核的面纱 Linux内核学习视频教 ......

    课程名称 Linux内核分析课程-全面剖析Linux内核技术 揭开Linux内核的面纱 Linux内核学习视频 课程目录 (1)\1, 计算机是如何工作的?:目录中文件数:0个 (2)\2, 操作系统 ...

  5. 远程linux桌面的工具xshell,Xshell如何远程桌面连接Linux系统 Xshell远程桌面连接Linux系统操作流程...

    Xshell如何远程桌面连接Linux系统?Linux系统和Windows系统不一样,要远程Linux系统需借助工具.下文中为大家带来了Xshell远程桌面连接Linux系统操作流程,感兴趣的朋友快来 ...

  6. ZynqLinux最小系统系列—— 9、一般Linux系统搭建(非Petalinux)

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 ZynqLinux最小系统系列-- 9.一般Linux系统搭建(非Petalinux) 前言 准备工作 操作流程 前言 前面petal ...

  7. XP系统老电脑如何安装Linux系统

    XP系统老电脑如何安装Linux系统 前言: 低配电脑!低配CUP!低配显示器!这就是我的旧电脑 现在原始XP系统都不行了,开机慢,打开应用慢,所以我想换成linux系统看一下还可以拯救不. 尝试了很 ...

  8. Windows-Linux:Windows系统下的命令类似Linux系统下的所有命令集合

    Windows-Linux:Windows系统下的命令类似Linux系统下的所有命令集合 目录 Windows下的命令类似Linux系统下的所有命令集合 1.基础命令 2.进阶命令 3.高级命令 Wi ...

  9. Linux系统入门之如何安装Linux系统

    题目:Linux系统入门之如何安装Linux系统 一.准备工具: 1.Linux 镜像文件(Linux iso文件),直接的在 百度里面输入下载Linux系统版本即可 例如: 2.虚拟机模拟工具,例如 ...

  10. Zabbix 系统监控(二)Linux 系统监控

    windows 系统硬件信息获取. linux 系统监控. linux 系统硬件信息获取 5 windows 系统硬件信息获取 本文通过在 OS 操作系统层面上,主要获取 windows 服务器下 C ...

最新文章

  1. linux wireshark使用教程,技术|Ubuntu 上 Wireshark 的安装与使用
  2. Dell R720上的系统安装问题的解决办法(关于RAID建立磁盘阵列的技术)
  3. org 07c00h的原因
  4. SVG动画.animateTransform
  5. Java:高级之泛型概念引入,泛型可以设置多个类型参数,泛型继承和泛型接口实现,限制泛型可用类型,泛型通配的方式,泛型方法,泛型方法限制泛型可用类型
  6. java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()'
  7. 成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
  8. 【设计模式】基本概念
  9. _cdecl和_stdcal的区别
  10. python 通过下载包setup.py安装模块
  11. 这份 Pandas 学习教程很不错,可在线运行
  12. MySQL 性能优化--QueryCache的原理
  13. python编程老师岗位需求表_教师岗位需求信息表
  14. 如何快速生成100万不重复的8位随机编号?
  15. 解决idea使用jdbc连接数据库失败的方法(针对驱动导入失败)
  16. zooInspector下载
  17. FLV、AAC、AVC封装格式分析
  18. Gradle入门教程学习笔记
  19. 路由器Telnet及ACL配置
  20. 一键怎样批量修改图片像素大小

热门文章

  1. Linux网络编程目录
  2. 太厉害了!2021年互联网大厂Java笔经
  3. 程序员经验分享:Android高级工程师系列学习路线介绍,面试必备
  4. XGBoost入门及实战
  5. 安装好MongoDB,但服务中没有MongoDB服务的解决办法
  6. 总结verilog产生随机数的$random和seed
  7. java线程并发库之--线程同步工具CountDownLatch用法
  8. 山东理工大学第七届ACM校赛-G 飞花的传送门
  9. 多维DP UVA 11552 Fewest Flop
  10. EF实体框架数据操作基类(转)