Recovering a Compute Engine VM that will not boot
Short answer
C Configure serial port access and log in through the serial console to edit the low-level Linux file while the Compute Engine instance is still failing to boot.
Question
Key Takeaways
A Compute Engine instance that cannot reach a normal run level needs out-of-band access, and the serial console is the only listed path that works before the OS finishes booting. Option C wins because SSH, remote desktop, and scp all depend on a running guest with services listening. Enable serial-port access, fix the file, then revoke the access.
Expert Analysis
C. Serial console provides out-of-band access to the VM's boot process for troubleshooting boot failures. SSH (A) won't work if the VM doesn't boot. Cloud Logging (B) captures OS logs only if the OS boots. VNC (D) requires a running GUI.
The deciding constraint is that the typo sits in a low-level Linux configuration file and the instance never reaches a normal run level. Any access path that depends on a fully initialized userspace therefore fails before the first command can be issued, which is exactly why option C — configuring serial port access and logging in through it — is the only workable route. The serial console on a Compute Engine VM is attached to the guest operating system's kernel console, so it is live during boot, before sshd starts, before google-guest-agent finishes, and before any run level is reached. That gives a shell (or at minimum the kernel's boot output plus a prompt once the guest's agetty on ttyS0 is up) at the point where the malformed file is actually being read.
Option B fails on the same timing grounds: SSH requires sshd listening, which requires the boot to have progressed far enough to start services, and the scenario states the instance cannot boot to a normal run level. Option D compounds this by requiring a remote desktop stack — an X or VNC server — which is a long-running GUI service that will never start in a VM stuck early in boot, and Compute Engine offers no remote desktop protocol on its own. Option A is the strongest distractor because scp would indeed let you reach the file, but scp runs over an established SSH connection to a booted guest; you cannot open that connection to a machine that will not finish booting, so the transport is unavailable exactly when you need it.
The mechanism this question relies on but does not spell out is that serial-port access to a Compute Engine instance must be enabled before it becomes useful: the instance needs serial-port-enable set (for example via instance metadata serial-port-enable=true, or the equivalent --metadata flag when the VM is created) and, for login, an SSH key added to serial-port metadata or a configured serial-port user. Because the instance in this scenario was created today with no other maintenance, the practical sequence is to enable serial port access from the Cloud Console or gcloud compute instances add-metadata while the VM sits in its failed boot state, then open the browser serial console or connect with gcloud compute connect-to-serial-port and edit the offending file. If the guest is mid-boot rather than halted, the serial console still shows kernel messages, which is itself diagnostic. Note also that serial console output is a common exposure risk, so access should be granted narrowly and revoked once the file is corrected — a detail worth carrying into any similar production troubleshooting question.
For a boot failure caused by a typo, the same out-of-band logic applies beyond this scenario: when a VM cannot reach run level 5 (or the systemd equivalent), treat SSH, remote desktop, and any log sink that depends on the guest agent as unavailable, and reach for the serial console first.
Exam Strategy
When a question says a VM will not boot, immediately eliminate any option whose transport starts inside the guest — SSH, RDP/VNC, scp, or a log agent — because none of them run before the failure point. Look instead for an out-of-band channel attached to the kernel console, such as the serial port, and check whether the scenario implies the channel must be enabled first. This pattern repeats across cloud troubleshooting items: match the access method to how far the boot process actually gets.
Related Analysis
Practice All PCD Questions
Access 84 questions with complete answers and detailed explanations.
View Full PCD Practice Test →