xref: /freebsd/share/man/man8/rescue.8 (revision e5b786625f7f82a1fa91e41823332459ea5550f9)
1.\" Copyright (c) 2003 Tim Kientzle <kientzle@acm.org>
2.\" Copyright (c) 2003 Simon L. Nielsen <simon@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd June 30, 2022
27.Dt RESCUE 8
28.Os
29.Sh NAME
30.Nm rescue
31.Nd rescue utilities in
32.Pa /rescue
33.Sh DESCRIPTION
34The
35.Pa /rescue
36directory contains a collection of common utilities intended for use
37in recovering a badly damaged system.
38With the transition to a dynamically-linked root beginning with
39.Fx 5.2 ,
40there is a real possibility that the standard tools in
41.Pa /bin
42and
43.Pa /sbin
44may become non-functional due to a failed upgrade or a disk error.
45The tools in
46.Pa /rescue
47are statically linked and should therefore be more resistant to
48damage.
49However, being statically linked, the tools in
50.Pa /rescue
51are also less functional than the standard utilities.
52In particular, they do not have full use of the locale,
53.Xr pam 3 ,
54and nsswitch libraries.
55.Pp
56If your system fails to boot, and it shows a prompt similar to:
57.Pp
58.Dl "Enter full pathname of shell or RETURN for /bin/sh: "
59.Pp
60the first thing to try running is the standard shell,
61.Pa /bin/sh .
62If that fails, try running
63.Pa /rescue/sh ,
64which is the
65.Nm
66shell.
67To repair the system, the root partition must first be remounted
68read-write.
69This can be done with the following
70.Xr mount 8
71command:
72.Pp
73.Dl "/rescue/mount -uw /"
74.Pp
75The next step is to double-check the contents of
76.Pa /bin , /sbin ,
77and
78.Pa /usr/lib ,
79possibly mounting a
80.Fx
81rescue or
82.Dq "live file system"
83CD-ROM and copying files from there.
84Once it is possible to successfully run
85.Pa /bin/sh , /bin/ls ,
86and other standard utilities, try rebooting back into the standard
87system.
88.Pp
89The
90.Pa /rescue
91tools are compiled using
92.Xr crunchgen 1 ,
93which makes them considerably more compact than the standard
94utilities.
95To build a
96.Fx
97system where space is critical,
98.Pa /rescue
99can be used as a replacement for the standard
100.Pa /bin
101and
102.Pa /sbin
103directories; simply change
104.Pa /bin
105and
106.Pa /sbin
107to be symbolic links pointing to
108.Pa /rescue .
109Since
110.Pa /rescue
111is statically linked, it should also be possible to dispense with much
112of
113.Pa /usr/lib
114in such an environment.
115.Pp
116In contrast to its predecessor
117.Pa /stand ,
118.Pa /rescue
119is updated during normal
120.Fx
121source and binary upgrades.
122.Sh FILES
123.Bl -tag -width ".Pa /rescue" -compact
124.It Pa /rescue
125Root of the
126.Nm
127hierarchy.
128.El
129.Sh SEE ALSO
130.Xr crunchgen 1 ,
131.Xr crash 8
132.Sh HISTORY
133The
134.Nm
135utilities first appeared in
136.Fx 5.2 .
137.Sh AUTHORS
138.An -nosplit
139The
140.Nm
141system was written by
142.An Tim Kientzle Aq Mt kientzle@FreeBSD.org ,
143based on ideas taken from
144.Nx .
145This manual page was written by
146.An Simon L. Nielsen Aq Mt simon@FreeBSD.org ,
147based on text by
148.An Tim Kientzle Aq Mt kientzle@FreeBSD.org .
149.Sh BUGS
150Most of the
151.Nm
152tools work even in a fairly crippled system.
153The most egregious exception is the
154.Nm
155version of
156.Xr vi 1 ,
157which currently requires that
158.Pa /usr
159be mounted so that it can access the
160.Xr termcap 5
161files.
162Hopefully, a failsafe
163.Xr termcap 3
164entry will eventually be added into the
165.Xr ncurses 3
166library, so that
167.Pa /rescue/vi
168can be used even in a system where
169.Pa /usr
170cannot immediately be mounted.
171In the meantime, the
172.Nm
173version of the
174.Xr ed 1
175editor can be used from
176.Pa /rescue/ed
177if you need to edit files, but cannot mount
178.Pa /usr .
179