How do I get swupd if I accidentally deleted /usr?

Oops. What’s a decent way for me to get swupd if I accidentally deleted /usr?

Turns out it’s from an install/rescue/live system. That’ll have swupd and you use: swupd verify --fix -p /where/you/mounted

If you use an USB live image you will need to:

  1. boot to the live image USB device
  2. log in as root, assuming this is the first time you’ve ever booted to this USB device
    (You’ll probably be required to change your password immediately)
  3. mount the partition that holds the original root directory of the deleted /usr to your system
  4. Run the swupd command shown above, substituting the mounted directory name from step 3

Is there any easier way? Maybe just pull the swupd rpm from a repo, extract it, and then run. Sometimes a usb drive is not handily available and it is a bit of a process to setup. Also, what if you are on a headless system and are using ssh to manage it? I’ve not personally tried this but it seems you could run the same command from a locally downloaded swupd. I assume the latest swupd is the best one to grab. https://cdn.download.clearlinux.org/releases/27760/clear/x86_64/os/Packages/swupd-client-bin-3.18.7-301.x86_64.rpm

@eadams That is definitely a useful tip. In fact, all software packaged by Clear Linux for bundles are available as RPMs and source RPMS (SRPMs) on the downloads website.

The problem is that when you make a catastrophic mistake, like deleting /usr, you end up losing all basic utilities that would be needed to navigate the system and work with the RPM to install it. In a scenario like that, you end up chasing dependencies to just get the RPM extracted.

If your entire /usr is removed, you have no working system. In other words, you can’t actually run any binaries, since you’ve deleted the most basic libraries needed to do anything meaningful on the system.

Hence, you need a second, actually functional Linux OS, to repair the first one.

3 Likes