1

I am using 19.10 upgraded from 19.04. The OS was a virtual machine image downloaded from https://www.osboxes.org/ubuntu/ the downloaded image was 19.04 which I had upgraded to 19.10 There were some problems during upgrade which I managed to solve.ubuntu stuck on boot in after upgrade to 19.10 from 19.04 in vmware [end kernel panic not syncing:VFS:unable to mount root fs on block (0,0)]

The default passwords were https://www.osboxes.org/faq/what-are-the-credentials-for-virtual-machine-image/ I had a default administrator account osboxes.org which I removed and created a new user called debian (this I did on 19.10 after upgrading from 19.04) During the use of machines before upgrade I probably had reset the root password which I forgot and after upgrading I had deleted the original user account osboxes.org. I had created a new user username:debian I forgot its password also. So I thought of resetting root password as explained here https://md3v.com/linux-give-root-password-for-maintenance-lost-password
every thing worked perfectly I was able to reset the root password. Now when I try to login from Gnome interface as root the updated password is not accepted as a result I am locked out. How can I get out of this situation I don't see any error messages also. I set my root password as debian and this is not working.

1

Graphical root logins are not supported. This is separate from root logins in general, which work fine when enabled, though we usually discourage them since sudo gives you the same power and has some advantages (see below).

The specific mechanism that's stopping you from logging in graphically as root--assuming you're entering root's password correctly--is that your display manager is configured not to allow them. You could attempt to reconfigure it so it does (your display manager is probably GDM). But even if you do, graphical root logins are likely to work very poorly if at all, because this is not a use case that is supported or tested in Ubuntu.

Graphical root logins should also be avoided because they involve running a lot of stuff as root unnecessarily. Even if they worked perfectly, users would still be well-advised never to use them under any circumstances. (This is why no effort has been undertaken to make them work in Ubuntu.)

When you log in graphically, you should do so as a non-root user. When--if--you log in as root, you should, and can, do so non-graphically. Although you could use the same method you used to set a password for root to set one for another user, you don't have to. Since you've enabled root logins, you can set a password for a non-root user efficiently and without rebooting:

  1. Switch to a text-based virtual console by pressing Ctrl+Alt+F2.

    (In general, Ctrl+Alt+Fn switches to the virtual console ttyn. When the virtual console you're switching from is text-based, you can omit Ctrl from this key combination, though you don't have to.)

  2. Log in by entering root as the username and the password you set for root as the password. This is a non-graphical login. Based on the information you've provided, there's no reason to expect this to fail.

  3. Run passwd user to set a password for some non-root user account user. Replace user with the actual username.

    Or run adduser user to create a new user user. Enter the requested information. The real important bit is the password, though most people will want to put something in for the full name field too.

  4. Switch back to the virtual console on which the GUI is running. This is usually tty7, so press Ctrl+Alt+F7.

  5. Log in as the user whose password you set.

Since you have the root account enabled, you can run su in a terminal to get a root shell from which you can run commands as root. Use su - if you want this to behave as an initial login shell. The shell you get from su or su - lasts as long as you like (i.e., until you run exit in it or otherwise quit it), but it is best to use it only for administrative tasks that a non-root user couldn't directly perform. su -c 'some-command' runs a single command as root rather than starting a shell. (When some-command is just one word, i.e. when there are no command-line arguments, you can omit the quotes.) When you use su, you enter root's password, as you would when logging in as root. You must enter it each time you run su.


With that said, sudo and pkexec--rather than root logins and su--are the generally recommended way to perform administrative actions on Ubuntu. I recommend you consider adding a non-root user to the sudo group (an existing user or a new user), which makes that user an administrator. Then that user can run commands as root with sudo (and pkexec). One way to do this is to run usermod -a -G sudo user in step 3 above. Or perhaps your existing non-root user account is already in the sudo group; you can run groups user to check.

To run a command as root with sudo, you would usually use sudo some-command. Even when some-command consists of multiple words, it need not (and must not) be quoted. This is one of the ways that sudo is easier than su -c.

You also do not have to enter your password every time; instead, you need only enter it to use sudo in a terminal where you have not used sudo in the last several minutes. This way, it is efficient to run commands as root only when you need to, because you can interleave sudo commands with other commands, without having to type your password many times as you would with su -c instead of sudo, and without ending up running all commands entered into that terminal as root, as you would if you used su to get a root shell.

If you do want a root shell, you can get one with sudo -s, which is much like what you get from su, or sudo -i, which is virtually identical to what you get with su -.

When you use sudo, you enter your password, not root's password. Therefore root need not have a password set; the root account can be "disabled," yet you can still run commands as root with sudo.

If you decide to switch entirely to this recommended method--that is, if you administer your system in the way most Ubuntu users (and a sizable fraction of Debian users) do--then you can then re-disable root logins by running sudo passwd -dl root. This will keep you from logging in as root or becoming root with su, but you can still become root with sudo, including with sudo -i.

| improve this answer | |
  • Thanks every thing has worked perfectly, I use VMware my graphical tty was at Ctrl+Alt+Fn+F1 I am able to login as normal user debian which I had created. – political science Nov 6 '19 at 14:26
  • @politicalscience I'm glad it helped! You should be able to log in as graphically as your normal user too, though. Is that not working? – Eliah Kagan Nov 6 '19 at 18:00
  • Everything is working perfectly I can login as normal user. I just commented if someone comes to this link then they should be able to understand and help themselves. – political science Nov 6 '19 at 18:03
  • Excellent! Actually I had misunderstood your comment I thought you were saying specifically that you were able to log in as your normal user non-graphically, and I was concerned you might mean graphical logins did not work fully for that user. Sorry about that. :) – Eliah Kagan Nov 6 '19 at 18:06
  • Shouldn't the command be passwd instead of password? – jake Nov 8 '19 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.