diff options
author | Aaron Ball <nullspoon@oper.io> | 2017-02-04 20:09:08 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2017-02-04 20:09:08 -0700 |
commit | cbac185434b6fa19e50d6a6aa8596216c310d76c (patch) | |
tree | 1f219cdb443fba4b2e7ae334bad7d6aa452c279a /init | |
parent | 422145765b0eea6ccde695c4d82a18370e02c712 (diff) | |
download | mkinitramfs-cbac185434b6fa19e50d6a6aa8596216c310d76c.tar.gz mkinitramfs-cbac185434b6fa19e50d6a6aa8596216c310d76c.tar.xz |
init:Additional breakpoints for easier debugging
Added a sleep 2 before attempting to access the specified root device to
allow for device settling (usb devices sometimes weren't ready yet and
causes init to fail). This needs to be replaced later by a
'wait_for_dev' function.
Added breakpoint to allow debugging for when the specified root device
does not exist.
Added a breakpoint for an init script not being detected in the
destination root fs.
Added breakpoint for failed switch_root.
Added many more log messages.
Diffstat (limited to 'init')
-rwxr-xr-x | init | 31 |
1 files changed, 25 insertions, 6 deletions
@@ -140,6 +140,17 @@ function main { log "Root device: ${ROOTDEV}" + log "Waiting a few seconds for devices to settle." + sleep 2 + + # Drop to maintenance shell if root device does not exist. + if [[ ! -b ${ROOTDEV} ]]; then + log "ERROR: Root device ${ROOTDEV} does not exist or can not be accessed." + log " Dropping to maintenance shell for troubleshooting." + log " (You may just need to wait longer for the root device)" + /bin/bash -i + fi + if [[ $(get_part_type ${ROOTDEV}) == 'luks' ]]; then # Set new rootdev location (/dev/mapper/something). This will update it to # the decrypted block device path. @@ -153,18 +164,26 @@ function main { log "Interractive shell requested. Type 'exit' to continue boot sequence." /bin/bash --norc fi - + # Mount the fakeroot. log "Mounting fakeroot" mount_fakeroot ${ROOTDEV} ${fakeroot} + # Ensure switch_root will be possible for destination fakeroot + if [[ ! -f ${fakeroot}/sbin/init ]]; then + log "ERROR: Destination fakeroot ${fakeroot} does not have an init script." + log " Cannot proceed. Dropping to shell for troubleshooting." + /bin/bash -i + fi + # Boot the real McCoy + log "Switching root" exec switch_root ${fakeroot} /sbin/init - if [[ $? -gt 0 ]]; then - log "There was an error performing switch_root to ${fakeroot}." - log "Starting recovery shell." - /bin/bash - fi + + # This will be reached if previous command failed + log "There was an error performing switch_root to ${fakeroot}." + log "Starting recovery shell." + /bin/bash -i } main ${@} |