This question already has an answer here:

I might have moved my home folder by mistake, and now I'm stuck in a login loop. Every time I log in, the screen just flashes as if it logs in and then asks me to log in again. When pressing Ctrl+Alt+F3 and logging in it says

no directory logging in with home=/

I've looked around and it seems I've messed up the location of my home folder. But how do I fix it?

marked as duplicate by Kulfy, Zanna, karel, pomsky, Eric Carvalho Dec 29 '18 at 11:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • So I've used locate username and now typed sudo mkdir -p /home/ubuntu/ (Ubuntu is my username). Do I need to do anything else or is that it? – Mikkel Dec 18 '18 at 19:14
  • Okay, so I did it. Can't logi still but something changed cause now it logs in to a blank screen for 10 secs or so before sending me back to login again. – Mikkel Dec 18 '18 at 19:19
  • It just seemed to run through the whole system, outputting all files and their paths (if that makes sense)? Yes I did a system shutdown and tried logging in. – Mikkel Dec 18 '18 at 19:22
  • There is like several thousands of lines... – Mikkel Dec 18 '18 at 19:26
  • How will I save and upload it when I can't login? (Sorry for alle the questions) – Mikkel Dec 18 '18 at 19:29

I am hoping you have GRUB or some sort of bootloader which will make this repair easier, otherwise you will need to make repairs by mounting your filesystem on a separate system which works.

If you open grub and add systemd.unit=emergency-net.target to your command line options it will boot your system into emergency mode which should drop you into a root command prompt where you can fix any issue with your system.

If you are not worried about the old content of the directory you can just create another for your user. You can create a directory for your user automatically by running mkhomedir_helper username

  • I have a bootloader. The system is dual booted. But could you explain in more detail what to do or send a link? – Mikkel Dec 18 '18 at 19:18
  • @Mikkel I assumed you could not login to your system. If you are able to login or access the files in another way you can create the directory from your other bootable OS (assuming it is Linux). – Nowayz Dec 18 '18 at 21:32

@Kulfy suggested this link: Older thread That did it. Could login and access my folders!

Not the answer you're looking for? Browse other questions tagged or ask your own question.