Borked network config on ssh key only google compute engine, now i cannot ssh. Serial console prompts for a password, update never set one. What is worse is i do not see how to set parameters to get in via single user mode.
As you have seen, connecting via Serial console requires a username and password to be set up. This must be done in advance, so the serial console will not help you now.
Here are some other things to try:
Fix GCE firewall
If the firewall that you changed is just the GCE firewall, you can change it back without accessing the instance. Just add a firewall rule giving you access on port 22.
Restart your instance
If you broke the firewall with an iptables
command, then the rule probably won't be persisted across a reboot. Try rebooting your instance from the console to see if you get access.
Fix a copy of your disk
This is the most complete and powerful repair method, but also the hardest:
- Snapshot the disk of your instance, creating "orig-snapshot"
- Create a new disk called "fix-disk" from "orig-snapshot".
- Create a new instance called "fix-instance" using the debian or redhat images.
- Attach "fix-disk" to "fix-instance" as a secondary disk
- SSH to "fix-instance".
- Inside "fix-instance", mount "fix-disk" on /mnt.
- You can then access your data on /mnt. If you just want access to your data, this should be sufficient. If you want to fix the disk, continue...
- If you know the file you edit that broke the instance, edit it on /mnt and fix it.
- If you want to set a password for the serial console in the future, run
sudo chroot /mnt passwd
. This will then allow you to set a password.
- unmount "fix-disk". At this point you can delete "fix-instance", but make sure you don't delete "fix-disk".
- Create a new instance using "fix-disk" as it's boot disk. This new instance will be a replacement for your original instance, but with the fixes you made in (8) and (9). If you need to keep the same IP address, you will have to move it from your old instance.