Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 1 | #!/bin/bash |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 2 | |
| 3 | fslist="proc sys dev run" |
| 4 | rodir=run/initramfs/ro |
| 5 | rwdir=run/initramfs/rw |
| 6 | upper=$rwdir/cow |
| 7 | work=$rwdir/work |
| 8 | |
| 9 | cd / |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 10 | mkdir -p "$fslist" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 11 | mount dev dev -tdevtmpfs |
| 12 | mount sys sys -tsysfs |
| 13 | mount proc proc -tproc |
| 14 | if ! grep run proc/mounts |
| 15 | then |
| 16 | mount tmpfs run -t tmpfs -o mode=755,nodev |
| 17 | fi |
| 18 | |
| 19 | mkdir -p $rodir $rwdir |
| 20 | |
| 21 | cp -rp init shutdown update whitelist bin sbin usr lib etc var run/initramfs |
| 22 | |
| 23 | # To start a interactive shell with job control at this point, run |
| 24 | # getty 38400 ttyS4 |
| 25 | |
| 26 | findmtd() { |
| 27 | m=$(grep -xl "$1" /sys/class/mtd/*/name) |
| 28 | m=${m%/name} |
| 29 | m=${m##*/} |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 30 | echo "$m" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | blkid_fs_type() { |
| 34 | # Emulate util-linux's `blkid -s TYPE -o value $1` |
| 35 | # Example busybox blkid output: |
| 36 | # # blkid /dev/mtdblock5 |
| 37 | # /dev/mtdblock5: TYPE="squashfs" |
| 38 | # Process output to extract TYPE value "squashfs". |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 39 | blkid "$1" | sed -e 's/^.*TYPE="//' -e 's/".*$//' |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | probe_fs_type() { |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 43 | fst=$(blkid_fs_type "$1") |
| 44 | echo "${fst:=jffs2}" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | # This fw_get_env_var is a possibly broken version of fw_printenv that |
| 48 | # does not check the crc or flag byte. |
| 49 | # The u-boot environment starts with a crc32, followed by a flag byte |
| 50 | # when a redundannt environment is configured, followed by var=value\0 sets. |
| 51 | # The flag byte for nand is a 1 byte counter; for nor it is a 1 or 0 byte. |
| 52 | |
| 53 | get_fw_env_var() { |
| 54 | # do we have 1 or 2 copies of the environment? |
| 55 | # count non-blank non-comment lines |
| 56 | # copies=$(grep -v ^# /etc/fw_env.config | grep -c [::alnum::]) |
| 57 | # ... we could if we had the fw_env.config in the initramfs |
| 58 | copies=2 |
| 59 | |
| 60 | # * Change \n to \r and \0 to \n |
| 61 | # * Skip to the 5th byte to skip over crc |
| 62 | # * then skip to the first or 2nd byte to skip over flag if it exists |
| 63 | # * stop parsing at first empty line corresponding to the |
| 64 | # double \0 at the end of the environment. |
| 65 | # * print the value of the variable name passed as argument |
| 66 | |
| 67 | envdev=$(findmtd u-boot-env) |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 68 | if test -n "$envdev" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 69 | then |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 70 | tr '\n\000' '\r\n' < "/dev/$envdev" | |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 71 | tail -c +5 | tail -c +${copies-1} | |
| 72 | sed -ne '/^$/,$d' -e "s/^$1=//p" |
| 73 | fi |
| 74 | } |
| 75 | |
| 76 | setup_resolv() { |
| 77 | runresolv=/run/systemd/resolve/resolv.conf |
| 78 | etcresolv=/etc/resolv.conf |
| 79 | |
| 80 | if test ! -e $etcresolv -a ! -L $etcresolv |
| 81 | then |
| 82 | mkdir -p ${runresolv%/*} |
| 83 | ln -s $runresolv $etcresolv |
| 84 | fi |
| 85 | if test ! -f $runresolv |
| 86 | then |
| 87 | cat /proc/net/pnp > $runresolv |
| 88 | fi |
| 89 | |
| 90 | return 0 |
| 91 | } |
| 92 | |
| 93 | try_tftp() { |
| 94 | # split into tftp:// host:port/ path/on/remote |
| 95 | # then spilt off / and then :port from the end of host:port/ |
| 96 | # and : from the beginning of port |
| 97 | |
| 98 | rest="${1#tftp://}" |
| 99 | path=${rest#*/} |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 100 | host=${rest%"$path"} |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 101 | host="${host%/}" |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 102 | port="${host#"${host%:*}"}" |
| 103 | host="${host%"$port"}" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 104 | port="${port#:}" |
| 105 | |
| 106 | setup_resolv |
| 107 | |
| 108 | if test -z "$host" -o -z "$path" |
| 109 | then |
| 110 | debug_takeover "Invalid tftp download url '$url'." |
| 111 | elif echo "Downloading '$url' from $host ..." && |
| 112 | ! tftp -g -r "$path" -l /run/image-rofs "$host" ${port+"$port"} |
| 113 | then |
| 114 | debug_takeover "Download of '$url' failed." |
| 115 | fi |
| 116 | } |
| 117 | |
| 118 | try_wget() { |
| 119 | setup_resolv |
| 120 | |
| 121 | echo "Downloading '$1' ..." |
| 122 | if ! wget -O /run/image-rofs "$1" |
| 123 | then |
| 124 | debug_takeover "Download of '$url' failed." |
| 125 | fi |
| 126 | } |
| 127 | |
| 128 | debug_takeover() { |
| 129 | echo "$@" |
| 130 | read -t 5 -n 1 -s -r -p "Press any key to log in and try to manually fix, force recovery in 5 seconds" |
| 131 | if test $? -gt 0 |
| 132 | then |
| 133 | mkdir -p /var/lock |
| 134 | envdev=$(findmtd u-boot-env) |
| 135 | echo -e "/dev/${envdev}\t0x00000\t0x10000" > /etc/fw_env.config |
| 136 | echo -e "/dev/${envdev}\t0x10000\t0x10000" >> /etc/fw_env.config |
| 137 | fw_setenv force_recovery 1 |
| 138 | fw_setenv last_booterrmsg "$@" |
| 139 | devmem 0xc0000000 32 0x01 |
| 140 | fi |
| 141 | cat << HERE |
| 142 | After fixing run exit to continue this script, or reboot -f to retry, or |
| 143 | touch /takeover and exit to become PID 1 allowing editing of this script. |
| 144 | HERE |
| 145 | |
| 146 | while ! sulogin && ! test -f /takeover |
| 147 | do |
| 148 | echo getty failed, retrying |
| 149 | done |
| 150 | |
| 151 | # Touch /takeover in the above getty to become pid 1 |
| 152 | if test -e /takeover |
| 153 | then |
| 154 | cat << HERE |
| 155 | |
| 156 | Takeover of init requested. Executing /bin/sh as PID 1. |
| 157 | When finished exec new init or cleanup and run reboot -f. |
| 158 | |
| 159 | Warning: No job control! Shell exit will panic the system! |
| 160 | HERE |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 161 | export PS1=init#\ |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 162 | exec /bin/sh |
| 163 | fi |
| 164 | } |
| 165 | |
| 166 | # Check System Maintenace Switch 7 and load factory default |
| 167 | check_dip() { |
| 168 | devmem 0x800000b8 16 0xFF |
| 169 | dip=$(devmem 0x800000b8 16) |
| 170 | |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 171 | value1=$((( dip & 0xFF00 ) >> 8 )) |
| 172 | value2=$((( dip & 0x0040 ) >> 6 )) |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 173 | |
| 174 | if [ $value1 -eq 0 ] && [ $value2 -eq 1 ] |
| 175 | then |
| 176 | echo "Detect System Maintenace Switch 7 on. Will load factory default" |
| 177 | return 0 |
| 178 | fi |
| 179 | return 1 |
| 180 | } |
| 181 | |
| 182 | rofs=$(findmtd rofs) |
| 183 | rwfs=$(findmtd rwfs) |
| 184 | |
| 185 | rodev=/dev/mtdblock${rofs#mtd} |
| 186 | rwdev=/dev/mtdblock${rwfs#mtd} |
| 187 | |
| 188 | # Set to y for yes, anything else for no. |
| 189 | force_rwfst_jffs2=y |
| 190 | flash_images_before_init=n |
| 191 | consider_download_files=y |
| 192 | consider_download_tftp=y |
| 193 | consider_download_http=y |
| 194 | consider_download_ftp=y |
| 195 | |
| 196 | rofst=squashfs |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 197 | rwfst=$(probe_fs_type "$rwdev") |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 198 | roopts=ro |
| 199 | rwopts=rw |
| 200 | |
| 201 | image=/run/initramfs/image- |
| 202 | trigger=${image}rwfs |
| 203 | |
| 204 | init=/sbin/init |
| 205 | fsckbase=/sbin/fsck. |
| 206 | fsck=$fsckbase$rwfst |
| 207 | fsckopts=-a |
| 208 | optfile=/run/initramfs/init-options |
| 209 | optbase=/run/initramfs/init-options-base |
| 210 | urlfile=/run/initramfs/init-download-url |
| 211 | update=/run/initramfs/update |
| 212 | |
| 213 | if test -e /${optfile##*/} |
| 214 | then |
| 215 | cp /${optfile##*/} $optfile |
| 216 | fi |
| 217 | |
| 218 | if test -e /${optbase##*/} |
| 219 | then |
| 220 | cp /${optbase##*/} $optbase |
| 221 | else |
| 222 | touch $optbase |
| 223 | fi |
| 224 | |
| 225 | if test ! -f $optfile |
| 226 | then |
| 227 | cat /proc/cmdline $optbase > $optfile |
| 228 | get_fw_env_var openbmcinit >> $optfile |
| 229 | get_fw_env_var openbmconce >> $optfile |
| 230 | fi |
| 231 | |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 232 | echo "rofs = $rofs $rofst rwfs = $rwfs $rwfst" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 233 | |
| 234 | if grep -w debug-init-sh $optfile |
| 235 | then |
| 236 | debug_takeover "Debug initial shell requested by command line." |
| 237 | fi |
| 238 | |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 239 | if test "$consider_download_files" = "y" && |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 240 | grep -w openbmc-init-download-files $optfile |
| 241 | then |
| 242 | if test -f ${urlfile##*/} |
| 243 | then |
| 244 | cp ${urlfile##*/} $urlfile |
| 245 | fi |
| 246 | if test ! -f $urlfile |
| 247 | then |
| 248 | get_fw_env_var openbmcinitdownloadurl > $urlfile |
| 249 | fi |
| 250 | url="$(cat $urlfile)" |
| 251 | rest="${url#*://}" |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 252 | proto="${url%"$rest"}" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 253 | |
| 254 | if test -z "$url" |
| 255 | then |
| 256 | echo "Download url empty. Ignoring download request." |
| 257 | elif test -z "$proto" |
| 258 | then |
| 259 | echo "Download failed." |
| 260 | elif test "$proto" = tftp:// |
| 261 | then |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 262 | if test "$consider_download_tftp" = "y" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 263 | then |
| 264 | try_tftp "$url" |
| 265 | else |
| 266 | echo "Download failed." |
| 267 | fi |
| 268 | elif test "$proto" = http:// |
| 269 | then |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 270 | if test "$consider_download_http" = "y" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 271 | then |
| 272 | try_wget "$url" |
| 273 | else |
| 274 | echo "Download failed." |
| 275 | fi |
| 276 | elif test "$proto" = ftp:// |
| 277 | then |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 278 | if test "$consider_download_ftp" = "y" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 279 | then |
| 280 | try_wget "$url" |
| 281 | else |
| 282 | echo "Download failed." |
| 283 | fi |
| 284 | else |
| 285 | echo "Download failed." |
| 286 | fi |
| 287 | fi |
| 288 | |
| 289 | # If there are images in root move them to /run/initramfs/ or /run/ now. |
| 290 | imagebasename=${image##*/} |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 291 | if test -n "${imagebasename}" && ls /"${imagebasename}"* > /dev/null 2>&1 |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 292 | then |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 293 | if test "$flash_images_before_init" = "y" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 294 | then |
| 295 | echo "Flash images found, will update before starting init." |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 296 | mv /"${imagebasename}"* ${image%"$imagebasename"} |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 297 | else |
| 298 | echo "Flash images found, will use but deferring flash update." |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 299 | mv /"${imagebasename}"* /run/ |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 300 | fi |
| 301 | fi |
| 302 | |
| 303 | if grep -w clean-rwfs-filesystem $optfile |
| 304 | then |
| 305 | echo "Cleaning of read-write overlay filesystem requested." |
| 306 | touch $trigger |
| 307 | fi |
| 308 | |
| 309 | if grep -w factory-reset $optfile || check_dip |
| 310 | then |
| 311 | echo "Factory reset requested." |
| 312 | touch $trigger |
| 313 | do_save=--no-save-files |
| 314 | else |
| 315 | do_save=--save-files |
| 316 | fi |
| 317 | |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 318 | if test "$force_rwfst_jffs2" = "y" -a "$rwfst" != jffs2 -a ! -f $trigger |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 319 | then |
| 320 | echo "Converting read-write overlay filesystem to jffs2 forced." |
| 321 | touch $trigger |
| 322 | fi |
| 323 | |
| 324 | if ls $image* > /dev/null 2>&1 |
| 325 | then |
| 326 | if ! test -x $update |
| 327 | then |
| 328 | debug_takeover "Flash update requested but $update missing!" |
| 329 | elif test -f $trigger -a ! -s $trigger |
| 330 | then |
| 331 | if [ $do_save = "--save-files" ] |
| 332 | then |
| 333 | echo "Saving selected files from read-write overlay filesystem." |
| 334 | else |
| 335 | echo "No files will be selected for save." |
| 336 | fi |
| 337 | $update --no-restore-files $do_save |
| 338 | echo "Clearing read-write overlay filesystem." |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 339 | flash_eraseall "/dev/$rwfs" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 340 | echo "Restoring saved files to read-write overlay filesystem." |
| 341 | touch $trigger |
| 342 | $update --no-save-files --clean-saved-files |
| 343 | else |
| 344 | $update --clean-saved-files $do_save |
| 345 | fi |
| 346 | |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 347 | rwfst=$(probe_fs_type "$rwdev") |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 348 | fsck=$fsckbase$rwfst |
| 349 | fi |
| 350 | |
| 351 | if grep -w overlay-filesystem-in-ram $optfile |
| 352 | then |
| 353 | rwfst=none |
| 354 | fi |
| 355 | |
| 356 | copyfiles= |
| 357 | if grep -w copy-files-to-ram $optfile |
| 358 | then |
| 359 | rwfst=none |
| 360 | copyfiles=y |
| 361 | fi |
| 362 | |
| 363 | # It would be nice to do this after fsck but that mean rofs is mounted |
| 364 | # which triggers the mtd is mounted check |
| 365 | if test "$rwfst$copyfiles" = noney |
| 366 | then |
| 367 | touch $trigger |
| 368 | $update --copy-files --clean-saved-files --no-restore-files |
| 369 | fi |
| 370 | |
| 371 | if grep -w copy-base-filesystem-to-ram $optfile && |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 372 | test ! -e /run/image-rofs && ! cp "$rodev" /run/image-rofs |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 373 | then |
| 374 | # Remove any partial copy to avoid attempted usage later |
| 375 | if test -e /run/image-rofs |
| 376 | then |
| 377 | ls -l /run/image-rofs |
| 378 | rm -f /run/image-rofs |
| 379 | fi |
| 380 | debug_takeover "Copying $rodev to /run/image-rofs failed." |
| 381 | fi |
| 382 | |
| 383 | if test -s /run/image-rofs |
| 384 | then |
| 385 | rodev=/run/image-rofs |
| 386 | roopts=$roopts,loop |
| 387 | fi |
| 388 | |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 389 | mount "$rodev" $rodir -t $rofst -o $roopts |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 390 | |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 391 | if test -x "$rodir$fsck" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 392 | then |
| 393 | for fs in $fslist |
| 394 | do |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 395 | mount --bind "$fs" "$rodir/$fs" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 396 | done |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 397 | chroot $rodir "$fsck" $fsckopts "$rwdev" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 398 | rc=$? |
| 399 | for fs in $fslist |
| 400 | do |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 401 | umount "$rodir/$fs" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 402 | done |
| 403 | if test $rc -gt 1 |
| 404 | then |
| 405 | debug_takeover "fsck of read-write fs on $rwdev failed (rc=$rc)" |
| 406 | fi |
| 407 | elif test "$rwfst" != jffs2 -a "$rwfst" != none |
| 408 | then |
| 409 | echo "No '$fsck' in read only fs, skipping fsck." |
| 410 | fi |
| 411 | |
| 412 | if test "$rwfst" = none |
| 413 | then |
| 414 | echo "Running with read-write overlay in RAM for this boot." |
| 415 | echo "No state will be preserved unless flash update performed." |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 416 | elif ! mount "$rwdev" $rwdir -t "$rwfst" -o $rwopts |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 417 | then |
| 418 | msg="$(cat)" << HERE |
| 419 | |
| 420 | Mounting read-write $rwdev filesystem failed. Please fix and run |
| 421 | mount $rwdev $rwdir -t $rwfst -o $rwopts |
| 422 | to to continue, or do change nothing to run from RAM for this boot. |
| 423 | HERE |
| 424 | debug_takeover "$msg" |
| 425 | fi |
| 426 | |
| 427 | rm -rf $work |
| 428 | mkdir -p $upper $work |
| 429 | |
| 430 | mount -t overlay -o lowerdir=$rodir,upperdir=$upper,workdir=$work cow /root |
| 431 | |
| 432 | while ! chroot /root /bin/sh -c "test -x '$init' -a -s '$init'" |
| 433 | do |
| 434 | msg="$(cat)" << HERE |
| 435 | |
| 436 | Unable to confirm /sbin/init is an executable non-empty file |
| 437 | in merged file system mounted at /root. |
| 438 | |
| 439 | Change Root test failed! Invoking emergency shell. |
| 440 | HERE |
| 441 | debug_takeover "$msg" |
| 442 | done |
| 443 | |
| 444 | for f in $fslist |
| 445 | do |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame^] | 446 | mount --move "$f" "root/$f" |
Jorge Cisneros | 8a445a0 | 2020-09-03 21:09:03 +0000 | [diff] [blame] | 447 | done |
| 448 | |
| 449 | # switch_root /root $init |
| 450 | exec chroot /root $init |
| 451 | |