0

I tried to use rm to format a pendrive but it also deleted everything inside my Home folder.

Now I can't even login anymore. Also, pressing shift on boot wont enter in recovery mode.

I have the ubuntu installer on a bootable pendrive, thought.

Edit: Now I can access recovery mode and login as root.

Edit 2: I don't really need to get my deleted files back, because I only had wallpapers on my account. I just want to be able to login again.

4 Answers 4

0

TestDisk and PhotoRec are good command line data recovery tools. Boot a live image in order to have a usable system to operate the recovery utilities from. Both tools are part of the testdisk package, they are in the Ubuntu repositories and can be installed with:

sudo apt-get install testdisk

More information about TestDisk, including tutorials and use cases, can be found here

Here is info covering PhotoRec, including step by step data recovery instructions.

If you're unable to repair your system you may use the live image to back up data on a separate disk or partition, reinstall the system, and then recover your data back to the fresh install.

4
  • I'm having trouble with the "boot a live image". Could you explain me how can i do that?
    – user285672
    May 29, 2014 at 22:17
  • If you meant booting the flash drive I used to install Ubuntu and then selecting "Try Ubuntu", I just did it right now. TestDisk is running, 51%
    – user285672
    May 30, 2014 at 0:59
  • This apparently didn't help much
    – user285672
    May 30, 2014 at 16:32
  • I would recommend backing up your data and doing a fresh install. I'd give PhotoRec a shot too first though.
    – Insperatus
    Jun 1, 2014 at 16:56
0

If you can login to root, recreate the /home directory.

/home (owner: root, group: root, perms: 755)
/home/user1 (owner: user1, group: user1, perms: 755)
/home/user2 (owner: user2, group: user2, perms: 755)
/home/user3 (owner: user3, group: user3, perms: 755)

etc.

3
  • Are these the commands i have to run? (I dont know how to login as root)
    – user285672
    May 29, 2014 at 22:18
  • I have no idea on where you are at. You have to give me more info. What does the screen say? Can you type anything? Do processes start up (All the text when your computer boots up normally right before it gives you the login screen) ?
    – ToddJCrane
    May 30, 2014 at 0:46
  • Okay, I reinstalled grub and then I could login as root. Right now i'm on a black screen that says 'root@computername:~# _'
    – user285672
    May 30, 2014 at 16:28
0

Try to Install extundelete, Boot with a liveCD , and go to the terminal,

  1. sudo apt-get install extundelete
  2. Command to recover sudo extundelete --restore-directory /home/Documents/ /dev/sda1

From here the Info How to recover deleted files?

Please let me know, whats happen..

1
  • 'Not using locking for read only lock file /var/lib/dpkg/lock' 'unable to write to /var/cache/apt/' 'The package lists or status file could not be parsed or opened.'
    – user285672
    May 30, 2014 at 16:21
0

If you are looking for ability to continue working with the current system rather than restoring your home directory then try:

EDIT: If you can do the next it may help: Ctrl+alt+F1 to change to the console (CLI). You might be able to log in still, do it now. Then sudo mkdir /home/$USER sudo chown $USER: /home/$USER

Should all be done now, either press Ctrl+Alt+F7 to return do GDM or reboot.

UPDATE: If you previouslt enabled root by this : sudo passwd root you can create a user by:

1) login as root

2) useradd username

3) passwd username

5
  • How do I login as root?
    – user285672
    May 29, 2014 at 22:16
  • By default, the Root account password is locked in Ubuntu. If you did not unlock it before by this sudo passwd root, then there is no way to log in like a root. May 30, 2014 at 0:57
  • However, if you can do the next it may help: ctrl+alt+F1 to change to the console (CLI). You might be able to log in still, do it now. Then sudo mkdir /home/$USER sudo chown $USER: /home/$USER Should all be done now, either press ctrl+alt+F7 to return do GDM or reboot. May 30, 2014 at 1:03
  • Ok, I just did. When tried 'useradd username' it said user 'username' already exists (I changed 'username' to my name, of course). When I tried to change the password, it said 'Authentication token manipulation error', 'password unchanged'
    – user285672
    May 30, 2014 at 16:19
  • sudo mkdir /home/$USER returned 'mkdir: cannot create directory '/home/root' : Read-only file system
    – user285672
    May 30, 2014 at 16:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .