当前位置: 首页>>技术教程>>正文


Ubuntu 命令使我的系统变砖?

,

问题描述

几天前,我在计算机上新安装了 Ubuntu,以运行一个专用程序。我完成了它,我正准备格式化驱动器以重新安装 Windows。然而,我的弟弟想在终端上运行这个命令,这会破坏操作系统,我认为这不会有什么坏处,因为无论如何我都会格式化驱动器。

原来是这样的:

sudo rm -rf --no-preserve-root /

如果这个命令是要终结世界之类的,请原谅我的笨蛋。所以它搞砸了操作系统,我用 Windows 安装 USB 重新启动了电脑,计划在 Windows 安装程序中格式化驱动器。

然而,重新启动后,监视器根本没有接收到任何输入。此外,HDD 指示灯(或任何红灯)没有做任何事情。 (事实上​​,它已经关闭了。)不过风扇仍在运转,DVD 驱动器也在运转。 (我认为那里没有电脑扬声器,所以如果您需要一些蜂鸣错误代码,抱歉。)

我尝试将 VGA 线从显卡切换到主板,但仍然没有输入。我尝试将这张旧的 Windows XP 磁盘插入磁盘驱动器,但没有任何显示。按了删除、F12 等按钮,但什么也没发生。然后我在网上查看并尝试了重新安装 RAM 的建议,但没有任何改变。我正在考虑手动重置 CMOS,但尚未实现。 (请告诉我您是否建议这样做,因为如果不需要,我不想搞砸电脑。)

我有 UEFI,所以我可以使用备份芯片以防 BIOS 损坏。

最佳方法

这在运行 systemd 的 UEFI 系统上是可能的。

总而言之,引用该错误报告中的 a comment

\\n

Point 1:
\\n Deleting /sys/firmware/efi/efivars/ should thrash your EFI\\n configuration, but in a properly implemented EFI this should be\\n recoverable.

\\n

Point 2:
\\n There is some pieces hardware out there with broken/poorly implemented\\n EFI, which will can be permanently bricked by doing standard conform\\n stuff to them. See for example the case where Ubuntu bricked some\\n Samsung laptops by storing additional data in some EFI memory. This\\n behaviour was fine by standard but broke this particular\\n implementation.

\\n

Point 3:
\\n Running anything as root that writes to /dev/sda will destroy your\\n partition table and/or filesystems. That’s bad especially if you have\\n no backup, but after partitioning, creating new filesystems and\\n reinstalling your OS your machine will work again. So you can recover\\n from it by booting some other media and redo your installation.

\\n

Point 4:
\\n Thrashing your EFI is a whole different kind of problem. In the worst\\n case you won’t be able to do anything with the machine as it will not\\n get to POST. No booting from an other media, no entering some EFI\\n utility to fix missing stuff. A that point your computer is a really\\n expensive paperweight.

\\n

该问题发生在运行 systemd 并挂载 efivarfs 可写(位于 /sys/firmware/efi/efivars )的发行版中。 Systemd 需要在那里写入,因此使用 systemd 的发行版会受到影响。然而,似乎没有迹象表明 Upstart 系统受到了影响。

次佳方法

运行命令 rm -rf / 可以破坏任何 UEFI 设备(包括我正在输入的设备)。执行此操作会删除所有文件,其中包括已安装的驱动器和 EFI 固件变量(这就是砖块)。 Linux 将 EFI 变量挂载在 /sys/firmware/efi/efivars/ 中,而 rm -rf / 将删除该文件夹中的所有文件(EFI 变量)。您的计算机很可能是一块砖并且无法修复(EFI 使用 NVRAM )。

旧的 BIOS 计算机不会因 rm -rf / 而变砖,因为它们没有可以删除的 EFI 固件变量。此外,还可以通过几行代码在 Windows 上执行相同的操作(删除所有 EFI 变量)。

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/13923.html,未经允许,请勿转载。