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 Answers4

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

  • How do I login as root? – user285672 May 29 '14 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. – Ruslan Gerasimov May 30 '14 at 00: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.

    – Ruslan Gerasimov May 30 '14 at 01: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 '14 at 16:19
  • sudo mkdir /home/$USER returned 'mkdir: cannot create directory '/home/root' : Read-only file system – user285672 May 30 '14 at 16:25
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.

Insperatus
  • 4,693
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.

ToddJCrane
  • 101
  • 5
  • Are these the commands i have to run? (I dont know how to login as root) – user285672 May 29 '14 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 '14 at 00: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 '14 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..

Aby
  • 873
  • 1
  • 10
  • 23
  • '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 '14 at 16:21