Hey there, I run a network of DNS servers, out there in cold unforgiving data centers in places in the world where remote hands are hard to come by and the only connectivity you get sometimes is a serial console. Often you'll get clueful techs who will reboot a machine for you but not much more. Numerous times, I've been bitten by freebsd-update segfaulting and leaving me with an unusable system that won't survive a reboot (either because of a failure to replace ld.so or because of a full /var or / or other partition). At that point you're logged in to a system over ssh, you cannot ssh in a second time, and you need to recover the system quickly. The only real fix is to copy binaries (or a base.txz) from another machine using the statically linked binaries in /rescue. And other than nc (which works, but has no progress indicator and no real checks), there's no easy way to get files onto and off a system. I get it, scp and ssh have heavy crypto overhead, as does fetch at this point, but a fetch-lite that only spoke HTTP and FTP would be super useful, as would a copy of old school ftp. Or, you know, maybe just a statically linked scp/ssh *is* the right answer here. (Busybox is a cool idea but it has the GPL issue). There's no patch for this, it's more an enhancement request.
I think a limited version of fetch in /rescue is a good idea! I'll take a go at building one. For stream progress during transfers in rescue mode, I use `dd status=progress`. It's not something I've had to do very often since the systems I manage I can lay hands on but it works in a pinch. sending: # cat base.txz | nc broken-host.example.net 9999 receiving: # /rescue/nc -l 9999 | /rescue/dd status=progress > /base.txz Then I use /rescue/md5 to verify the tarball. :)
Review for adding fetch to /rescue: https://reviews.freebsd.org/D38193
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=ea34aa4780e5a581732520ea579342af94684882 commit ea34aa4780e5a581732520ea579342af94684882 Author: John Grafton <john.grafton@runbox.com> AuthorDate: 2023-01-29 23:05:15 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2023-01-29 23:05:15 +0000 rescue: Add fetch(1) to the rescue tool. After a failed upgrade, having fetch(1) on a system that is physically unnreachable would be very useful to download files required to get the OS back up and functional. On my system this adds 589,824 bytes (3.8%) to the binary size. PR: 266224 Reported by: Dan Mahoney MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D38193 rescue/rescue/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=03abf6cd13bdd97c865f5731688cf72931078729 commit 03abf6cd13bdd97c865f5731688cf72931078729 Author: John Grafton <john.grafton@runbox.com> AuthorDate: 2023-01-29 23:05:15 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2023-02-12 07:55:02 +0000 rescue: Add fetch(1) to the rescue tool. After a failed upgrade, having fetch(1) on a system that is physically unnreachable would be very useful to download files required to get the OS back up and functional. On my system this adds 589,824 bytes (3.8%) to the binary size. PR: 266224 Reported by: Dan Mahoney Differential Revision: https://reviews.freebsd.org/D38193 (cherry picked from commit ea34aa4780e5a581732520ea579342af94684882) rescue: Fix link order of SSL libraries and fetch. ld.bfd requires libraries to be linked in order. libssl requires libcrypto. libfetch requires libssl. To fix the latter, move fetch up above tar rather than listing the ssl libraries twice. Reviewed by: delphij Fixes: ea34aa4780e5 rescue: Add fetch(1) to the rescue tool. Differential Revision: https://reviews.freebsd.org/D38304 (cherry picked from commit 0f031350f32b8760e0843a6476d67aa21116103b) rescue/rescue/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=ffb598d0953a328b30744ac56e8f1fd0344fd733 commit ffb598d0953a328b30744ac56e8f1fd0344fd733 Author: John Grafton <john.grafton@runbox.com> AuthorDate: 2023-01-29 23:05:15 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2023-02-12 07:58:55 +0000 rescue: Add fetch(1) to the rescue tool. After a failed upgrade, having fetch(1) on a system that is physically unnreachable would be very useful to download files required to get the OS back up and functional. On my system this adds 589,824 bytes (3.8%) to the binary size. PR: 266224 Reported by: Dan Mahoney Differential Revision: https://reviews.freebsd.org/D38193 (cherry picked from commit ea34aa4780e5a581732520ea579342af94684882) rescue: Fix link order of SSL libraries and fetch. ld.bfd requires libraries to be linked in order. libssl requires libcrypto. libfetch requires libssl. To fix the latter, move fetch up above tar rather than listing the ssl libraries twice. Reviewed by: delphij Fixes: ea34aa4780e5 rescue: Add fetch(1) to the rescue tool. Differential Revision: https://reviews.freebsd.org/D38304 (cherry picked from commit 0f031350f32b8760e0843a6476d67aa21116103b) rescue/rescue/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)