| 1 |
# SOME DESCRIPTIVE TITLE |
| 2 |
# Copyright (C) YEAR Free Software Foundation, Inc. |
| 3 |
# This file is distributed under the same license as the PACKAGE package. |
| 4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| 5 |
# |
| 6 |
#, fuzzy |
| 7 |
msgid "" |
| 8 |
msgstr "" |
| 9 |
"Project-Id-Version: PACKAGE VERSION\n" |
| 10 |
"POT-Creation-Date: 2026-06-05 06:35+0200\n" |
| 11 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 13 |
"Language-Team: LANGUAGE <[email protected]>\n" |
| 14 |
"Language: \n" |
| 15 |
"MIME-Version: 1.0\n" |
| 16 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 17 |
"Content-Transfer-Encoding: 8bit\n" |
| 18 |
|
| 19 |
#. type: TH |
| 20 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 21 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 22 |
#, no-wrap |
| 23 |
msgid "pivot_root" |
| 24 |
msgstr "" |
| 25 |
|
| 26 |
#. type: TH |
| 27 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 28 |
#: opensuse-tumbleweed |
| 29 |
#, no-wrap |
| 30 |
msgid "2026-02-08" |
| 31 |
msgstr "" |
| 32 |
|
| 33 |
#. type: TH |
| 34 |
#: archlinux debian-unstable |
| 35 |
#, no-wrap |
| 36 |
msgid "Linux man-pages 6.18" |
| 37 |
msgstr "" |
| 38 |
|
| 39 |
#. type: SH |
| 40 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 41 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 42 |
#, no-wrap |
| 43 |
msgid "NAME" |
| 44 |
msgstr "" |
| 45 |
|
| 46 |
#. type: Plain text |
| 47 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 48 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 49 |
msgid "pivot_root - change the root mount" |
| 50 |
msgstr "" |
| 51 |
|
| 52 |
#. type: SH |
| 53 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 54 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 55 |
#, no-wrap |
| 56 |
msgid "LIBRARY" |
| 57 |
msgstr "" |
| 58 |
|
| 59 |
#. type: Plain text |
| 60 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 61 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 62 |
msgid "Standard C library (I<libc>,\\ I<-lc>)" |
| 63 |
msgstr "" |
| 64 |
|
| 65 |
#. type: SH |
| 66 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 67 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 68 |
#, no-wrap |
| 69 |
msgid "SYNOPSIS" |
| 70 |
msgstr "" |
| 71 |
|
| 72 |
#. type: Plain text |
| 73 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 74 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 75 |
#, no-wrap |
| 76 |
msgid "" |
| 77 |
"B<#include E<lt>sys/syscall.hE<gt>> /* Definition of B<SYS_*> constants */\n" |
| 78 |
"B<#include E<lt>unistd.hE<gt>>\n" |
| 79 |
msgstr "" |
| 80 |
|
| 81 |
#. type: Plain text |
| 82 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 83 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 84 |
#, no-wrap |
| 85 |
msgid "B<int syscall(SYS_pivot_root, const char *>I<new_root>B<, const char *>I<put_old>B<);>\n" |
| 86 |
msgstr "" |
| 87 |
|
| 88 |
#. type: Plain text |
| 89 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 90 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 91 |
msgid "" |
| 92 |
"I<Note>: glibc provides no wrapper for B<pivot_root>(), necessitating the " |
| 93 |
"use of B<syscall>(2)." |
| 94 |
msgstr "" |
| 95 |
|
| 96 |
#. type: SH |
| 97 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 98 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 99 |
#, no-wrap |
| 100 |
msgid "DESCRIPTION" |
| 101 |
msgstr "" |
| 102 |
|
| 103 |
#. type: Plain text |
| 104 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 105 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 106 |
msgid "" |
| 107 |
"B<pivot_root>() changes the root mount in the mount namespace of the " |
| 108 |
"calling process. More precisely, it moves the root mount to the directory " |
| 109 |
"I<put_old> and makes I<new_root> the new root mount. The calling process " |
| 110 |
"must have the B<CAP_SYS_ADMIN> capability in the user namespace that owns " |
| 111 |
"the caller's mount namespace." |
| 112 |
msgstr "" |
| 113 |
|
| 114 |
#. type: Plain text |
| 115 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 116 |
#: opensuse-tumbleweed |
| 117 |
msgid "" |
| 118 |
"B<pivot_root>() changes the root directory and the current working " |
| 119 |
"directory of each process or thread in the same mount namespace to " |
| 120 |
"I<new_root> if they point to the old root directory. (See also NOTES.) On " |
| 121 |
"the other hand, B<pivot_root>() does not change the caller's current " |
| 122 |
"working directory (unless it is on the old root directory), and thus it " |
| 123 |
"should be followed by a I<chdir(\"/\")> call." |
| 124 |
msgstr "" |
| 125 |
|
| 126 |
#. type: Plain text |
| 127 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 128 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 129 |
msgid "The following restrictions apply:" |
| 130 |
msgstr "" |
| 131 |
|
| 132 |
#. type: IP |
| 133 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 134 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 135 |
#, no-wrap |
| 136 |
msgid "\\[bu]" |
| 137 |
msgstr "" |
| 138 |
|
| 139 |
#. type: Plain text |
| 140 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 141 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 142 |
msgid "I<new_root> and I<put_old> must be directories." |
| 143 |
msgstr "" |
| 144 |
|
| 145 |
#. type: Plain text |
| 146 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 147 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 148 |
msgid "" |
| 149 |
"I<new_root> and I<put_old> must not be on the same mount as the current root." |
| 150 |
msgstr "" |
| 151 |
|
| 152 |
#. type: Plain text |
| 153 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 154 |
#: opensuse-tumbleweed |
| 155 |
msgid "" |
| 156 |
"I<put_old> must be at or underneath I<new_root>; that is, adding some " |
| 157 |
"nonnegative number of \\[dq]I</..\\&>\\[dq] suffixes to the pathname pointed " |
| 158 |
"to by I<put_old> must yield the same directory as I<new_root>." |
| 159 |
msgstr "" |
| 160 |
|
| 161 |
#. type: Plain text |
| 162 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 163 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 164 |
msgid "" |
| 165 |
"I<new_root> must be a path to a mount point, but can't be I<\\[dq]/\\[dq]>. " |
| 166 |
"A path that is not already a mount point can be converted into one by bind " |
| 167 |
"mounting the path onto itself." |
| 168 |
msgstr "" |
| 169 |
|
| 170 |
#. type: Plain text |
| 171 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 172 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 173 |
msgid "" |
| 174 |
"The propagation type of the parent mount of I<new_root> and the parent mount " |
| 175 |
"of the current root directory must not be B<MS_SHARED>; similarly, if " |
| 176 |
"I<put_old> is an existing mount point, its propagation type must not be " |
| 177 |
"B<MS_SHARED>. These restrictions ensure that B<pivot_root>() never " |
| 178 |
"propagates any changes to another mount namespace." |
| 179 |
msgstr "" |
| 180 |
|
| 181 |
#. type: Plain text |
| 182 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 183 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 184 |
msgid "The current root directory must be a mount point." |
| 185 |
msgstr "" |
| 186 |
|
| 187 |
#. type: SH |
| 188 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 189 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 190 |
#, no-wrap |
| 191 |
msgid "RETURN VALUE" |
| 192 |
msgstr "" |
| 193 |
|
| 194 |
#. type: Plain text |
| 195 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 196 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 197 |
msgid "" |
| 198 |
"On success, zero is returned. On error, -1 is returned, and I<errno> is set " |
| 199 |
"to indicate the error." |
| 200 |
msgstr "" |
| 201 |
|
| 202 |
#. type: SH |
| 203 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 204 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 205 |
#, no-wrap |
| 206 |
msgid "ERRORS" |
| 207 |
msgstr "" |
| 208 |
|
| 209 |
#. type: Plain text |
| 210 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 211 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 212 |
msgid "" |
| 213 |
"B<pivot_root>() may fail with any of the same errors as B<stat>(2). " |
| 214 |
"Additionally, it may fail with the following errors:" |
| 215 |
msgstr "" |
| 216 |
|
| 217 |
#. type: TP |
| 218 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 219 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 220 |
#, no-wrap |
| 221 |
msgid "B<EBUSY>" |
| 222 |
msgstr "" |
| 223 |
|
| 224 |
#. #-#-#-#-# archlinux: pivot_root.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 225 |
#. Reconfirmed that the following error occurs on Linux 5.0 by |
| 226 |
#. specifying 'new_root' as "/rootfs" and 'put_old' as |
| 227 |
#. "/rootfs/oldrootfs", and *not* bind mounting "/rootfs" on top of |
| 228 |
#. itself. Of course, this is an odd situation, since a later check |
| 229 |
#. in the kernel code will in any case yield EINVAL if 'new_root' is |
| 230 |
#. not a mount point. However, when the system call was first added, |
| 231 |
#. 'new_root' was not required to be a mount point. So, this |
| 232 |
#. error is nowadays probably just the result of crufty accumulation. |
| 233 |
#. This error can also occur if we bind mount "/" on top of itself |
| 234 |
#. and try to specify "/" as the 'new' (again, an odd situation). So, |
| 235 |
#. the EBUSY check in the kernel does still seem necessary to prevent |
| 236 |
#. that case. Furthermore, the "or put_old" piece is probably |
| 237 |
#. redundant text (although the check is in the kernel), since, |
| 238 |
#. in another check, 'put_old' is required to be under 'new_root'. |
| 239 |
#. type: Plain text |
| 240 |
#. #-#-#-#-# debian-trixie: pivot_root.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 241 |
#. Reconfirmed that the following error occurs on Linux 5.0 by |
| 242 |
#. specifying 'new_root' as "/rootfs" and 'put_old' as |
| 243 |
#. "/rootfs/oldrootfs", and *not* bind mounting "/rootfs" on top of |
| 244 |
#. itself. Of course, this is an odd situation, since a later check |
| 245 |
#. in the kernel code will in any case yield EINVAL if 'new_root' is |
| 246 |
#. not a mount point. However, when the system call was first added, |
| 247 |
#. 'new_root' was not required to be a mount point. So, this |
| 248 |
#. error is nowadays probably just the result of crufty accumulation. |
| 249 |
#. This error can also occur if we bind mount "/" on top of itself |
| 250 |
#. and try to specify "/" as the 'new' (again, an odd situation). So, |
| 251 |
#. the EBUSY check in the kernel does still seem necessary to prevent |
| 252 |
#. that case. Furthermore, the "or put_old" piece is probably |
| 253 |
#. redundant text (although the check is in the kernel), since, |
| 254 |
#. in another check, 'put_old' is required to be under 'new_root'. |
| 255 |
#. type: Plain text |
| 256 |
#. #-#-#-#-# debian-unstable: pivot_root.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 257 |
#. Reconfirmed that the following error occurs on Linux 5.0 by |
| 258 |
#. specifying 'new_root' as "/rootfs" and 'put_old' as |
| 259 |
#. "/rootfs/oldrootfs", and *not* bind mounting "/rootfs" on top of |
| 260 |
#. itself. Of course, this is an odd situation, since a later check |
| 261 |
#. in the kernel code will in any case yield EINVAL if 'new_root' is |
| 262 |
#. not a mount point. However, when the system call was first added, |
| 263 |
#. 'new_root' was not required to be a mount point. So, this |
| 264 |
#. error is nowadays probably just the result of crufty accumulation. |
| 265 |
#. This error can also occur if we bind mount "/" on top of itself |
| 266 |
#. and try to specify "/" as the 'new' (again, an odd situation). So, |
| 267 |
#. the EBUSY check in the kernel does still seem necessary to prevent |
| 268 |
#. that case. Furthermore, the "or put_old" piece is probably |
| 269 |
#. redundant text (although the check is in the kernel), since, |
| 270 |
#. in another check, 'put_old' is required to be under 'new_root'. |
| 271 |
#. type: Plain text |
| 272 |
#. #-#-#-#-# fedora-44: pivot_root.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 273 |
#. Reconfirmed that the following error occurs on Linux 5.0 by |
| 274 |
#. specifying 'new_root' as "/rootfs" and 'put_old' as |
| 275 |
#. "/rootfs/oldrootfs", and *not* bind mounting "/rootfs" on top of |
| 276 |
#. itself. Of course, this is an odd situation, since a later check |
| 277 |
#. in the kernel code will in any case yield EINVAL if 'new_root' is |
| 278 |
#. not a mount point. However, when the system call was first added, |
| 279 |
#. 'new_root' was not required to be a mount point. So, this |
| 280 |
#. error is nowadays probably just the result of crufty accumulation. |
| 281 |
#. This error can also occur if we bind mount "/" on top of itself |
| 282 |
#. and try to specify "/" as the 'new' (again, an odd situation). So, |
| 283 |
#. the EBUSY check in the kernel does still seem necessary to prevent |
| 284 |
#. that case. Furthermore, the "or put_old" piece is probably |
| 285 |
#. redundant text (although the check is in the kernel), since, |
| 286 |
#. in another check, 'put_old' is required to be under 'new_root'. |
| 287 |
#. type: Plain text |
| 288 |
#. #-#-#-#-# fedora-rawhide: pivot_root.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 289 |
#. Reconfirmed that the following error occurs on Linux 5.0 by |
| 290 |
#. specifying 'new_root' as "/rootfs" and 'put_old' as |
| 291 |
#. "/rootfs/oldrootfs", and *not* bind mounting "/rootfs" on top of |
| 292 |
#. itself. Of course, this is an odd situation, since a later check |
| 293 |
#. in the kernel code will in any case yield EINVAL if 'new_root' is |
| 294 |
#. not a mount point. However, when the system call was first added, |
| 295 |
#. 'new_root' was not required to be a mount point. So, this |
| 296 |
#. error is nowadays probably just the result of crufty accumulation. |
| 297 |
#. This error can also occur if we bind mount "/" on top of itself |
| 298 |
#. and try to specify "/" as the 'new' (again, an odd situation). So, |
| 299 |
#. the EBUSY check in the kernel does still seem necessary to prevent |
| 300 |
#. that case. Furthermore, the "or put_old" piece is probably |
| 301 |
#. redundant text (although the check is in the kernel), since, |
| 302 |
#. in another check, 'put_old' is required to be under 'new_root'. |
| 303 |
#. type: Plain text |
| 304 |
#. #-#-#-#-# mageia-cauldron: pivot_root.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 305 |
#. Reconfirmed that the following error occurs on Linux 5.0 by |
| 306 |
#. specifying 'new_root' as "/rootfs" and 'put_old' as |
| 307 |
#. "/rootfs/oldrootfs", and *not* bind mounting "/rootfs" on top of |
| 308 |
#. itself. Of course, this is an odd situation, since a later check |
| 309 |
#. in the kernel code will in any case yield EINVAL if 'new_root' is |
| 310 |
#. not a mount point. However, when the system call was first added, |
| 311 |
#. 'new_root' was not required to be a mount point. So, this |
| 312 |
#. error is nowadays probably just the result of crufty accumulation. |
| 313 |
#. This error can also occur if we bind mount "/" on top of itself |
| 314 |
#. and try to specify "/" as the 'new' (again, an odd situation). So, |
| 315 |
#. the EBUSY check in the kernel does still seem necessary to prevent |
| 316 |
#. that case. Furthermore, the "or put_old" piece is probably |
| 317 |
#. redundant text (although the check is in the kernel), since, |
| 318 |
#. in another check, 'put_old' is required to be under 'new_root'. |
| 319 |
#. type: Plain text |
| 320 |
#. #-#-#-#-# opensuse-leap-16-1: pivot_root.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 321 |
#. Reconfirmed that the following error occurs on Linux 5.0 by |
| 322 |
#. specifying 'new_root' as "/rootfs" and 'put_old' as |
| 323 |
#. "/rootfs/oldrootfs", and *not* bind mounting "/rootfs" on top of |
| 324 |
#. itself. Of course, this is an odd situation, since a later check |
| 325 |
#. in the kernel code will in any case yield EINVAL if 'new_root' is |
| 326 |
#. not a mount point. However, when the system call was first added, |
| 327 |
#. 'new_root' was not required to be a mount point. So, this |
| 328 |
#. error is nowadays probably just the result of crufty accumulation. |
| 329 |
#. This error can also occur if we bind mount "/" on top of itself |
| 330 |
#. and try to specify "/" as the 'new' (again, an odd situation). So, |
| 331 |
#. the EBUSY check in the kernel does still seem necessary to prevent |
| 332 |
#. that case. Furthermore, the "or put_old" piece is probably |
| 333 |
#. redundant text (although the check is in the kernel), since, |
| 334 |
#. in another check, 'put_old' is required to be under 'new_root'. |
| 335 |
#. type: Plain text |
| 336 |
#. #-#-#-#-# opensuse-tumbleweed: pivot_root.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 337 |
#. Reconfirmed that the following error occurs on Linux 5.0 by |
| 338 |
#. specifying 'new_root' as "/rootfs" and 'put_old' as |
| 339 |
#. "/rootfs/oldrootfs", and *not* bind mounting "/rootfs" on top of |
| 340 |
#. itself. Of course, this is an odd situation, since a later check |
| 341 |
#. in the kernel code will in any case yield EINVAL if 'new_root' is |
| 342 |
#. not a mount point. However, when the system call was first added, |
| 343 |
#. 'new_root' was not required to be a mount point. So, this |
| 344 |
#. error is nowadays probably just the result of crufty accumulation. |
| 345 |
#. This error can also occur if we bind mount "/" on top of itself |
| 346 |
#. and try to specify "/" as the 'new' (again, an odd situation). So, |
| 347 |
#. the EBUSY check in the kernel does still seem necessary to prevent |
| 348 |
#. that case. Furthermore, the "or put_old" piece is probably |
| 349 |
#. redundant text (although the check is in the kernel), since, |
| 350 |
#. in another check, 'put_old' is required to be under 'new_root'. |
| 351 |
#. type: Plain text |
| 352 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 353 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 354 |
msgid "" |
| 355 |
"I<new_root> or I<put_old> is on the current root mount. (This error covers " |
| 356 |
"the pathological case where I<new_root> is I<\\[dq]/\\[dq]>.)" |
| 357 |
msgstr "" |
| 358 |
|
| 359 |
#. type: TP |
| 360 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 361 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 362 |
#, no-wrap |
| 363 |
msgid "B<EINVAL>" |
| 364 |
msgstr "" |
| 365 |
|
| 366 |
#. type: Plain text |
| 367 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 368 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 369 |
msgid "I<new_root> is not a mount point." |
| 370 |
msgstr "" |
| 371 |
|
| 372 |
#. type: Plain text |
| 373 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 374 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 375 |
msgid "I<put_old> is not at or underneath I<new_root>." |
| 376 |
msgstr "" |
| 377 |
|
| 378 |
#. type: Plain text |
| 379 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 380 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 381 |
msgid "" |
| 382 |
"The current root directory is not a mount point (because of an earlier " |
| 383 |
"B<chroot>(2))." |
| 384 |
msgstr "" |
| 385 |
|
| 386 |
#. type: Plain text |
| 387 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 388 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 389 |
msgid "The current root is on the rootfs (initial ramfs) mount; see NOTES." |
| 390 |
msgstr "" |
| 391 |
|
| 392 |
#. type: Plain text |
| 393 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 394 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 395 |
msgid "" |
| 396 |
"Either the mount point at I<new_root>, or the parent mount of that mount " |
| 397 |
"point, has propagation type B<MS_SHARED>." |
| 398 |
msgstr "" |
| 399 |
|
| 400 |
#. type: Plain text |
| 401 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 402 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 403 |
msgid "I<put_old> is a mount point and has the propagation type B<MS_SHARED>." |
| 404 |
msgstr "" |
| 405 |
|
| 406 |
#. type: TP |
| 407 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 408 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 409 |
#, no-wrap |
| 410 |
msgid "B<ENOTDIR>" |
| 411 |
msgstr "" |
| 412 |
|
| 413 |
#. type: Plain text |
| 414 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 415 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 416 |
msgid "I<new_root> or I<put_old> is not a directory." |
| 417 |
msgstr "" |
| 418 |
|
| 419 |
#. type: TP |
| 420 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 421 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 422 |
#, no-wrap |
| 423 |
msgid "B<EPERM>" |
| 424 |
msgstr "" |
| 425 |
|
| 426 |
#. type: Plain text |
| 427 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 428 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 429 |
msgid "The calling process does not have the B<CAP_SYS_ADMIN> capability." |
| 430 |
msgstr "" |
| 431 |
|
| 432 |
#. type: SH |
| 433 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 434 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 435 |
#, no-wrap |
| 436 |
msgid "STANDARDS" |
| 437 |
msgstr "" |
| 438 |
|
| 439 |
#. type: Plain text |
| 440 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 441 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 442 |
msgid "Linux." |
| 443 |
msgstr "" |
| 444 |
|
| 445 |
#. type: SH |
| 446 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 447 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 448 |
#, no-wrap |
| 449 |
msgid "HISTORY" |
| 450 |
msgstr "" |
| 451 |
|
| 452 |
#. type: Plain text |
| 453 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 454 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 455 |
msgid "Linux 2.3.41." |
| 456 |
msgstr "" |
| 457 |
|
| 458 |
#. type: SH |
| 459 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 460 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 461 |
#, no-wrap |
| 462 |
msgid "NOTES" |
| 463 |
msgstr "" |
| 464 |
|
| 465 |
#. type: Plain text |
| 466 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 467 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 468 |
msgid "" |
| 469 |
"A command-line interface for this system call is provided by " |
| 470 |
"B<pivot_root>(8)." |
| 471 |
msgstr "" |
| 472 |
|
| 473 |
#. type: Plain text |
| 474 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 475 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 476 |
msgid "" |
| 477 |
"B<pivot_root>() allows the caller to switch to a new root filesystem while " |
| 478 |
"at the same time placing the old root mount at a location under I<new_root> " |
| 479 |
"from where it can subsequently be unmounted. (The fact that it moves all " |
| 480 |
"processes that have a root directory or current working directory on the old " |
| 481 |
"root directory to the new root frees the old root directory of users, " |
| 482 |
"allowing the old root mount to be unmounted more easily.)" |
| 483 |
msgstr "" |
| 484 |
|
| 485 |
#. type: Plain text |
| 486 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 487 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 488 |
msgid "" |
| 489 |
"One use of B<pivot_root>() is during system startup, when the system mounts " |
| 490 |
"a temporary root filesystem (e.g., an B<initrd>(4)), then mounts the real " |
| 491 |
"root filesystem, and eventually turns the latter into the root directory of " |
| 492 |
"all relevant processes and threads. A modern use is to set up a root " |
| 493 |
"filesystem during the creation of a container." |
| 494 |
msgstr "" |
| 495 |
|
| 496 |
#. type: Plain text |
| 497 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 498 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 499 |
msgid "" |
| 500 |
"The fact that B<pivot_root>() modifies process root and current working " |
| 501 |
"directories in the manner noted in DESCRIPTION is necessary in order to " |
| 502 |
"prevent kernel threads from keeping the old root mount busy with their root " |
| 503 |
"and current working directories, even if they never access the filesystem in " |
| 504 |
"any way." |
| 505 |
msgstr "" |
| 506 |
|
| 507 |
#. type: Plain text |
| 508 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 509 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 510 |
msgid "" |
| 511 |
"The rootfs (initial ramfs) cannot be B<pivot_root>()ed. The recommended " |
| 512 |
"method of changing the root filesystem in this case is to delete everything " |
| 513 |
"in rootfs, overmount rootfs with the new root, attach I<stdin>/I<stdout>/" |
| 514 |
"I<stderr> to the new I</dev/console>, and exec the new B<init>(1). Helper " |
| 515 |
"programs for this process exist; see B<switch_root>(8)." |
| 516 |
msgstr "" |
| 517 |
|
| 518 |
#. type: SS |
| 519 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 520 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 521 |
#, no-wrap |
| 522 |
msgid "pivot_root(\\[dq].\\[dq], \\[dq].\\[dq])" |
| 523 |
msgstr "" |
| 524 |
|
| 525 |
#. type: Plain text |
| 526 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 527 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 528 |
msgid "" |
| 529 |
"I<new_root> and I<put_old> may be the same directory. In particular, the " |
| 530 |
"following sequence allows a pivot-root operation without needing to create " |
| 531 |
"and remove a temporary directory:" |
| 532 |
msgstr "" |
| 533 |
|
| 534 |
#. type: Plain text |
| 535 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 536 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 537 |
#, no-wrap |
| 538 |
msgid "" |
| 539 |
"chdir(new_root);\n" |
| 540 |
"pivot_root(\".\", \".\");\n" |
| 541 |
"umount2(\".\", MNT_DETACH);\n" |
| 542 |
msgstr "" |
| 543 |
|
| 544 |
#. type: Plain text |
| 545 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 546 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 547 |
msgid "" |
| 548 |
"This sequence succeeds because the B<pivot_root>() call stacks the old root " |
| 549 |
"mount point on top of the new root mount point at I</>. At that point, the " |
| 550 |
"calling process's root directory and current working directory refer to the " |
| 551 |
"new root mount point (I<new_root>). During the subsequent B<umount>() " |
| 552 |
"call, resolution of I<\\[dq].\\[dq]> starts with I<new_root> and then moves " |
| 553 |
"up the list of mounts stacked at I</>, with the result that old root mount " |
| 554 |
"point is unmounted." |
| 555 |
msgstr "" |
| 556 |
|
| 557 |
#. type: SS |
| 558 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 559 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 560 |
#, no-wrap |
| 561 |
msgid "Historical notes" |
| 562 |
msgstr "" |
| 563 |
|
| 564 |
#. type: Plain text |
| 565 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 566 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 567 |
msgid "For many years, this manual page carried the following text:" |
| 568 |
msgstr "" |
| 569 |
|
| 570 |
#. type: Plain text |
| 571 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 572 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 573 |
msgid "" |
| 574 |
"B<pivot_root>() may or may not change the current root and the current " |
| 575 |
"working directory of any processes or threads which use the old root " |
| 576 |
"directory. The caller of B<pivot_root>() must ensure that processes with " |
| 577 |
"root or current working directory at the old root operate correctly in " |
| 578 |
"either case. An easy way to ensure this is to change their root and current " |
| 579 |
"working directory to I<new_root> before invoking B<pivot_root>()." |
| 580 |
msgstr "" |
| 581 |
|
| 582 |
#. type: Plain text |
| 583 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 584 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 585 |
msgid "" |
| 586 |
"This text, written before the system call implementation was even finalized " |
| 587 |
"in the kernel, was probably intended to warn users at that time that the " |
| 588 |
"implementation might change before final release. However, the behavior " |
| 589 |
"stated in DESCRIPTION has remained consistent since this system call was " |
| 590 |
"first implemented and will not change now." |
| 591 |
msgstr "" |
| 592 |
|
| 593 |
#. type: SH |
| 594 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 595 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 596 |
#, no-wrap |
| 597 |
msgid "EXAMPLES" |
| 598 |
msgstr "" |
| 599 |
|
| 600 |
#. FIXME |
| 601 |
#. Would it be better, because simpler, to use unshare(2) |
| 602 |
#. rather than clone(2) in the example below? |
| 603 |
#. type: Plain text |
| 604 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 605 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 606 |
msgid "" |
| 607 |
"The program below demonstrates the use of B<pivot_root>() inside a mount " |
| 608 |
"namespace that is created using B<clone>(2). After pivoting to the root " |
| 609 |
"directory named in the program's first command-line argument, the child " |
| 610 |
"created by B<clone>(2) then executes the program named in the remaining " |
| 611 |
"command-line arguments." |
| 612 |
msgstr "" |
| 613 |
|
| 614 |
#. type: Plain text |
| 615 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 616 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 617 |
msgid "" |
| 618 |
"We demonstrate the program by creating a directory that will serve as the " |
| 619 |
"new root filesystem and placing a copy of the (statically linked) " |
| 620 |
"B<busybox>(1) executable in that directory." |
| 621 |
msgstr "" |
| 622 |
|
| 623 |
#. type: Plain text |
| 624 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 625 |
#: opensuse-tumbleweed |
| 626 |
#, no-wrap |
| 627 |
msgid "" |
| 628 |
"$B< mkdir /tmp/rootfs>;\n" |
| 629 |
"$B< ls -id /tmp/rootfs>; # Show inode number of new root directory\n" |
| 630 |
"319459 /tmp/rootfs\n" |
| 631 |
"$B< cp $(which busybox) /tmp/rootfs>;\n" |
| 632 |
"$B< PS1=\\[aq]bbsh$ \\[aq] sudo ./pivot_root_demo /tmp/rootfs /busybox sh>;\n" |
| 633 |
"bbsh$B< PATH=/>;\n" |
| 634 |
"bbsh$B< busybox ln busybox ln>;\n" |
| 635 |
"bbsh$B< ln busybox echo>;\n" |
| 636 |
"bbsh$B< ln busybox ls>;\n" |
| 637 |
"bbsh$B< ls>;\n" |
| 638 |
"busybox echo ln ls\n" |
| 639 |
"bbsh$B< ls -id />; # Compare with inode number above\n" |
| 640 |
"319459 /\n" |
| 641 |
"bbsh$B< echo \\[aq]hello world\\[aq]>;\n" |
| 642 |
"hello world\n" |
| 643 |
msgstr "" |
| 644 |
|
| 645 |
#. type: SS |
| 646 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 647 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 648 |
#, no-wrap |
| 649 |
msgid "Program source" |
| 650 |
msgstr "" |
| 651 |
|
| 652 |
#. type: Plain text |
| 653 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 654 |
#: opensuse-tumbleweed |
| 655 |
#, no-wrap |
| 656 |
msgid "" |
| 657 |
"/* pivot_root_demo.c */\n" |
| 658 |
"\\&\n" |
| 659 |
"#define _GNU_SOURCE\n" |
| 660 |
"#include E<lt>err.hE<gt>\n" |
| 661 |
"#include E<lt>limits.hE<gt>\n" |
| 662 |
"#include E<lt>sched.hE<gt>\n" |
| 663 |
"#include E<lt>signal.hE<gt>\n" |
| 664 |
"#include E<lt>stdio.hE<gt>\n" |
| 665 |
"#include E<lt>stdlib.hE<gt>\n" |
| 666 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 667 |
"#include E<lt>sys/mount.hE<gt>\n" |
| 668 |
"#include E<lt>sys/stat.hE<gt>\n" |
| 669 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 670 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 671 |
"#include E<lt>unistd.hE<gt>\n" |
| 672 |
"\\&\n" |
| 673 |
"static int\n" |
| 674 |
"pivot_root(const char *new_root, const char *put_old)\n" |
| 675 |
"{\n" |
| 676 |
" return syscall(SYS_pivot_root, new_root, put_old);\n" |
| 677 |
"}\n" |
| 678 |
"\\&\n" |
| 679 |
"#define STACK_SIZE (1024 * 1024)\n" |
| 680 |
"\\&\n" |
| 681 |
"static int /* Startup function for cloned child */\n" |
| 682 |
"child(void *arg)\n" |
| 683 |
"{\n" |
| 684 |
" char path[PATH_MAX];\n" |
| 685 |
" char **args = arg;\n" |
| 686 |
" char *new_root = args[0];\n" |
| 687 |
" const char *put_old = \"/oldrootfs\";\n" |
| 688 |
"\\&\n" |
| 689 |
" /* Ensure that \\[aq]new_root\\[aq] and its parent mount don\\[aq]t have\n" |
| 690 |
" shared propagation (which would cause pivot_root() to\n" |
| 691 |
" return an error), and prevent propagation of mount\n" |
| 692 |
" events to the initial mount namespace. */\n" |
| 693 |
"\\&\n" |
| 694 |
" if (mount(NULL, \"/\", NULL, MS_REC | MS_PRIVATE, NULL) == -1)\n" |
| 695 |
" err(EXIT_FAILURE, \"mount-MS_PRIVATE\");\n" |
| 696 |
"\\&\n" |
| 697 |
" /* Ensure that \\[aq]new_root\\[aq] is a mount point. */\n" |
| 698 |
"\\&\n" |
| 699 |
" if (mount(new_root, new_root, NULL, MS_BIND, NULL) == -1)\n" |
| 700 |
" err(EXIT_FAILURE, \"mount-MS_BIND\");\n" |
| 701 |
"\\&\n" |
| 702 |
" /* Create directory to which old root will be pivoted. */\n" |
| 703 |
"\\&\n" |
| 704 |
" snprintf(path, sizeof(path), \"%s/%s\", new_root, put_old);\n" |
| 705 |
" if (mkdir(path, 0777) == -1)\n" |
| 706 |
" err(EXIT_FAILURE, \"mkdir\");\n" |
| 707 |
"\\&\n" |
| 708 |
" /* And pivot the root filesystem. */\n" |
| 709 |
"\\&\n" |
| 710 |
" if (pivot_root(new_root, path) == -1)\n" |
| 711 |
" err(EXIT_FAILURE, \"pivot_root\");\n" |
| 712 |
"\\&\n" |
| 713 |
" /* Switch the current working directory to \"/\". */\n" |
| 714 |
"\\&\n" |
| 715 |
" if (chdir(\"/\") == -1)\n" |
| 716 |
" err(EXIT_FAILURE, \"chdir\");\n" |
| 717 |
"\\&\n" |
| 718 |
" /* Unmount old root and remove mount point. */\n" |
| 719 |
"\\&\n" |
| 720 |
" if (umount2(put_old, MNT_DETACH) == -1)\n" |
| 721 |
" perror(\"umount2\");\n" |
| 722 |
" if (rmdir(put_old) == -1)\n" |
| 723 |
" perror(\"rmdir\");\n" |
| 724 |
"\\&\n" |
| 725 |
" /* Execute the command specified in argv[1]... */\n" |
| 726 |
"\\&\n" |
| 727 |
" execv(args[1], &args[1]);\n" |
| 728 |
" err(EXIT_FAILURE, \"execv\");\n" |
| 729 |
"}\n" |
| 730 |
"\\&\n" |
| 731 |
"int\n" |
| 732 |
"main(int argc, char *argv[])\n" |
| 733 |
"{\n" |
| 734 |
" char *stack;\n" |
| 735 |
"\\&\n" |
| 736 |
" /* Create a child process in a new mount namespace. */\n" |
| 737 |
"\\&\n" |
| 738 |
" stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,\n" |
| 739 |
" MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);\n" |
| 740 |
" if (stack == MAP_FAILED)\n" |
| 741 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 742 |
"\\&\n" |
| 743 |
" if (clone(child, stack + STACK_SIZE,\n" |
| 744 |
" CLONE_NEWNS | SIGCHLD, &argv[1]) == -1)\n" |
| 745 |
" err(EXIT_FAILURE, \"clone\");\n" |
| 746 |
"\\&\n" |
| 747 |
" /* Parent falls through to here; wait for child. */\n" |
| 748 |
"\\&\n" |
| 749 |
" if (wait(NULL) == -1)\n" |
| 750 |
" err(EXIT_FAILURE, \"wait\");\n" |
| 751 |
"\\&\n" |
| 752 |
" exit(EXIT_SUCCESS);\n" |
| 753 |
"}\n" |
| 754 |
msgstr "" |
| 755 |
|
| 756 |
#. SRC END |
| 757 |
#. type: SH |
| 758 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 759 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 760 |
#, no-wrap |
| 761 |
msgid "SEE ALSO" |
| 762 |
msgstr "" |
| 763 |
|
| 764 |
#. type: Plain text |
| 765 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 766 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 767 |
msgid "" |
| 768 |
"B<chdir>(2), B<chroot>(2), B<mount>(2), B<stat>(2), B<initrd>(4), " |
| 769 |
"B<mount_namespaces>(7), B<pivot_root>(8), B<switch_root>(8)" |
| 770 |
msgstr "" |
| 771 |
|
| 772 |
#. type: TH |
| 773 |
#: debian-trixie |
| 774 |
#, no-wrap |
| 775 |
msgid "2024-05-02" |
| 776 |
msgstr "" |
| 777 |
|
| 778 |
#. type: TH |
| 779 |
#: debian-trixie |
| 780 |
#, no-wrap |
| 781 |
msgid "Linux man-pages 6.9.1" |
| 782 |
msgstr "" |
| 783 |
|
| 784 |
#. type: Plain text |
| 785 |
#: debian-trixie |
| 786 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 787 |
msgstr "" |
| 788 |
|
| 789 |
#. type: Plain text |
| 790 |
#: debian-trixie fedora-44 fedora-rawhide |
| 791 |
msgid "" |
| 792 |
"B<pivot_root>() changes the root directory and the current working " |
| 793 |
"directory of each process or thread in the same mount namespace to " |
| 794 |
"I<new_root> if they point to the old root directory. (See also NOTES.) On " |
| 795 |
"the other hand, B<pivot_root>() does not change the caller's current " |
| 796 |
"working directory (unless it is on the old root directory), and thus it " |
| 797 |
"should be followed by a B<chdir(\"/\")> call." |
| 798 |
msgstr "" |
| 799 |
|
| 800 |
#. type: Plain text |
| 801 |
#: debian-trixie fedora-44 fedora-rawhide |
| 802 |
msgid "" |
| 803 |
"I<put_old> must be at or underneath I<new_root>; that is, adding some " |
| 804 |
"nonnegative number of \"I</..>\" suffixes to the pathname pointed to by " |
| 805 |
"I<put_old> must yield the same directory as I<new_root>." |
| 806 |
msgstr "" |
| 807 |
|
| 808 |
#. type: Plain text |
| 809 |
#: debian-trixie fedora-44 fedora-rawhide |
| 810 |
#, no-wrap |
| 811 |
msgid "" |
| 812 |
"$ B<mkdir /tmp/rootfs>\n" |
| 813 |
"$ B<ls -id /tmp/rootfs> # Show inode number of new root directory\n" |
| 814 |
"319459 /tmp/rootfs\n" |
| 815 |
"$ B<cp $(which busybox) /tmp/rootfs>\n" |
| 816 |
"$ B<PS1=\\[aq]bbsh$ \\[aq] sudo ./pivot_root_demo /tmp/rootfs /busybox sh>\n" |
| 817 |
"bbsh$ B<PATH=/>\n" |
| 818 |
"bbsh$ B<busybox ln busybox ln>\n" |
| 819 |
"bbsh$ B<ln busybox echo>\n" |
| 820 |
"bbsh$ B<ln busybox ls>\n" |
| 821 |
"bbsh$ B<ls>\n" |
| 822 |
"busybox echo ln ls\n" |
| 823 |
"bbsh$ B<ls -id /> # Compare with inode number above\n" |
| 824 |
"319459 /\n" |
| 825 |
"bbsh$ B<echo \\[aq]hello world\\[aq]>\n" |
| 826 |
"hello world\n" |
| 827 |
msgstr "" |
| 828 |
|
| 829 |
#. type: Plain text |
| 830 |
#: debian-trixie fedora-44 fedora-rawhide |
| 831 |
#, no-wrap |
| 832 |
msgid "" |
| 833 |
"/* pivot_root_demo.c */\n" |
| 834 |
"\\&\n" |
| 835 |
"#define _GNU_SOURCE\n" |
| 836 |
"#include E<lt>err.hE<gt>\n" |
| 837 |
"#include E<lt>limits.hE<gt>\n" |
| 838 |
"#include E<lt>sched.hE<gt>\n" |
| 839 |
"#include E<lt>signal.hE<gt>\n" |
| 840 |
"#include E<lt>stdio.hE<gt>\n" |
| 841 |
"#include E<lt>stdlib.hE<gt>\n" |
| 842 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 843 |
"#include E<lt>sys/mount.hE<gt>\n" |
| 844 |
"#include E<lt>sys/stat.hE<gt>\n" |
| 845 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 846 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 847 |
"#include E<lt>unistd.hE<gt>\n" |
| 848 |
"\\&\n" |
| 849 |
"static int\n" |
| 850 |
"pivot_root(const char *new_root, const char *put_old)\n" |
| 851 |
"{\n" |
| 852 |
" return syscall(SYS_pivot_root, new_root, put_old);\n" |
| 853 |
"}\n" |
| 854 |
"\\&\n" |
| 855 |
"#define STACK_SIZE (1024 * 1024)\n" |
| 856 |
"\\&\n" |
| 857 |
"static int /* Startup function for cloned child */\n" |
| 858 |
"child(void *arg)\n" |
| 859 |
"{\n" |
| 860 |
" char path[PATH_MAX];\n" |
| 861 |
" char **args = arg;\n" |
| 862 |
" char *new_root = args[0];\n" |
| 863 |
" const char *put_old = \"/oldrootfs\";\n" |
| 864 |
"\\&\n" |
| 865 |
" /* Ensure that \\[aq]new_root\\[aq] and its parent mount don\\[aq]t have\n" |
| 866 |
" shared propagation (which would cause pivot_root() to\n" |
| 867 |
" return an error), and prevent propagation of mount\n" |
| 868 |
" events to the initial mount namespace. */\n" |
| 869 |
"\\&\n" |
| 870 |
" if (mount(NULL, \"/\", NULL, MS_REC | MS_PRIVATE, NULL) == -1)\n" |
| 871 |
" err(EXIT_FAILURE, \"mount-MS_PRIVATE\");\n" |
| 872 |
"\\&\n" |
| 873 |
" /* Ensure that \\[aq]new_root\\[aq] is a mount point. */\n" |
| 874 |
"\\&\n" |
| 875 |
" if (mount(new_root, new_root, NULL, MS_BIND, NULL) == -1)\n" |
| 876 |
" err(EXIT_FAILURE, \"mount-MS_BIND\");\n" |
| 877 |
"\\&\n" |
| 878 |
" /* Create directory to which old root will be pivoted. */\n" |
| 879 |
"\\&\n" |
| 880 |
" snprintf(path, sizeof(path), \"%s/%s\", new_root, put_old);\n" |
| 881 |
" if (mkdir(path, 0777) == -1)\n" |
| 882 |
" err(EXIT_FAILURE, \"mkdir\");\n" |
| 883 |
"\\&\n" |
| 884 |
" /* And pivot the root filesystem. */\n" |
| 885 |
"\\&\n" |
| 886 |
" if (pivot_root(new_root, path) == -1)\n" |
| 887 |
" err(EXIT_FAILURE, \"pivot_root\");\n" |
| 888 |
"\\&\n" |
| 889 |
" /* Switch the current working directory to \"/\". */\n" |
| 890 |
"\\&\n" |
| 891 |
" if (chdir(\"/\") == -1)\n" |
| 892 |
" err(EXIT_FAILURE, \"chdir\");\n" |
| 893 |
"\\&\n" |
| 894 |
" /* Unmount old root and remove mount point. */\n" |
| 895 |
"\\&\n" |
| 896 |
" if (umount2(put_old, MNT_DETACH) == -1)\n" |
| 897 |
" perror(\"umount2\");\n" |
| 898 |
" if (rmdir(put_old) == -1)\n" |
| 899 |
" perror(\"rmdir\");\n" |
| 900 |
"\\&\n" |
| 901 |
" /* Execute the command specified in argv[1]... */\n" |
| 902 |
"\\&\n" |
| 903 |
" execv(args[1], &args[1]);\n" |
| 904 |
" err(EXIT_FAILURE, \"execv\");\n" |
| 905 |
"}\n" |
| 906 |
"\\&\n" |
| 907 |
"int\n" |
| 908 |
"main(int argc, char *argv[])\n" |
| 909 |
"{\n" |
| 910 |
" char *stack;\n" |
| 911 |
"\\&\n" |
| 912 |
" /* Create a child process in a new mount namespace. */\n" |
| 913 |
"\\&\n" |
| 914 |
" stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,\n" |
| 915 |
" MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);\n" |
| 916 |
" if (stack == MAP_FAILED)\n" |
| 917 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 918 |
"\\&\n" |
| 919 |
" if (clone(child, stack + STACK_SIZE,\n" |
| 920 |
" CLONE_NEWNS | SIGCHLD, &argv[1]) == -1)\n" |
| 921 |
" err(EXIT_FAILURE, \"clone\");\n" |
| 922 |
"\\&\n" |
| 923 |
" /* Parent falls through to here; wait for child. */\n" |
| 924 |
"\\&\n" |
| 925 |
" if (wait(NULL) == -1)\n" |
| 926 |
" err(EXIT_FAILURE, \"wait\");\n" |
| 927 |
"\\&\n" |
| 928 |
" exit(EXIT_SUCCESS);\n" |
| 929 |
"}\n" |
| 930 |
msgstr "" |
| 931 |
|
| 932 |
#. type: TH |
| 933 |
#: fedora-44 fedora-rawhide |
| 934 |
#, no-wrap |
| 935 |
msgid "2024-07-23" |
| 936 |
msgstr "" |
| 937 |
|
| 938 |
#. type: TH |
| 939 |
#: fedora-44 fedora-rawhide |
| 940 |
#, no-wrap |
| 941 |
msgid "Linux man-pages 6.13" |
| 942 |
msgstr "" |
| 943 |
|
| 944 |
#. type: TH |
| 945 |
#: mageia-cauldron |
| 946 |
#, no-wrap |
| 947 |
msgid "Linux man-pages 6.17" |
| 948 |
msgstr "" |
| 949 |
|
| 950 |
#. type: TH |
| 951 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 952 |
#, no-wrap |
| 953 |
msgid "Linux man-pages (unreleased)" |
| 954 |
msgstr "" |