0

Whenever I open the terminal I'm Ubuntu 18.04

To run a command as administrator (user "root"), use "sudo <command>".  
See "man sudo_root" for details. 

After that, I can't get into any of my data in all folder such as download, document. Then I restart, sign in but it come back to sign in again.

Is all started when I want to install android studio by using this line, something like sudo mv ~ /Download/android-studio usr/local/.

Right now, I had just press Cntrl + Alt + F3, log in, and found this,

No directory, logging in with HOME=/
To run a command as administrator (user "root"), use "sudo <command>". 
See "man sudo_root" for details. 
syafiq@asus-n45sf:/$ 
muru
  • 197,895
  • 55
  • 485
  • 740
  • 1
    You mean you are in an endless log-in loop now after you ran some command using sudo from the command line? What sudo command did you run? – WinEunuuchs2Unix Jun 10 '18 at 20:42
  • 1
    @WinEunuuchs2Unix I got endless log in loop after restart my laptop, before restart I did run sudo apt-get update after that command (in the question above). – Syafiq Firdaus Jun 10 '18 at 20:50
  • 2
    Did you perhaps accidentally move everything in your home directory (including the .sudo_as_admin_successful file) to somewhere else? – steeldriver Jun 10 '18 at 21:13
  • Is that a typo or did you put a space after ~ in the actual command? – mchid Jun 10 '18 at 21:15
  • @steeldriver I don't remember – Syafiq Firdaus Jun 10 '18 at 21:17
  • @mchid I am not sure I think I put a space – Syafiq Firdaus Jun 10 '18 at 21:18
  • @steeldriver It looks like you are correct. – mchid Jun 10 '18 at 21:20
  • Can you login as a guest? If in 18.04 they removed the guest account can you sign in as a new user? That should create a new home directory. – WinEunuuchs2Unix Jun 10 '18 at 21:23
  • @WinEunuuchs2Unix login new user could possibly erased my old data? try look my updated progress in question, any idea that can solved from there? – Syafiq Firdaus Jun 10 '18 at 21:30
  • No logging in as a new user won't erase anything. It will give you a clean fresh desktop and let you use GUI tools like nautilus to explore your data files. – WinEunuuchs2Unix Jun 10 '18 at 22:22
  • @WinEunuuchs2Unix I am already login as new testing user, trying install nautilus from https://askubuntu.com/questions/156998/how-do-i-start-nautilus-as-root but failed, kept getting 'testing is not in the sudoers file. This incident will be reported'. When I try 'pkexec nautilus', I had to sign in as older user, and I get ' Unable to init server: Could not connect: Connection refused'. – Syafiq Firdaus Jun 11 '18 at 19:57
  • @WinEunuuchs2Unix in https://askubuntu.com/questions/223501/ubuntu-gets-stuck-in-a-login-loop someone said ' If you can log in as testing then your unity/gnome configuration is borked and should be reset'. Scary. – Syafiq Firdaus Jun 11 '18 at 20:30

1 Answers1

1

You installed 18.04 on your hard drive, right? So, go back to the live system (on USB?), use the live system to start your system, sudo su in and now mount the hard drive partition with your home directory (recommended to /mnt). The message says, your home directory has not been found, so the system has been forced to use / as your home directory as fallback. The reason is most likely the mv command you mention. Since you've put the space between the ~ and the rest, you moved your users home directory (or more likely the content of it) to the folder /Download/android-studio usr/local/. Using root in your live system, go to this folder, take a look at the content and try to recover your users home directory. You might want to make sure, you don't miss any hidden dot-files. You need to move the moved files back to where they came from. Once done correctly, you should be able to reboot, start with your installed system, login as user and sudo. Starting with the live system and mounting to /mnt, don't forget to go to /mnt/home, not /home.

Neobie
  • 151
  • Nope, I upgraded it from 17.04, any alternative ideas? Such as any commands that I can type. – Syafiq Firdaus Jun 11 '18 at 18:32
  • Doesn't make any difference. I just thought you might still have your USB live system from your installation. Otherwise, you can use the one from 17.04 too. The live system should be a running system without major error and you can easily sudo su to use the root account to access your hard disk. If you still have the live system from your installation, you can use it. Otherwise the suggestion is, to create a new one. You just need some reliable solution to access the hard disk and data for recovery. The live system is an according option. – Neobie Jun 11 '18 at 18:48
  • Sorry, I quite lost right now, about live system, creating new one, I need to download ubuntu desktop again and install? What is reliable solution to access the hard disk and data for recovery? Can you give instruction step by step from A - Z? Much appreciated. Thanks. – Syafiq Firdaus Jun 12 '18 at 14:49
  • 1
    @Neobie provided quite good step-by-step instructions. If you do not understand the steps, then backup your data and reinstall. – user535733 Jun 13 '18 at 03:14
  • You said you did install Ubuntu 17.04. You usually do this by use of a USB thumb drive, that contains a so called live system and you install from there. So, if you don't have the original one, as you said, you need to download Ubuntu again. You don't need to install it on your hard drive again. You just need to create the live system on a USB thumb drive. Depending on your operating system, you do that by use of some application like USB installer or unetbootin. Once the live system is on your USB thumb drive, you can start your laptop from this live system on your USB thumb drive and ... – Neobie Jun 13 '18 at 14:23
  • ... use the live system like you would use a normal system to remove the problem. In this case it means, you need to move the data you accidentally moved, back to where it belongs. To do so, you need to access/mount the hard disk (mount /dev/sdaX /mnt) where your system is installed. To be able to do so, you need to have administrative permission rights (be root). Which is done by sudo su. So, download Ubuntu, create the live system with an according app like USB installer, start the live system on your laptop, open a terminal, sudo su, mount the hard drive, move the data back where it belongs – Neobie Jun 13 '18 at 14:26