8

I just installed Arch reading from the Beginners' Guide on the Arch Wiki. Once I rebooted Arch, I logged into root then I added my own personal account: useradd fox then passwd fox and set my password for the account. Once I logged in with fox I was prompted with the error --fox: /home/fox: change directory failed: No such file or directory. Logging in with home = "/".

Why I'm receiving this error and how I can fix it?

6

You need to tell useradd to create your home directory:

useradd -m fox

You might also want to add options for group(s) -g -G, login-shell -s etc.

But don't worry - you can create your homedir now (as root using sudo or su):

# mkdir /home/fox
# chown fox:fox /home/fox

See Arch Linux Documentation - User Management

2
  • 1
    Ah, thank you! Is it actually vital to do groups?
    – ErraticFox
    Mar 4 '14 at 13:57
  • @ErraticFox - No, I think the default for Arch is to create a group with the same name as the user, so your group is now most likely fox. For some applications it is necessary to add extra groups, like audio. Start simple and add if the need arises. You can check current group membership with either of the commands groups or id
    – grebneke
    Mar 4 '14 at 14:01
4

It's actually a SELinux issue. Not sure about Arch Linux's configuration but I encountered it when replacing my home directory with another (i.e. restoring it from a backup). You can check it yourselves with

ls -lZ /home

That prints out SELinux labels. Your home directory should have the user_home_dir_t label. The fix is straightforward:

restorecon -R /home

A longer discussion can be found in the Fedora forums.

3
  • 1
    In this specific instance, it has nothing to do with SELinux; the home directory didn’t exist at all. Jul 3 '19 at 12:18
  • In my case, exactly the fix I needed. Thank you!
    – Brian Z
    Oct 9 '20 at 23:37
  • Thank you, this was exactly my case. Mar 28 '21 at 4:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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