Little warning: Deleting the wrong files may brick your Linux PC

Don't run rm -rf / as a laugh to clean your filesystem on a ham-fisted UEFI machine


Here's a friendly warning from El Reg: don't wipe the wrong directory from your Linux system, or you may end up bricking the computer. This has happened to people, we're told.

The directory in question is /sys/firmware/efi/efivars which is a special filesystem that presents the configuration settings for the computer's underlying UEFI firmware to the user. These configuration variables are used to control the way the motherboard firmware starts up the system and boots your operating system. Changing the files in this directory therefore changes these respective variables in the firmware.

If that efivars file system is mounted with read-write access, and its contents are deleted by a privileged user, then you'll blow away all of those settings. If your firmware code is badly written, it could be confused by the lack of settings during the next boot, and completely fail to start up.

This has apparently happened: someone said they managed to nuke their MSI notebook by wiping the efivars directory. The computer fails to get past even the power-on self-test, rendering it truly bricked, we're told. The user wanted to install a new OS, and so ran rm -rf / for laughs as root – a command that wipes all files from the file system, including ones in the efivars directory – and next found the machine unbootable.

Of course, running rm -rf / is dumb, but what's really dumb is bricking a machine by deleting the wrong file.

The problem surfaced in a systemd bug report that was quickly closed, but reanimated over the weekend by frustrated users. This problem isn't specific to systemd, though, it's just that systemd mounts efivars as read-write by default – any non-systemd Linux distro could choose to do the same.

The variables are presented as read-write so that, for example, the utility efibootmgr can do its stuff. Mounting the file system as read-only will break a bunch of tools.

Matthew Garrett, an expert on low-level code in Linux, said this issue isn't even specific to the open-source kernel – software running as administrator on Windows could trigger the same failure in the firmware, although we note that the danger is live on Linux systems that provide efivars as read-write by default.

On Monday, Garrett suggested a temporary kernel patch to block destructive write operations on efivars files. This is a workaround: the problem lies in clumsy firmware that falls over if it finds all of its runtime variables are missing.

"Systemd is not responsible for allowing kernel code that I wrote to destroy your shitty firmware," Garrett tweeted. "I think you get to blame me instead."

For now, go easy on the sudo rm, OK? ®

Similar topics


Other stories you might like

  • Snowflake stock drops as some top customers cut usage
    You might say its valuation is melting away

    IPO darling Snowflake's share price took a beating in an already bearish market for tech stocks after filing weaker than expected financial guidance amid a slowdown in orders from some of its largest customers.

    For its first quarter of fiscal 2023, ended April 30, Snowflake's revenue grew 85 percent year-on-year to $422.4 million. The company made an operating loss of $188.8 million, albeit down from $205.6 million a year ago.

    Although surpassing revenue expectations, the cloud-based data warehousing business saw its valuation tumble 16 percent in extended trading on Wednesday. Its stock price dived from $133 apiece to $117 in after-hours trading, and today is cruising back at $127. That stumble arrived amid a general tech stock sell-off some observers said was overdue.

    Continue reading
  • Amazon investors nuke proposed ethics overhaul and say yes to $212m CEO pay
    Workplace safety, labor organizing, sustainability and, um, wage 'fairness' all struck down in vote

    Amazon CEO Andy Jassy's first shareholder meeting was a rousing success for Amazon leadership and Jassy's bank account. But for activist investors intent on making Amazon more open and transparent, it was nothing short of a disaster.

    While actual voting results haven't been released yet, Amazon general counsel David Zapolsky told Reuters that stock owners voted down fifteen shareholder resolutions addressing topics including workplace safety, labor organizing, sustainability, and pay fairness. Amazon's board recommended voting no on all of the proposals.

    Jassy and the board scored additional victories in the form of shareholder approval for board appointments, executive compensation and a 20-for-1 stock split. Jassy's executive compensation package, which is tied to Amazon stock price and mostly delivered as stock awards over a multi-year period, was $212 million in 2021. 

    Continue reading
  • Confirmed: Broadcom, VMware agree to $61b merger
    Unless anyone out there can make a better offer. Oh, Elon?

    Broadcom has confirmed it intends to acquire VMware in a deal that looks set to be worth $61 billion, if it goes ahead: the agreement provides for a “go-shop” provision under which the virtualization giant may solicit alternative offers.

    Rumors of the proposed merger emerged earlier this week, amid much speculation, but neither of the companies was prepared to comment on the deal before today, when it was disclosed that the boards of directors of both organizations have unanimously approved the agreement.

    Michael Dell and Silver Lake investors, which own just over half of the outstanding shares in VMware between both, have apparently signed support agreements to vote in favor of the transaction, so long as the VMware board continues to recommend the proposed transaction with chip designer Broadcom.

    Continue reading

Biting the hand that feeds IT © 1998–2022