Implement check for emergency shell in case bootloader is stuck
In the scenario where the bootloader screen is stuck, the worker will detect stall and enter post_fail_hook. During post_fail_hook, it has occurred that select_console('root') induced the emergency shell. In this case, there is no check that will redirect any logs to the serial console, like handle_emergency function.
We cannot add the check in activate_console , as the function is called repeatedly in many tests.
A solution would be to find out which step of the activate_console function is triggering the emergency shell and see if we can implement a check for stuck bootloader screen in wait_boot_past_bootloader or post_fail_hook, try to trigger emergency shell and if successful, collect logs.
It may not be easy to reproduce the scenario, as it is sporadic for SUTs with RAID0 root partition, during firstboot.