-1

When trying to format a USB key in the Disks tool I broke grub on a dual-boot system by accidentally formatting partition 1 of the HDD instead.

I haven't had any luck fixing it because I'm quite new to Ubuntu/Linux. Boot repair doesn't work because I'm on a UEFI system with no legacy bios. I get warnings to boot into legacy mode but can't.

I can boot using a Ubuntu Live CD. In the Disks tool I can see the old Ubuntu Filesystem. The Disks tool confirms that the filesystem is intact. When I mount the partition which it is installed to, I can navigate to see the names of the files and folders stored on the system (the files in my old Ubuntu Home folder for example). However when I try to open them, I get a permission denied error. Natural enough given that the old system had a username and password I suppose.

How do I gain permission to view these old files from the Live USB OS environment? Is there a way to enter my old password somewhere to gain access?

Apologies if the terminology I use isn't correct, I am not a regular Ubuntu user.

  • It seems you misunderstood almost everything 2 experts tried to make you understand in comments of your other question: https://askubuntu.com/questions/1443288/grub-boot-partition-repair-on-dual-boot-uefi-system . But it's a moot point anyway, at least for the moment, because you decided not to try to re-create the ESP and reinstall GRUB. Now, indeed you may have permissions and ownership issues when trying to backup your files from a live session, you need to chown (self-explanatory) the new mount point. Soo........ – ChanganAuto Dec 01 '22 at 19:20
  • Check the mount point in Disks and then run sudo chown $USER: (mount point). More info here: https://askubuntu.com/questions/628896/chown-difference-between-user-and-useruser
  • – ChanganAuto Dec 01 '22 at 19:21
  • @changanAuto yes as I noted I am not a regular Ubuntu user and if you look at the comments for that post I have asked questions to try and understand what they are saying. Also I have actually spent 2 days trying to re-create the ESP and reinstall GRUB but have not yet succeeded. Hence why I am trying an alternative route to get the data. – casperso Dec 01 '22 at 21:04
  • @ChanganAuto please don't get angry if I misunderstood you too here as I am new, if you can elaborate just a little it would be helpful. In the Live USB O/S I mounted the old Ubuntu filesystem- let's say it was at /media/ubuntu/xyz. I wasn't sure if you meant to literally write $USER or that I should use my username so I tried both, neither worked. I think the default username in Live USB is ubuntu so the text I typed (no wildcards here) was "sudo chown ubuntu: /media/ubuntu/xyz". There was no change however. Would I not need to enter the old Ubuntu OS password to get access to the files? – casperso Dec 01 '22 at 21:31
  • Yes, literally $USER: (the ":" is also important) and you would have know this is you read the link I provide above. Now, MY mistake: It also need a recursive argument - -R - so the full command should be sudo chown -R $USER: /media/ubuntu/xyz (of course adjust for the actual mount point). – ChanganAuto Dec 02 '22 at 19:12
  • @ChanganAuto in fact I did read the link. It doesn't specify whether they're using $USER literally or to denote the actual username either actually. Members considering whether to use the -R flag in the chown command on a root directory should read @ mook765's comment to my answer below before doing so. Doing so may make it difficult or impossible to later restore the broken OS. – casperso Dec 03 '22 at 00:30
  • may make it difficult or impossible to later restore the broken OS Yes, of course. But aren't we beyond that point, by your own decision? – ChanganAuto Dec 03 '22 at 07:49
  • @ChanganAuto - yes but perhaps others who find this page are not so I wanted to make the consequences of taking these steps unambiguous. – casperso Dec 03 '22 at 09:34