diff options
Diffstat (limited to 'posts')
-rw-r--r-- | posts/2021-12-15-rescuing-freebsd-the-unix-way.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/posts/2021-12-15-rescuing-freebsd-the-unix-way.php b/posts/2021-12-15-rescuing-freebsd-the-unix-way.php index 0ffa9c5..57937bd 100644 --- a/posts/2021-12-15-rescuing-freebsd-the-unix-way.php +++ b/posts/2021-12-15-rescuing-freebsd-the-unix-way.php @@ -20,14 +20,19 @@ <p> So now I could start to fearlessly think about un-effing my install. This is where most people (previously including myself) would suck it up, start from scratch with a USB installer, try to remember all of the customization steps they took to bring the system back to its current working state, and restore user data. But I'm not the man I once was. I've been playing this game long enough. I don't go crawling back to the dusty install media when something as trivial as critical system files go missing or corrupt. I know what I did wrong and I can think of several creative ways to fix it. Say it with me: - <img src="https://nextcloud.53hor.net/index.php/s/Gj8GZxLdegkJgG5/preview" /> + <img src="https://nextcloud.53hor.net/index.php/s/Gj8GZxLdegkJgG5/download" alt="it's a unix system" title="Except ackshually because BSD was derived from research UNIX and has a long *nix heritage as well as a history of adhering to the Unix Philosophy and POSIX. Linux is not UNIX, but FreeBSD is as close as you're gonna get." /> </p> -First of all, my entire system (sans <code>/usr/bin</code> is still somewhat operational. I have access to a root shell (and my X session with a browser) so I'm in pretty good shape. I am lacking some very basic core utilities but I might be able to get them back without even rebooting. +<p> + First of all, my entire system (sans <code>/usr/bin</code> is still somewhat operational. I have access to a root shell (and my X session with a browser) so I'm in pretty good shape. I am lacking some very basic core utilities but I might be able to get them back without even rebooting. I don't have any system-wide snapshots to restore from but I do have another running FreeBSD 13.0-RELEASE system on my network: my server. <code>rclone</code> worked to move data over there in an emergency, so I'll use that to copy my coreutils back where they belong. And it worked. + + <img src="https://nextcloud.53hor.net/index.php/s/rzaqYo3N2SSwQ2e/download" alt="back in business" title="Literally whenever I get something to work right" /> +</p> -I don't have any system-wide snapshots to restore from (believe me I do now). I do have another running FreeBSD 13.0-RELEASE system on my network though: my server. <code>rclone</code> worked to move data over there in an emergency, so I'll use that to copy my coreutils back where they belong. And it worked. Restarting i3 was like that scene in Jurassic Park: "we're back in business!". Now came the hard part. Un-effing everything I <em>didn't</em> know was missing or broken. -I can reinstall my entire package tree pretty easily, so I'm not that worried about anything missing from <code>/usr/local</code>. I'm a <code>pkg leaf | xargs pkg install -f</code> away from completely restoring those. Maybe I have one or two config files in <code>/usr/local/etc</code> that I can live without. I know <code>/usr/home</code> is safe and restored. So all that's left is stuff like <code>lib, sbin, include, lib32, share</code> and a few others that aren't very unique to my system (packages notwithstanding). +<p> + Now came the hard part. Un-effing everything I <em>didn't</em> know was missing or broken. Who knows what else got removed during that operation. I can reinstall my entire package tree pretty easily, so I'm not that worried about anything missing from <code>/usr/local</code>. Maybe I have one or two config files in <code>/usr/local/etc</code> that I can live without. I know <code>/usr/home</code> is safe and restored. So all that's left is stuff like <code>lib, sbin, include, lib32, share</code> and a few others that aren't very unique to my system (packages notwithstanding). +</p> Here's where the YOLO part begins. I was already in the middle of building my system from source to track FreeBSD 13.0-STABLE, instead of RELEASE. So instead of using a rescue CD to copy just the right files back or completely reinstalling my system, I'll just <code>make buildworld</code> and upgrade/replace my system in-place to track STABLE. The install/upgrade/switching process is well-documented, and there are already difftools/mergetools responsible for making sure that all of the new artifacts go exactly where they're supposed to (overtop of your old or broken existing ones). @@ -118,4 +123,7 @@ After reviewing the list and ensuring you don't need those files, you can clean </code> </pre> +// TODO: pkg reinstall +//I'm a <code>pkg leaf | xargs pkg install -f</code> away from completely restoring those. + Redemption. I went from attempting to customize my kernel to annihilating <code>/usr</code> to restoring my entire system by building from FreeBSD's source tree via <code>git</code> and <code>make</code>. And I got an upgrade in the process too! Moving forward, I'm running slightly frequent automatic full-system snapshots. It should make it a lot easier to rescue accidental deletions of system files. I'm also going to take the time to learn more about the rescue disk process using the FreeBSD installer image. All told, not too bad for something that could have gone a lot worse. |