You are not logged in.

#1 2022-01-11 21:24:27

feintdoxx
Member
Registered: 2022-01-11
Posts: 8

Moved my home directory and terminal now opens with shell-init: error

I wasn't too sure how to word the subject but at title states:

I moved my home directory to a secondary internal drive. Didn't think about it when setting up the OS but I had added the 1tb for additional storage as the root drive is on the smaller side.

I followed this guide here: https://help.ubuntu.com/community/Parti … ome/Moving
with success. when I "cd ~ " or "cd " it takes me to my home directory as intended, cool.

I had made a backup of the old home @ /old_home but noticed whenever I opened terminal it would seemingly take me to the "/old_home/username" directory, so I deleted that directory.

Now whenever the terminal is first opened a receive:
" shell-init: error retrieving current directory: getcwd: cannot access partent directories: No such file or directory

I read online that adding:
cd nameofdirectory

into the .bashrc file would resolve this

so i added:

cd /media/home/username

"/media/home" being the mountpoint for the secondary drive.

and then I get the initial message +
"chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
[username@hostname username]"

and if I "cd " or "cd ~"

it will still all work properly but from what I can tell its looking to start at the original home directory which like I mentioned was trying to move and mount to the secondary drive.

I don't know if its detrimental in the long run but basically was bothering me that it wouldn't start the terminal : [username@hostname ~] but rather [username@hostname username]
how do i get the terminal to recognize the new home location as the starting point?

should I even be concerned?

Offline

#2 2022-01-11 21:36:50

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 4,875

Re: Moved my home directory and terminal now opens with shell-init: error

Is this Arch?

Just asking because the tutorial you followed is 7 years old and for Ubuntu.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Online

#3 2022-01-11 21:39:51

feintdoxx
Member
Registered: 2022-01-11
Posts: 8

Re: Moved my home directory and terminal now opens with shell-init: error

Yup on arch, and yeah.. well that's why this is in the newbie corner!
Day 2 of arch use.

edit:
if it helps i got that link from this post https://bbs.archlinux.org/viewtopic.php?id=212269

Last edited by feintdoxx (2022-01-11 21:48:16)

Offline

#4 2022-01-11 22:06:08

seth
Member
Registered: 2012-09-03
Posts: 26,570

Re: Moved my home directory and terminal now opens with shell-init: error

"/media/home" being the mountpoint for the secondary drive.
You want the mountpoint to be /home or alter the $HOME w/ eg. "usermod -d /media/home/username username"

Online

#5 2022-01-11 22:37:17

feintdoxx
Member
Registered: 2022-01-11
Posts: 8

Re: Moved my home directory and terminal now opens with shell-init: error

seth wrote:

"/media/home" being the mountpoint for the secondary drive.
You want the mountpoint to be /home or alter the $HOME w/ eg. "usermod -d /media/home/username username"


Ahhh okay okay

I understand now

So in fstab I had this earlier

uuid=thatsecondarydriveuuid      /home   ext4 defaults 0 1

and had applied the usermod command you recommended and the logged in to which I was greeted with the message that the directory didn't exist and started me off at /

went back into fstand changed it to /media/home saved and logged back in with xmonad starting up and terminal also starting as [username@hostname ~]


finally with this understanding just to please my brain I will edit it so that /home is the mount point for the drive and then modify back the usermod -d into the /home/username directory and I should be all set! Thanks.

My thought process on this was that I wanted to have files saved to the secondary drive and be able to write/execute without the need of having to use sudo unless absolutely necessary as when I was just mounting the drive through terminal I had to run sudo every time to write or execute arbitrary tasks or packages downloaded from github etc. a different topic all together. Thanks again.

EDIT; I did what I described at the end and ended up back where I started so im just going to do what you had suggested and where I got working after following your steps and leave it at that haha

Last edited by feintdoxx (2022-01-11 22:45:16)

Offline

#6 2022-01-12 07:28:46

seth
Member
Registered: 2012-09-03
Posts: 26,570

Re: Moved my home directory and terminal now opens with shell-init: error

I had to run sudo every time to write or execute arbitrary tasks or packages downloaded from github etc. a different topic all together.

Suggests that the permissions of $HOME are off - either because you mounted the new partition into the wrong location or you made a mistake when copying your $HOME

Please post the outputs of

stat $HOME
lsblk -f
cat /etc/fstab
mount

Online

#7 2022-01-13 22:26:36

feintdoxx
Member
Registered: 2022-01-11
Posts: 8

Re: Moved my home directory and terminal now opens with shell-init: error

seth wrote:

I had to run sudo every time to write or execute arbitrary tasks or packages downloaded from github etc. a different topic all together.

Suggests that the permissions of $HOME are off - either because you mounted the new partition into the wrong location or you made a mistake when copying your $HOME

Please post the outputs of

stat $HOME
lsblk -f
cat /etc/fstab
mount
[feintdoxx@ElJuan ~]$ stat $HOME
  File: /media/home/feintdoxx
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 8,1     Inode: 31719425    Links: 20
Access: (0700/drwx------)  Uid: ( 1000/feintdoxx)   Gid: ( 1000/feintdoxx)
Access: 2022-01-13 16:08:15.607947133 -0600
Modify: 2022-01-13 16:18:50.441266765 -0600
Change: 2022-01-13 16:18:50.441266765 -0600
 Birth: 2022-01-11 06:16:17.809254026 -0600
[feintdoxx@ElJuan ~]$ lsblk -f
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
└─sda1 ext4   1.0         439ed55d-eeec-4833-b0b4-b3697f8e8582  860.2G     1% /media/home
sdb
├─sdb1 ext4   1.0         5f636fdf-a4cb-4c40-bfda-8fdaea529a55   96.7G     6% /
└─sdb2 swap   1           693f51ce-59c2-431e-a398-90ea70641870                [SWAP]
[feintdoxx@ElJuan ~]$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sdb1
UUID=5f636fdf-a4cb-4c40-bfda-8fdaea529a55       /               ext4            rw,relatime     0 1

# /dev/sdb2
UUID=693f51ce-59c2-431e-a398-90ea70641870       none            swap            defaults        0 0

# /dev/sda1
UUID=439ed55d-eeec-4833-b0b4-b3697f8e8582       /media/home             ext4            defaults        0 1
[feintdoxx@ElJuan ~]$ mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=16443548k,nr_inodes=4110887,mode=755,inode64)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
/dev/sdb1 on / type ext4 (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=14133)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,nr_inodes=1048576,inode64)
/dev/sda1 on /media/home type ext4 (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=3290780k,nr_inodes=822695,mode=700,uid=1000,gid=1000,inode64)

I did not mean however that I needed to sudo to read/write/execute in my own home folder (or even after moving it) but rather the secondary drive itself when I was mounting it to persay /media/xname using the mount command without adding it to fstab.

Offline

#8 2022-01-14 08:18:47

seth
Member
Registered: 2012-09-03
Posts: 26,570

Re: Moved my home directory and terminal now opens with shell-init: error

using the mount command without adding it to fstab

Ok, that unsruprisingly requires root permissions.

You currently mount the /dev/sda1 to /media/home and your $HOME directs there.
That's a bit uncommon but not a problem in and by itself.

Changing fstab to

…
# /dev/sda1
UUID=439ed55d-eeec-4833-b0b4-b3697f8e8582       /home             ext4            defaults        0 1

and

usermod -d /home/feintdoxx feintdoxx

should™ get you back to normal - you probably want to do that as root (from a console login) since esp. the big DEs tend to freak out if there's no valid $HOME for the active user.

Online

Board footer

Powered by FluxBB