this post was submitted on 27 Feb 2024
55 points (98.2% liked)

Linux

48186 readers
1571 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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.

Previous post:

I finally installed Linux, but I'm having a mixed experience

Context:

OS: Fedora Linux 39 (KDE Plasma) x86_64
Kernel: 6.5.6-300.fc39.x86_64
DE: Plasma 5.27.8
WM: Kwin
CPU: AMD Ryzen 5 5600X
GPU: Nvidia Geforce GTX 1660

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.

I mounted it to /new_home

NAME        FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                 
└─sda1      ext4   1.0          f56df020-2420-4b0c-af4d-2c4c6a56a0b0  718.4G    16% /new_home

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.

UUID=d5877671-6a39-4d96-9a2a-514b6007a59b /                       btrfs   subvol=root,compress=zstd:1 0 0
UUID=ed92de40-2403-4365-9b5c-eb10d519757c /boot                   ext4    defaults        1 2
UUID=02E9-123A          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=d5877671-6a39-4d96-9a2a-514b6007a59b /home                   btrfs   subvol=home,compress=zstd:1 0 0
UUID=f56df020-2420-4b0c-af4d-2c4c6a56a0b0 /new_home               ext4    defaults        1 2

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.

After this I decided to swap them.

UUID=d5877671-6a39-4d96-9a2a-514b6007a59b /                       btrfs   subvol=root,compress=zstd:1 0 0
UUID=ed92de40-2403-4365-9b5c-eb10d519757c /boot                   ext4    defaults        1 2
UUID=02E9-123A          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=d5877671-6a39-4d96-9a2a-514b6007a59b /old_home                   btrfs   subvol=home,compress=zstd:1 0 0
UUID=f56df020-2420-4b0c-af4d-2c4c6a56a0b0 /home               ext4    defaults        1 2

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/

I'd like to give a big thanks to,

/u/shininghero@kbin.social; for pointing out SELinux as a possible issue.

/u/burrito@sh.itjust.works; for providing the command to fix this issue.

/u/kbal@fedia.io; for being so patient with me, and helping me go through the list of possible issues.

you are viewing a single comment's thread
view the rest of the comments
[–] shininghero@kbin.social 29 points 8 months ago* (last edited 8 months ago) (7 children)

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.

[–] Doctor_Rex@lemmy.ml 5 points 8 months ago (2 children)

ok here's the output

root@localhost-live:/home/adelie# ls -lZ
total 36
-rw-r--r--. 1 adelie adelie unconfined_u:object_r:unlabeled_t:s0    0 Feb 27 11:11 confirm.txt
drwxr-xr-x. 2 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 25 21:03 Desktop
drwxr-xr-x. 2 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 27 19:32 Documents
drwxr-xr-x. 2 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 27 10:59 Downloads
drwxr-xr-x. 5 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 26 14:15 Essentials
drwxr-xr-x. 2 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 27 10:59 Music
drwxr-xr-x. 3 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 27 11:00 Pictures
drwxr-xr-x. 2 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 27 11:00 Public
drwxr-xr-x. 2 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 27 11:00 Templates
drwxr-xr-x. 2 adelie adelie unconfined_u:object_r:unlabeled_t:s0 4096 Feb 27 11:00 Videos

[–] burrito@sh.itjust.works 30 points 8 months ago* (last edited 8 months ago) (1 children)

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.

[–] Doctor_Rex@lemmy.ml 26 points 8 months ago (1 children)
[–] burrito@sh.itjust.works 5 points 8 months ago

Awesome! Enjoy!

[–] kbal@fedia.io 5 points 8 months ago (2 children)

It's probably ls -lZd . .. you'd want there instead, but I don't know selinux.

But yeah, damn, it never would've occurred to me that you had that installed without knowing it. Glad to have a possible explanation.

[–] Doctor_Rex@lemmy.ml 3 points 8 months ago

I didn't realize I had it either, I'll see what I can do to fix it tomorrow because right now, I'm tired and hungry.

BTW, thank you for your help. Your comments and explanations have been a great in helping me understand my issue and Linux in general.

[–] Nomad@infosec.pub 1 points 8 months ago
load more comments (4 replies)