0

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.

5
  • The best you can hope for if you upgrade is a 20.04 system where nothing works. Boot from live media of 20.04 and do a fresh install. – David Apr 9 at 8:55
  • Try and boot from the live USB and copy off your data before the install. – David Apr 9 at 8:56
  • The external drive shows up as having "no space". It is a new drive that has 2 TB. I of course have backintime backing up to another usb. – Richard Bernstein Apr 9 at 9:07
  • Please post a detail of your configuration. Do you have separate partitions for root and home? Are they in an internal drive? What is the external drive you mention? Add as much information as you consider will help others help you. – sancho.s ReinstateMonicaCellio Apr 9 at 9:11
  • partition 1 250 MB FAT (34% full) , partition 2 3.3 GB FAT, partition 3 Ubuntu 252GB Ext4 (100% full) – Richard Bernstein Apr 9 at 9:19
0

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 stop sudo 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,

find /mnt/ubuntu1804 -mtime 1 -ls >/mnt/ubuntu1804/old_access_rights.lst
find / -mount -exec chmod --reference={} /mnt/ubuntu1804/{} \;
find /mnt/ubuntu1804 -mtime 1 -ls >/mnt/ubuntu1804/new_access_rights.lst

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 use chroot /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.

4
  • I actually have a few clonezilla backups from a few months ago (before mount stopped working). I also have a few current back in time backups of my working directory. How about if I got the clonezilla backup restored, and then applied the backin time? – Richard Bernstein Apr 9 at 10:21
  • Clonezilla works on partitions. If you're able to restore a backup on a different partition, you could copy the access rights from there, of course, but this might still not cover all files. If you decide to overwrite your current system with an older backup, you should end up with a "sane" 18.04 system, but of course will lose all changes made afterwards. However, you can still make a full backup now, restore the old backup, and search for differences between the old restored system and the new backup afterwards (primarily with respect to contents, not access rights). – Markus Ueberall Apr 9 at 10:32
  • How to make a full backup now? The problem I was having using dd was that is couldn;t see my external drive. Same issue I started getting with Clonezilla. Like I said I have backintime backups to restore "my work", once I get a "sane" 18.04. I made a backin time backup just yesterday. I just hope that after I get the 3 month old 18.04 back I will be able to "apply" the backintime successfully. My original plan was to use the live USB and then run dd on the laptop drive. But I just loaded live USB and I get permisssion denied on the laptop drive. – Richard Bernstein Apr 9 at 10:46
  • I just managed to get into the laptop drive from the live USB. I want to backup but I don't want to create a "bad" image, right? So should i just try to copy my work to an external drive (or a usb)? Is this what you meant by back up now? – Richard Bernstein Apr 9 at 10:55

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.