The problem: Each time I try to execute the sudo command, and type the correct password, it rejects the password.

I am at the end of my rope with internet searches, I’m close to just wiping and trying an operating system reinstall.

I am new to linux and I recently installed ubuntu 22.04.3. I haven’t been able to access the sudo command since the install. I’m currently attempting to install firewalld, but I’m going to need this command for other things as well and I’m starting to wonder if there is something wrong with my install or worse.

Many of the troubleshooting techniques I’ve come across contain a catch 22 in that they require the sudo command to solve this, which I am unable to execute.

Edit: Thanks to everyone who helped me with this issue. Update. I tried a first disk erase and install of ubuntu. During the first attempt I went through the software updates and I did a few things like changing firefox settings before attempting to change my root password. I was unable to change the root password when I attempted to.

Attempt #2. I reformatted and immediately tried to set my root password and this time it worked, and I have had no issues since. So take all of that for what it’s worth.

  • hackerwacker@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    10 months ago

    You can boot into recovery mode from the boot menu, which will give you root access without any password. From there you can reset your user password with passwd.

    • Arthur Besse@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      10 months ago
      Or, if recovery mode does ask for a password...

      you can edit Linux’s commandline arguments in the bootloader to add init=/bin/sh and then it will boot to a root shell without a password. the rootfs will be mounted read-only, so, before using passwd you need to first run mount -oremount,rw / to remount it read-write.

      then run passwd (to set root’s password) or passwd user (to set user’s), and then run sync to ensure the changes are flushed to disk, and then sync twice more for superstitious/historical reasons, and then turn the computer off and back on. (the reboot command will not work here.)