After reading an article "How to use ubuntu sudo without entering a password", I modified the /etc/sudoers file, and then tried to use sudo, and it was a tragedy, prompting:
sudo: no valid sudoers sources found, quitting
I checked the information and said that I want to restore to Recovery mode and use the root user to restore the changes made before, but restarting and pressing shift or f12 did not respond. Finally, I used
$ su root
Enter the root password to get it done. The root password is the same as the password entered for the first time when the account was created. Attach the contents of the /etc/sudoers source file
# # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d