Sddm wont load desktop after migrate /home to a new ext4 partition

i tried to delete my user and recreate using “useradd” when mounting the new /home partition (on another machine).

strace

tty3

tty4

this part is extremely confusing for me.

strace-gohome.out

https://paste.opensuse.org/pastes/4bb30be5052a

It’s a permissions problem. More specifically, an ACL is set. If you remove any ACL from /home and/or your homedir it will probably work again.

Look at setfacl

2120  chdir("/home/brucekomike")        = -1 EACCES (Permission denied)
2120  write(2, " -- brucekomike: ", 17) = 17
2120  write(2, "/home/brucekomike: change direct"..., 42) = 42
2120  write(2, ": Permission denied\n", 20) = 20
2120  chdir("/")                        = 0
2120  write(1, "Logging in with home = \"/\".\n", 28) = 28
...
2120  execve("/bin/bash", ["-bash"], 0x5623b1d69b40 /* 15 vars */) = 0
...
2120  chdir("/home/brucekomike")        = 0

The first chdir is performed by login, not bash. Executing bash likely changes SELinux label (process domain). Which may explain what happens.

The lack of SELinux denials is not conclusive - a lot of denials are hidden because they happen too often.

Try

restorecon -vr /home
1 Like

As a summary

instructions for migrating a partition (/home in this example)

  1. create the conrresponding partition. (such as /dev/sdb1)

  2. mount the new partition to a mount point. (/mnt/opt)

  3. using rsync to copy files
    rsync -avz /home/ /mnt/opt (run as root)`

  4. umount the original /home volume and replace it with the new volume.
    umount /home
    umount /mnt/opt
    mount /dev/sdb1 /home

  5. fix the hidden permission issue (idk how to give it a proper naming)
    restorecon -vr /home

That is wrong (for a generic instruction). SELinux labels are attached to files. restorecon only changes labels for files explicitly listed in the SELinux policy. SELinux policy does not (and cannot) enumerate every file in a user’s home directory and users are free to set an arbitrary labels.

On a SELinux enabled system you should be using SELinux aware tools to copy, archive or restore files. For rsync it means using -X to preserve extended attributes.

1 Like

And changing /etc/fstab to fix the new situation for next boots?

i have no SELinux experience, but i can break my solution into sections.

Corrections are welcome, but I have a little confidence that this would be enough.

All commands excuted as root.

preparation for partiions

  • fdisk
  • mkfs.ext4

preparation for data migration

  • mkdir /mnt/opt
  • mount /dev/sdb1 /mnt/opt

data migration

since i’ve already fixed the login issue. i have no motivation to test the result of this command

  • rsync -avzX /home/ /mnt/opt (may let you skip that reparation step, not tested)
    or
  • rsync -avz /home/ /mnt/opt

fstab config

  • lsblk -f | grep sdb1 >> /dev/fstab
  • then edit fstab
    • UUID=<UUID> /home ext4 defaults 0 2

post configs

without reboot

  • log out any gui
  • switch to tty (might be tty3 ctrl alt F3)
  • login as root
  • systemctl stop <Desktop Manager> (sddm or gdm AFAK)
  • replace the home partition
    • umount /home
    • mount /home (assuming the fstab is already set)
  • then follow the next section, since these command are same for both options.

after a reboot

  • restorecon -vr /home (if the permission issue exists)
  • systemctl restart <DM>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.