Announcement

Collapse
No announcement yet.

Unable to properly mount /home Partition to /home Directory

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unable to properly mount /home Partition to /home Directory

    I recently did a Kubuntu-20.04 x64 LTS, clean install on my Dell-Vostro-3568, i3-6006U, 4GB-RAM. During the installation process, I selected my previous Home partition (from Kubntu-18.04LTS) to be used as the new Home partition and selected "/home" as the mount point (during installation).

    So far so good, everything seems to work fine and the home partition is correctly mounted on the "/home" directory. However there is one problem. During installation the system creted a home for my "/home/mohit". And thus, now the linux home parition also has one more partition for my username and it is currently showing in the /home/mohit.

    So the problem is that I have got two homes now. The one that is created by the installation process and the one that I selected to be mounted under /home.

    I tried to fix this problem by editing the /etc/fstab file and instead of mounting home partition under /home I selected it to be mounted under /home/mohit but that is causing the system to freeze on the login prompt. And I had to drop to the root shell to undo my changes.

    Also while doing all this my system now starts to give this additional error some pcie severity corrected error, something like that, however it is not a big problem I will tackle it myself.

    The main problem is how to correctly mount the previous partition so that my system has only one home for my username "mohit". I also deleted all the previous hidden / configuration files and system files from the /home partition and only kept my documents and other stuff as those files contained some settings that was causing problem in my previous install of 18.04LTS. I hope deleting those file didn't caused this problem.

    NOTE: My linux knowlege is Intermediate, so any instructions you tell, I guess I can manage to follow along.

    Thanks in advance

    #2
    Your information is conflicting. If you selected an existing partition to be mounted as "/home" during install, the installer would not make yet a third partition without being instructed to do so. It's just not possible. Accurate information is going to be needed before any advice can be given.

    Open a Konsole window, type these commands one at a time, and post the results from each one:

    ls /home

    cat /etc/fstab

    lsblk

    cat /etc/mtab

    Please Read Me

    Comment


      #3
      Originally posted by oshunluvr View Post
      Your information is conflicting. If you selected an existing partition to be mounted as "/home" during install, the installer would not make yet a third partition without being instructed to do so.
      Exactly this is what I was thinking. I did the same when I upgraded from 16.4 to 18.4 and didn't face any problems. Well this time I deleted the configuration files (files and folder with dot) from my home partition as these contained some settings from 16.4 too. Could this be the cause of the problem?? I'm not sure what caused the system to create a new Home for User Mohit.

      Anyways below is the output from the files that you asked for:
      The text was becoming unreadable if I paste the text directly so I pasted the images instead

      Comment


        #4
        Pasting the images didn't work :-)

        mohit@dell3568:~$ cat /etc/mtab

        sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
        proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
        udev /dev devtmpfs rw,nosuid,noexec,relatime,size=1837908k,nr_inodes= 459477,mode=755 0 0
        devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode= 000 0 0
        tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=376208k,mode= 755 0 0
        /dev/sda7 / ext4 rw,relatime,errors=remount-ro 0 0
        securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
        tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
        tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
        tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
        cgroup2 /sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
        cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0
        pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
        efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0
        none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
        cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
        cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
        cgroup /sys/fs/cgroup/rdma cgroup rw,nosuid,nodev,noexec,relatime,rdma 0 0
        cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
        cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
        cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
        cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
        cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
        cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
        cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
        cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
        systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxp roto=5,direct,pipe_ino=14324 0 0
        mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
        hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0
        debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0
        tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0
        fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0
        configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0
        /dev/sda2 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,ioc harset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
        /dev/sda6 /home ext4 rw,relatime 0 0
        tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=376204k,mode=700,uid =1000,gid=1000 0 0

        mohit@dell3568:~$ lsblk
        NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
        sda 8:0 0 931.5G 0 disk
        ├─sda1 8:1 0 529M 0 part
        ├─sda2 8:2 0 100M 0 part /boot/efi
        ├─sda3 8:3 0 16M 0 part
        ├─sda4 8:4 0 375.4G 0 part
        ├─sda5 8:5 0 480G 0 part
        ├─sda6 8:6 0 35.5G 0 part /home
        ├─sda7 8:7 0 32G 0 part /
        └─sda8 8:8 0 8G 0 part [SWAP]
        sr0 11:0 1 1024M 0 rom

        mohit@dell3568:~$ 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).
        #----------------------------------------------------------------------------------------------------------------------------------------------
        # DEVICE MOUNT-POINT FS-TYPE OPTIONS BACKUP-OPS FS-CHECK-ORDER
        #----------------------------------------------------------------------------------------------------------------------------------------------
        # / was on /dev/sda7 during installation
        UUID=d4c8dcca-0689-49ff-aabb-b23ee9566b0f / ext4 errors=remount-ro 0 1

        # /boot/efi was on /dev/sda2 during installation
        UUID=6871-6B41 /boot/efi vfat umask=0077 0 1

        # /home was on /dev/sda6 during installation
        UUID=6c34f794-1b39-45cd-83f0-a5ec34eeda2c /home ext4 defaults 0 2

        # swap was on /dev/sda8 during installation
        UUID=74610dc2-7ce0-4e9b-85d8-4b7cacd53411 none swap sw 0 0
        #----------------------------------------------------------------------------------------------------------------------------------------------

        mohit@dell3568:~$ ls /home
        AllTextFiles.zip dotProfile.bak JetBrains.png PhpstormProjects UnderstandingRecursiveMethod.ods
        bash_history_backup Downloads Learning_Linux Pictures Unity3dProjects
        bin dwhelper LOGIC_DIAG Projects Videos
        build eclipse-workspace lost+found queenNEW.png 'VirtualBox VMs'
        C-Direct-Compiled eclipse-workspace-1 MCA RcloneGoogleDrive _-_-_-_VisualStudioCODE_Playground
        config_DOT_dpkg-new.bak eclipse-workspace2 mohit RiderProjects VSCODE_NEW_INSTALL
        Desktop eclipse-workspace.bak Music sandboxArea _VSCodeNew_Palyground
        diskUsageHome.txt Emulation MyInstalledApps sandboxArea2 w3schools
        Documents fstab.bak NotesIMP.txt Screenshot_20190503_200513.png Z-Backups
        dotBashAliases.bak GitProjects obj simplePS1.txt
        dotBashHistory.bak ioFilesJava opt snap
        dotBashRc.bak javaplayground optional_apps Templates

        Comment


          #5
          As can be seen in the
          ls /home
          it also contain "mohit" named directory as /home/mohit apart from my previous files and folders.

          Comment


            #6
            OK all of that looks OK except all those file that are in /home should be in /home/mohit. There should be nothing in /home except the mohit folder.

            In Konsole again, type

            echo $HOME

            it should return

            /home/mohit

            if it does not, then type

            cat /etc/passwd |grep mohit

            this should return something like:

            mohit:x:1000:1000:mohit,,,:/home/mohit:/bin/bash


            If the first command did not return /home/mohit then likely the second command will show /home instead of /home/mohit. In that case, do this command:

            usermod --home /home/mohit mohit

            Then log out and back in. Then clean up those files.

            Please Read Me

            Comment


              #7
              I in fact thought to actually mention it in my previous post that running "echo $HOME" prints /home/mohit and not /home.

              Comment


                #8
                I also think, this problem is a result of me deleting hidden files from my previous home directory. I should have not deleted those files I guess the operating system reads those files when we select a different partition as a home directory.

                Comment


                  #9
                  Running the usermod command as you mentioned gave the output as
                  mohit@dell3568:~$ usermod --home /home/mohit mohit
                  usermod: no changes
                  mohit@dell3568:~$

                  This is because the $HOME variable is correctly linked to /home/mohit as running echo $HOME prints /home/mohit and not /home.

                  Is there anything else I can do?

                  Comment


                    #10
                    Try copying all the files and folders (except mohit/ :·) to mohit/ .
                    If it works - it should - you can then delete them from /home/

                    Comment


                      #11
                      Alright so I finally solved it. Here is what I did.

                      1) Dropped to root shell using recovery mode during boot .

                      2) Removed /home/mohit recursively

                      3) Created a folder mohit in home partition

                      4) Moved all files to this folder

                      5) Used bashrc profile bash_history and bash_aliases from my backup and restored those files directly to the mohit folder.

                      6) Saved all work and restarted the computer

                      7) After freezing on the login screen for about 2 mins the system booted correctly with all my files in place and everything seems to work as it should be.

                      I guess the system created necessary files when it seemed stuck during login screen.

                      Thanks everyone for solving the problem..

                      This is the main reason why I love Linux. The OS and the community, both are awesome.

                      Thanks again.. ;-)

                      Comment


                        #12
                        Glad you figured out and thanks for reporting back your solution.

                        Please Read Me

                        Comment


                          #13
                          @mohittomar13,
                          Mounting a /home partition and having a place for your user's files are two different things.
                          Every normal user in Linux is supposed to have their personal space in a sub-directory of /home.
                          That is because Linux is by design a system that allows multiple users.

                          So never try to mount your /home partition on a sub-directory under /home like you did.
                          /home is just a filing cabinet to hold the personal spaces of all normal users of your system, on most home-use systems this only contains one sub-directory with the username/login-name of the user.
                          Well thats all for now, 3M

                          Comment

                          Working...
                          X