-1

I can't ssh into Oracle Cloud Ubuntu 20.04 instance after do-release-upgrade. It was upgrading well but then prompted for a reboot, after the reboot, I can't access the server via ssh.

I have noticed that I can access it via oracle Cloud Console but then it prompts for username and password. Username is Ubuntu but password has not been set as putty keys were used to access ssh.

I was upgrading my Ubuntu version on my cloud server. I was expecting it to allow me to ssh to my server as I normally ssh to it after it was done.

I have tried using ChatGPT to assist with different options, including this approach to reset the password for the "ubuntu" user.

ChatGPT suggested:

  • Reboot the instance. During the reboot process, hold down the Shift key to access the GRUB menu.

  • In the GRUB menu, select Advanced options for Ubuntu. Choose the option ending with (recovery mode).

  • When prompted, choose to enter the root shell.

  • The root filesystem is initially mounted as read-only. Remount it in read/write mode:

    mount -o remount,rw /
    
  • Type the following command to change the password for the ubuntu user:

    passwd ubuntu
    
  • Follow the on-screen instructions to set a new password.

  • Reboot the system:

    reboot
    
  • Return to the console window. Enter the username "ubuntu". Use the new password you set to log in.

But I am still unable to change the password to login via Oracle Cloud Console nor access the server via ssh.

  • 1
    Did you check Oracle cloud security settings to make sure port 22 is open? Did you make sure the upgrade actually completed first? – Thomas Ward Oct 03 '23 at 14:39
  • Yes, I have checked security settings to verify that port 22 is still open, I have been ssh-ing into this server for about 2 months now, I'm not sure how to check if the updates are done, it's been 5 hours now after it rebooted as part of the upgrade prompts.

    It seems as if all of the network is down - i can't ping the server IP address but in the oracle cloud control panel It shows that the server is running.

    IF trying to connect using Oracle Console, it asks for Ubuntu login username and password - but I didnt set a password.

    – Muhammad Saloojee Oct 03 '23 at 14:58
  • 1
    It's difficult to follow that unformatted text, that will make getting help difficult. It looks like your system is read-only. Is that accurate? – user535733 Oct 03 '23 at 15:07
  • What happened after you followed what the ChatGPT suggested? – sotirov Oct 03 '23 at 16:22
  • @user535733 thank you. I have applied the format suggestion. No my server was not read only. I was running Nginx Unit, Docker with Supabase, Cyberpanel, and etc – Muhammad Saloojee Oct 03 '23 at 16:45
  • @sotirov My problems are 2: 1. My server is unreachable after [code block] do-release-upgrade. 2. I need the password for Ubuntu which i didn't set. Holding down the shift key didn't let me enter the Grub menu. I was trying you reset the password as I didn't set a password for Ubuntu - instead I set it up using ssh keys however I can only reach my server through Oracle Cloud Console (and it requires the password for Ubuntu before I can login to the Ubuntu User... as after running do-release-upgrade, i can't even Ping my server ip address – Muhammad Saloojee Oct 03 '23 at 16:54
  • Did you tell the upgrader not to update the sshd config file when it asked? If you didn't, your unique settings got wiped out. I am not sure how you can even set up a server without setting a password; maybe it's an Oracle thing. Suggest you remove all that ChatGPT nonsense from your question. – Organic Marble Oct 03 '23 at 16:55
  • @OrganicMarble I thought it would be best to let the upgrader use the suggested config files written by the package maintainers so I didn't tell it not to update the config files.. How can I login to the server again? – Muhammad Saloojee Oct 03 '23 at 16:57
  • If you wiped out your sshd config, and you could only log in via ssh....Sounds like it's time to reload from your backup and start over. – Organic Marble Oct 03 '23 at 16:58
  • @OrganicMarble any idea how to reset the user password through Oracle Cloud Console? – Muhammad Saloojee Oct 03 '23 at 16:59
  • Reload your backup and start over. – Organic Marble Oct 03 '23 at 17:00
  • Yikes.. I didn't take a backup .. – Muhammad Saloojee Oct 03 '23 at 17:01
  • 1
    Contact Oracle support? – Organic Marble Oct 03 '23 at 17:02
  • @OrganicMarble their* Support is practically non existent on low or free tiers.. I'm a self learning developer. Guess it's part of the learning – Muhammad Saloojee Oct 03 '23 at 17:03
  • On Digital Ocean (where I have my cloud instance) there's a "reset root password" button on the recovery console. Is there anything like that in Oracle? – Organic Marble Oct 03 '23 at 17:05
  • Instead of "Shift", try pressing "Esc" during the boot. – sotirov Oct 03 '23 at 17:12

1 Answers1

-1

Why you cannot connect to the server:

As @Organic Marble said in the comments, the reason why you cannot ssh to your server is because do-release-upgrade overwrote your sshd config. You will have to use the Cloud Console to access you server and reconfigure the sshd.

If you want to understand the reason why this happaned, check this: Should I replace the customized configuration file during release upgrade?

How to get to the GRUB menu:

I had a similar problem a while ago. The difference is that you are using Oracle Cloud Console, while I was using Proxmox Console. Most consoles are similar, so it shouldn't differ much.

What ChatGPT suggested is pretty close to what you have to do. The difference is that in the console you need to press Esc during the start/restart of the server. Try pressing it several times.

Once you get to the GRUB menu, you can change your password, setup your sshd and do whatever you want. Please, don't follow blindly what ChatGPT suggests, you system is probably already mounted as read/write.

sotirov
  • 3,169