xref: /freebsd/share/man/man8/rescue.8 (revision 258958b3c7e017266080ae7fc9e3d8e64b6450d4)
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.\" $FreeBSD$
27.\"
28.Dd June 30, 2022
29.Dt RESCUE 8
30.Os
31.Sh NAME
32.Nm rescue
33.Nd rescue utilities in
34.Pa /rescue
35.Sh DESCRIPTION
36The
37.Pa /rescue
38directory contains a collection of common utilities intended for use
39in recovering a badly damaged system.
40With the transition to a dynamically-linked root beginning with
41.Fx 5.2 ,
42there is a real possibility that the standard tools in
43.Pa /bin
44and
45.Pa /sbin
46may become non-functional due to a failed upgrade or a disk error.
47The tools in
48.Pa /rescue
49are statically linked and should therefore be more resistant to
50damage.
51However, being statically linked, the tools in
52.Pa /rescue
53are also less functional than the standard utilities.
54In particular, they do not have full use of the locale,
55.Xr pam 3 ,
56and nsswitch libraries.
57.Pp
58If your system fails to boot, and it shows a prompt similar to:
59.Pp
60.Dl "Enter full pathname of shell or RETURN for /bin/sh: "
61.Pp
62the first thing to try running is the standard shell,
63.Pa /bin/sh .
64If that fails, try running
65.Pa /rescue/sh ,
66which is the
67.Nm
68shell.
69To repair the system, the root partition must first be remounted
70read-write.
71This can be done with the following
72.Xr mount 8
73command:
74.Pp
75.Dl "/rescue/mount -uw /"
76.Pp
77The next step is to double-check the contents of
78.Pa /bin , /sbin ,
79and
80.Pa /usr/lib ,
81possibly mounting a
82.Fx
83rescue or
84.Dq "live file system"
85CD-ROM and copying files from there.
86Once it is possible to successfully run
87.Pa /bin/sh , /bin/ls ,
88and other standard utilities, try rebooting back into the standard
89system.
90.Pp
91The
92.Pa /rescue
93tools are compiled using
94.Xr crunchgen 1 ,
95which makes them considerably more compact than the standard
96utilities.
97To build a
98.Fx
99system where space is critical,
100.Pa /rescue
101can be used as a replacement for the standard
102.Pa /bin
103and
104.Pa /sbin
105directories; simply change
106.Pa /bin
107and
108.Pa /sbin
109to be symbolic links pointing to
110.Pa /rescue .
111Since
112.Pa /rescue
113is statically linked, it should also be possible to dispense with much
114of
115.Pa /usr/lib
116in such an environment.
117.Pp
118In contrast to its predecessor
119.Pa /stand ,
120.Pa /rescue
121is updated during normal
122.Fx
123source and binary upgrades.
124.Sh FILES
125.Bl -tag -width ".Pa /rescue" -compact
126.It Pa /rescue
127Root of the
128.Nm
129hierarchy.
130.El
131.Sh SEE ALSO
132.Xr crunchgen 1 ,
133.Xr crash 8
134.Sh HISTORY
135The
136.Nm
137utilities first appeared in
138.Fx 5.2 .
139.Sh AUTHORS
140.An -nosplit
141The
142.Nm
143system was written by
144.An Tim Kientzle Aq Mt kientzle@FreeBSD.org ,
145based on ideas taken from
146.Nx .
147This manual page was written by
148.An Simon L. Nielsen Aq Mt simon@FreeBSD.org ,
149based on text by
150.An Tim Kientzle Aq Mt kientzle@FreeBSD.org .
151.Sh BUGS
152Most of the
153.Nm
154tools work even in a fairly crippled system.
155The most egregious exception is the
156.Nm
157version of
158.Xr vi 1 ,
159which currently requires that
160.Pa /usr
161be mounted so that it can access the
162.Xr termcap 5
163files.
164Hopefully, a failsafe
165.Xr termcap 3
166entry will eventually be added into the
167.Xr ncurses 3
168library, so that
169.Pa /rescue/vi
170can be used even in a system where
171.Pa /usr
172cannot immediately be mounted.
173In the meantime, the
174.Nm
175version of the
176.Xr ed 1
177editor can be used from
178.Pa /rescue/ed
179if you need to edit files, but cannot mount
180.Pa /usr .
181