I made Bad mkdir mistake, cant load desktop, please help

I am trying to add to ssd drives for storage. In the process of doing that, I tried to create a mountpoint inside my home directory. This was a mistake (or the way I did it was).

When I ram mount -a,
the desktop beneath the the terminal went black and I got a message saying something like "could not mkdir home/(redacted because its my name);Permission denied

It was late and so I just closed my computer from the terminal. This morning I went back to it and was able to log in fine. I finished hopefully adding the new disks to fstab, and ran mount -a again. I got that same error message about mkdir (although this time I just added the disks to home/ but I have no idea how to remove the previous mkdir attempt), screen when blank I tried rebooting,

I get the lofgn screen, but after accepting the password it goes back and reloads login screen. After 3 times of that, it quits.

I can tty, and when trying to log in,I get --(my name): /home/(my name): change directory failed: no such file or directory
Logging in with home = “/”
then a prompt [name /}$

How can I fix this? I know I need to undo that mkdir attempt but I don’t know how.
Edit: I am using kde, I cant provide the usual info because I cant access the computer in question.

I am sorry, but what you’re saying doesn’t make any sense at all.

  • mount does not create any directories. It only mounts filesystems (or directories) to (other) directories.

  • A failed mkdir because of permissions simply fails. It leaves no traces. But it’s either way strange that you have permissions issues under your $HOME, because you should have full write access to that. Note: I am speaking of your $HOME, not of /home. /home itself is owed by the root account, and as a regular user, you cannot create directories there.

  • Neither a failed mount nor a failed mkdir will destroy what is on your screen.

Without further information, we cannot possibly determine what you’ve done and what exactly went wrong. But a failure to login can — in this case — mean that you’ve somehow mounted something else over your home directory, or possibly even over /home itself, making your home directory invisible and/or inaccessible — missing r and x permissions — and therefore you cannot log in.

5 Likes

Remove your modification in FSTAB first, from TTY (you can simply comment in front of it # so you keep it but it is not used), reboot then and see if it changes something.

sudo nano /etc/fstab

CTRL + X to save and exit, read screen at bottom (basically press ENTER to confirm).

1 Like

Thank you, Aragorn, and Omano for the reply.
Let me try to clarify.
I attempted to create a new directory in my home directory, using mkdir, using sudo mkdir home/(myname).
This failed and that is why I get messages that say it failed.
This message is persistent though, through reboots–it is like it is trying to perform that action. and cant go further,
I cant access anything in that computer now, even through tty, because it wont let me into my home. I need to find a way to remove that mkdir command.

Use a Manjaro live USB then if you have no TTY.

1 Like

I have tty, I commented out and rebooted. it seems to be working. I’m going to reformat those disks with ext4 and see if that works. Thank you both so much!

sudo su -

This will let you become root. Then check the permissions on your home directory.

2 Likes

See @Aragorn :joy: (Not to mention there is no leading slash, nor you can create two directories like that)

Thanks, I learned that the hard way!

So is everything back to normal now? I see you marked my post as Solution, was that all?

Actually, no. Thank you for asking.
I am able to use my computer seemingly normally, but, my /home was replaced by /
I don’t know how to fix that, and it seems to have an effect on the read write permissions.

Maybe not home but $HOME. I am way out of my league here.

I made several directories to try to mount the new drives on, and they exist, but they are owned by my primary disk. So I tried to remove them but I am told I don’t have permission to do so.

It’s because the permissions on /home/user-name-here are wrong. But we don’t know what you did, because you’re not telling us.

sudo chown -R your-user-name:your-user-name /home/your-user-name && sudo chmod -R u+rwx /home/your-user-name

I swear I have told you everything I know! Anything I did that I am not telling you I don’t know that I did.

I tried that code you gave me but it says I’m missing operand after
your-user-name:your-user-name (yes I put in the actual user name).

My bad, I have corrected it now.

Thank you, I am very grateful for your help and I realize this could be frustrating to someone who knows what they are doing, to deal with someone who doesn’t.

I just completed that code, and did not receive feedback. However when I tried to move a folder to trash it still said I do not have permission to do so.

I really believe it has something to do with the message I got when I had to tty–

–(my name): /home/(my name): change directory failed: no such file or directory
> Logging in with home = “/”

So when I pull up fstab, my main disk shows it is mounted on just /
not /home. I really thought it was on /home before–wouldn’t that be normal? I did not think I had messed with the main disk at all in fstab, but is it possible I somehow deleted the home from that, and that has caused the issue?

I’m not sure what you mean by “my main disk”. Your root partition must be mounted at /, and if you created a separate partition for /home, then there will be a mountpoint for that too.

Okay, I need to see the output of the following commands, and this time, don’t be paranoid about your user name — there are probably millions of people in the world with the same name as you, and nobody here even knows who you are, nor can anyone see your IP address. :arrow_down:

lsblk -o NAME,UUID,MOUNTPOINT
cat /etc/fstab
ls -l /home
mount | grep home

I suspect that when you messed with /etc/fstab, you deleted the entry for mounting /home, and that as a result, the directory /home (which resides on the root filesystem) is now empty. As such, you don’t have a home directory and you are put in the root directory (/) upon login.

1 Like

Thank you, here you go. There was no output for the last entry.
Also backupdisk and holodeck are the two labels for the two additional storage drives I am trying to add.

>              
>    ~  lsblk -o NAME,UUID,MOUNTPOINT                                                                                               ✔ 
> NAME        UUID                                 MOUNTPOINT
> sda                                              
> ├─sda1      C48B-AD92                            /boot/efi
> ├─sda2      a4677c34-08ee-4217-a8f8-04d583d29686 /
> └─sda3      54b33f09-d1e4-45c1-85ed-60965f977595 [SWAP]
> sdb                                              
> └─sdb1      6a5350e2-e8dc-4a46-a403-15ebe0451934 
> sr0                                              
> nvme0n1                                          
> └─nvme0n1p1 d5ed23f5-617d-4972-9967-a19ada5650ad /run/media/alexandra/d5ed23f5-617d-4972-9967-a19ada5650ad
>     ~  cat /etc/fstab                                                                                                              ✔ 
> # /etc/fstab: static file system information.
> #
> # Use 'blkid' to print the universally unique identifier for a device; this may
> # be used with UUID= as a more robust way to name devices that works even if
> # disks are added and removed. See fstab(5).
> #
> # <file system>             <mount point>  <type>  <options>  <dump>  <pass>
> UUID=C48B-AD92                            /boot/efi      vfat    umask=0077 0 2
> UUID=a4677c34-08ee-4217-a8f8-04d583d29686 /              ext4    defaults,noatime 0 1
> UUID=54b33f09-d1e4-45c1-85ed-60965f977595 swap           swap    defaults,noatime 0 0
> #UUID=93b9c9a5-58d0-4d58-9e2d-7036686d401c /home ext4 ssd,defaults,noatime 0 0
> #UUID=d5ed23f5-617d-4972-9967-a19ada5650ad /home ext4 ssd,defaults,noatime 0 0
> 
>     ~  ls -l /home                                                                                                                 ✔ 
> total 12
> drwx------ 28 alexandra alexandra 4096 Sep 27 14:02 alexandra
> drwxr-xr-x  2 root      root      4096 Sep 26 14:18 backupdisk
> drwxr-xr-x  2 root      root      4096 Sep 26 14:19 holodeck
>     ~  mount | grep home                                                                                                           ✔ 
>     ~ 

Yeah, I can see a few things wrong already. :thinking:

First of all, like I said, your /home isn’t mounted. Now, you have two entries for /home in your /etc/fstab. The first one of those — the one starting with UUID=93b9... — is wrong, and the second one is the correct one.

This is the correct one… :arrow_down:

#UUID=d5ed23f5-617d-4972-9967-a19ada5650ad /home ext4 ssd,defaults,noatime 0 0

So you must remove the “#” at the front of the line and delete the other one — its UUID is not in your lsblk output, so you don’t have a filesystem with that UUID anyway.

The second thing that’s wrong is this: :arrow_down:

    ~  ls -l /home                                                                                                                 ✔ 
> total 12
> drwx------ 28 alexandra alexandra 4096 Sep 27 14:02 alexandra
> drwxr-xr-x  2 root      root      4096 Sep 26 14:18 backupdisk
> drwxr-xr-x  2 root      root      4096 Sep 26 14:19 holodeck

You created a new /home/alexandra on the root filesystem, instead of using the one on your actual /home partition (because it wasn’t mounted), and you’ve created two root-owned directories under that /home on the root filesystem as well.

Remove all of those directories in /home after you’ve first edited /etc/fstab. Then reboot.

After rebooting, you will now once again be in your normal environment. If you want to create additional mountpoints in your home directory, then do not create them as root but as yourself, and don’t attempt to put them under /home — they should go under /home/alexandra instead.

And then you can mount other filesystems to them and add those to /etc/fstab, but make sure you then specify the correct mountpoint. It should be /home/alexandra/backupdisk, and so on.


So, let’s summarize this… :arrow_down:

1. Edit /etc/fstab

Completely remove the entry that starts with UUID=93b9... and re-enable the entry that starts with UUID=d5ed23f5....

Save the file.

2. Empty the contents of /home on the root filesystem.

sudo rm -rf /home/*

3. Reboot and log in

4. Create mountpoints under your $HOME

mkdir ~/backupdisk
mkdir ~/holodeck

Don’t use sudo for this!

5. If you want to mount anything to those above two mountpoints…

… then add their records to /etc/fstab, but specify that they must be mounted to /home/alexandra/backupdisk and /home/alexandra/holodeck respectively. And if they are removable drives, be sure to add user,nofail to their mount options.

1 Like

Thank you but I have a question about that-- The first three lines of the fstab are what was there before I started destroying things. The last two uncommented lines are what I have added. --the d5ed one is a new SSD drive that I was trying to mount. All of my files, etc are on the a4677. Does that make a difference to what I should do?

I am pretty sure that the a4677 used to have /home instead of just /

Yes, it does. In that case, you should first move over your own files to the new drive before rebooting.

Mount the new drive to /mnt, like so… :arrow_down:

sudo mount -t ext4 /dev/nvme0n1p1 /mnt/
sudo mv /home/alexandra /mnt/ && sudo sync
sudo mv /home/backupdisk /mnt/alexandra/
sudo mv /home/holodeck /mnt/alexandra/
sudo mount --move /mnt /home
sudo chown -R alexandra:alexandra /home/alexandra/*

Then, edit your /etc/fstab, save the file, and reboot… :arrow_down:

sudo systemctl reboot

And cross your fingers… :crossed_fingers:

If all went well, then the two mountpoints will already exist under your $HOME and will be owned by you.