I accidently ran sudo chmod 777 -R / and stopped it after a few seconds. Now nothing works including sudo.
I have a 20.04 Ubuntu live USB here. Is it possible to upgrade the 18.04 to 20.04 to get it working without losing the 3 years of work on the laptop? I don't have a recent backup. That's what the Live USB was going to be used for.
I'd strongly suggest trying to fix your system first before trying to upgrade. Boot from the LiveCD and mount your partitions below, say,
/mnt/ubuntu1804
.chown -R o-rwx /mnt/ubuntu1804/etc/sudoers*
should stopsudo
from complaining, but of course, you need to fix a lot of additional files.In a first step, make a new backup now (as already suggested in the comments). Afterwards,
should touch a small subset of files also found on the LiveCD ad give you an idea what to change accordingly (by comparing the
.lst
files). You should be able to usechroot /mnt/ubuntu1804
for simple tests (see "Rescuing using a Live CD"). If you're lucky, you're able to boot your old system again afterwards. Then, reinstalling all installed packages should also fix access rights (see "Reinstalling all […] packages").That having said, the result--even if it works for you--should always be treated as a makeshift solution. An upgrade might work (as well) afterwards, but there's no guarantee that everything is fixed. Instead of investing (way) too much time to repair everything, better install Ubuntu 20.04 from scratch.