My first thought was I don't have another Linux system, but then I realized that I did have another SD card and could easily create another Linux system. I flashed it with Octopi and booted my Pi with it. I put the original SD card in a USB reader and plugged it in. Mounted the drive (had to google that for a refresher on how to do it) and edited the file.
The problem was the last line:
I thought to enable the inclusion of the
sudoers.d directory, I had to uncomment it. I didn't realize that with the
# it was actually a command.
I did use
visudo but ignored the warning at the end. Wasn't sure what it meant and didn't realize that it was about to do something very bad to the OS!
So I set the password for the root account. But now when I try
pkexec visudo it gives me this error:
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
I googled it but I'm afraid the explanations I found were beyond my understanding of Linux. Oh, well, no problem. I know how to fix the
sudoers file in the future. I also know how important it is to use
visudo and pay attention to its error messages! Keeping the extra SD card handy just in case.
Thanks for the help!