I received the dreaded <username> is not in the sudoers file. This incident will be reported error. Somehow my user was removed from /etc/sudoers.
This is how I fixed it.
- Reboot your computer and when you see the prompt to hit
<esc>for the boot menu do it. - Press the number which represents your boot drive (usually 1)
- You will be taken to a Grub menu, highlight the entry for PureOS and press
eto edit. - Find the line that starts with
linuxand somewhere where it saysro quiet, addsinglein there so that it looks likero single quietand at the end of that line addinit=/bin/bash(these changes will not persist) - Press
Ctrl-Xto boot into single user mode. - You will be at a bash prompt but the filesystem is read only so remount it read-write with:
mount -o remount,rw / - Type
visudoto edit /etc/sudoers and add this entry:<username> ALL=(ALL:ALL) ALL - Reboot your computer and sudo will have been restored.