[SOLVED] I can't change my /home location, and it's driving me mad
For the past week, I've been trying to switch my /home partition from my 500GB nvme to my 1TB sata ssd. I've been asking and receiving help from people in my previous post, but I keep hitting wall after wall in making it work and I seem to be missing a step.
Big thank you to @pixelscript@lemmy.ml, @NateSwift@beehaw.org, for replying to my comments and helping me along.
I have a 500GB nvme which I want to have my entire / stored within. And I have a 1TB sata ssd which I want to have my /home to be stored in. I've tried many of the steps some helpful people here on lemmy have detailed, and though it's gotten me closer to getting it right, but I still can't seem to login when I switch my fstab.
Allow me to go through every step I've done so far.
I reinstalled fedora, hoping I could separate my /home in the installer. No such luck, anytime I switched my /home partition into the 1TB drive my entire root directory would follow it. I decided to do the auto install on my nvme and do it manually when it's fully installed.
So just to be clear I am starting from a clean install nothing except neofetch and vim installed.
I created two new directories directly in /. They were /new_home and /old_home.
I formatted my 1TB disk, partitioned it, and then formatted the partition into an ext4, 931.5 G partition.
From here I ran the command
sudo rsync -a /home/adelie/new_home. this is why the current available space is 718.4G. I also added a new file to /new_home called confirm.txt in order to tell which was which at a glance.
I check the permissions and ownership of both /home and /new_home with ls -la they were identical.
adelie@localhost-live:/new_home$ ls -la /new_home
total 8
drwxr-xr-x. 3 root root 4096 Feb 27 11:06 .
dr-xr-xr-x. 1 root root 204 Feb 25 21:13 ..
drwx------. 15 adelie adelie 4096 Feb 27 11:11 adelie
adelie@localhost-live:/new_home$ ls -la /home
total 0
drwxr-xr-x. 1 root root 12 Feb 25 21:01 .
dr-xr-xr-x. 1 root root 204 Feb 25 21:13 ..
drwx------. 1 adelie adelie 348 Feb 27 11:25 adelie
adelie@localhost-live:/new_home$
The story is the same inside the $USER files, the files and directories are identical and so are there permissions and ownership.
I added /dev/sda1 to fstab to auto boot both drives.
At this point I haven't changed the boot path for /home yet.
When I rebooted, everything worked as expected. When I entered the KDE login screen it let me go into my desktop when I inputted my password correctly.
When I entered into the KDE login screen, anytime I inputted my password correctly it would kick me back to the login screen within the second. At this point I assumed it was a KDE issue and that I was missing a step in order to login correctly.
I read a comment explaining TTY, and that I should try logging in from there to confirm if it was a KDE issue or not. When I tried it I ended up with this.
Fedora Linux 39 (KDE Plasma)
Kernel 6.5.6-300.fc39.x86_64 on an x86_64 (tty3)
Localhost-live login: adelie
Password:
Last login: Tue Feb 27 xx:xx:xx on tty3
-- adelie: /home/adelie: change directory failed: Permission denied
Logging in with home = "/".
From my root account I checked /home and /old_home, and /home contained confirm.txt, meaning that everything mounted properly, I then changed the fstab back to what is was originally.
This is where I'm at now.
I'm totally lost on what step I missed. I'd like to get this working in order to actually be able to use my computer, as I am committed to changing my /home directory before making any major changes or installs. If anybody has any idea on what I missed please feel free to pitch in.
*Update: The issue was SELinux. My SELinux contexts were bad and were denying me access to my own data. I reset the context with this command,restorecon -Rv /home/
Fedora Linux also comes with SELinux enabled by default. Did you check that the new home folder and all its contents have the proper SELinux tags?
Run an ls -lZ and check that the directory has the user_home_t tag,
The user's home directory is also stored in the /etc/passwd file. Did you update the entry there?
No, do not "disable SELinux". That advice hasn't been valid for a good 20 years. You can set it to permissive though, to see if it's the source of the problem.
Here's your issue. Your selinux contexts are bad so you're probably being denied access to your own data. To reset the contexts back to normal you can use the restorecon command:
restorecon -Rv /home/
The -R tells it to go through the specified path recursively, the v tells it to be verbose in the output and show you what it's doing.
This is a shot in the dark, but since the permissions look fine to me, the only other thing that comes to mind is that the SELinux contexts might not have been copied. Fedora is one of the few distros that enables SELinux in enforcing mode right out of the box. That can be very complex to understand if it breaks.
There is a Fedora documentation page about SELinux. The /var/log/audit/audit.log log file should be full of errors relating to your /home if it broke. I believe that stat /home and stat /new_home should display the SELinux context if SELinux is active, and they should be identical.
Also possible I'm totally off the mark, though, it's just a possibility.
I went into /audit.log you asked, I'm gonna be honest as a total linux newbie I have no idea what im looking at . I don't really know what's supposed to be an error and what's irrelevent. This is the only thing that stick out to me
Permissions on /home mount point (before mounting device to mountpoint):
$ ls -la /home
total 0
drwxr-xr-x. 1 root root 0 Jan 5 20:47 .
dr-xr-xr-x. 1 root root 166 Feb 27 18:36 ..
$ sudo getfacl home
# file: home
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
Relevant output from df
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 998540288 5447260 991484436 1% /
/dev/nvme0n1p6 1248619684 932769256 258218276 79% /home
Home dir permissions
$ ls -ldZ /home/mes
drwxr-xr-x. 196 mes mes system_u:object_r:user_home_dir_t:s0 12288 Feb 27 19:13 /home/mes
$ sudo getfacl /home/mes
getfacl: Removing leading '/' from absolute path names
# file: home/mes
# owner: mes
# group: mes
user::rwx
group::r-x
other::r-x
I've done this several times and yes I can confirm everything mounted properly. The only issue as far as I can tell is that I can't login. I made an edit on the post to clarify this.
I allways symlink(ln -s) some folders from my HDD(Pictures, Movies, Documents, Music) since i dont want to have all my home folder on my slow HDD. May this is an Option for you.
Did you try logging into your root user account? That will allow you to see current mount points.
Maybe something went wrong with mounting the new volume to /home. Maybe the Btrfs @home volume doesn't like being mounted anywhere else but /home. TBH I don't think it's the latter, but you can't troubleshoot unless you login. And you have to login as root, as the home path for root is /root, therefore immune to your conundrum.
I've entered into my root account to check the mount points and yes I can confrim everything mounted properly. I simply can't login, as far as I can tell. I've made an edit on the post to clarify this.
Using the BTRFS file system while swapping mount points around may be the issue. It looks like you don't have permission to access the new folders even thought you think you should. BTRFS can be strict/inflexible around ownership rules - when you swap the mount points around in fstab, the ownership in BTRFS may no longer map properly with the users for ownership in Linux. You need to take ownership of the files again via Linux commands.
As others have said try using the chown command (change ownership) with the - r flag (recursive so it goes into every subfolder) so that the user adelie owns everything again in your newly mounted /home/adelie folder. You need to do this after you've made the fstab change (I.e once you can't log in) so that it maps properly with adelie in the new set up. Either use sudo to run chown when logged in as adelie in tty or log in as root and run chown.
It looks like you can't log in graphically because KDE doesn't have permission to even read any of the file in your new home directory so KDE can't read any of its config files. It inherits the permission from the linux user adelie. When you log in with tty, you can't even enter the folder as adelie as you don't even have permission to read the folders, and you get thrown back to the root file system /.
I didn't know users had id numbers, any way to check my current one. I've changed fstab to what is was originally since then. I've made an edit to clarify this.