LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Cannot mount unencrypted directory to encrypted home directory with fstab? (https://www.linuxquestions.org/questions/ubuntu-63/cannot-mount-unencrypted-directory-to-encrypted-home-directory-with-fstab-828603/)

Daravon 08-26-2010 08:06 AM

Cannot mount unencrypted directory to encrypted home directory with fstab?
 
I have Ubuntu Karmic. I chose to install with an encrypted home directory.

Recently I got a warning that I only had 2GB of drive space left. This is mostly because of my videos. So I went and bought a new hard drive and partitioned it and made 1 ext4 partition and copied my videos all to the new hard drive.

I added a line in my fstab to mount the new hard drive to ~/videos, but when I reboot the computer, there is a screen saying something like "error mounting /home/me/videos, press S to skip or something else to reboot".

If I press S to skip, then when my system comes up there is a video directory but it's empty because my other hard drive didn't get mounted. I can run sudo mount /dev/sdb video/ and it will mount fine and I can see all my videos, so why can't fstab mount it? Does this have something to do with my encrypted home directory?

tredegar 08-26-2010 12:45 PM

Quote:

Does this have something to do with my encrypted home directory?
I am guessing that your home directory doesn't get unencrypted until you login.
So fstab can't mount the drive as the mountpoint does not exist because it has not been unencrypted yet.

You could mount the drive somewhere else eg /videos because that mountpoint will exist when fstab is doing its thing, and then make a link to it from your home directory.

Daravon 08-26-2010 12:59 PM

So it DOES have to do with my encryption. LAME! I knew that was bound to complicate something. I really wanted to be able to mount the new hard drive to /videos because I have a HTPC that shares that directory and scripts that reference it and everything. I was going to have fstab mount it to ~/videos and everything would be seamless. If I had LVM I could just add this HDD to the volume, but I don't know if you can LVM with encryption either...

Plus it's going to be more annoying than a thousand suns to not be able to see any of my videos from my home directory. I rip and encode DVDs and everything, and having to use a /videos will be so lame. Is there any way to put the mount command in a script that runs after I log in at least?

tredegar 08-26-2010 04:46 PM

Quote:

So it DOES have to do with my encryption. LAME!
Quote:

I rip and encode DVDs and everything, and having to use a /videos will be so lame.
Please stop ranting about how "lame" you see it as.

The answer is in my previous post: Mount the drive somewhere that is not encrypted, then make a link from your (encrypted) home directory to the (valid) mountpoint.

Problem solved.

If you don't know how to do that, or can't work it out for yourself, then please post here again :)

tommcd 08-26-2010 05:14 PM

Quote:

Originally Posted by Daravon (Post 4078716)
Plus it's going to be more annoying than a thousand suns to not be able to see any of my videos from my home directory. I rip and encode DVDs and everything, and having to use a /videos will be so lame.

I have all my data including music and videos in my /data directory on a second hard drive. I can access it all just fine. So, just change the mount point to /videos, or /media/videos if you prefer. As Tredgear said, you can make a symlink to your home directory:
Code:

cd ~
ln -s /media/videos .

Note the period "." at the end of that command. This will create a videos link in your home directory you can click on to access the videos.

Daravon 08-27-2010 02:37 PM

Quote:

The answer is in my previous post: Mount the drive somewhere that is not encrypted, then make a link from your (encrypted) home directory to the (valid) mountpoint.
Wow! That's a great idea. I think that would work-around my problem perfectly. I shall implement this workaround hastily upon my arrival at home from work, and live happily ever after for great justice.

tredegar 08-27-2010 03:52 PM

Quote:

I think that would work-around my problem perfectly.
It's not really a "work-around": it is how linux is supposed to work. You can mount anything anywhere, and then beautify it with links, so it looks and works the way you'd like it to.

Please let us know how you get on....

Daravon 08-27-2010 05:30 PM

Not well at all! Now I can't mount the directory, even by hand. It does this no matter where I try to mount it. And putting it in my fstab doesn't work either, probably for the same reason. I googled the error message, and lots of people said it was caused by evms, but it doesn't even look like I have any evms package installed, and there are no evms configs in /etc. I'm really stumped.

Code:

chaz@brutus:~$ sudo fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2d3b2d3b

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              1      121601  976760001  83  Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009b08c

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1        1305    10482381  82  Linux swap / Solaris
/dev/sdb2  *        1306        2610    10482412+  83  Linux
/dev/sdb3            2611        3915    10482412+  83  Linux
/dev/sdb4            3916      121601  945312795  83  Linux
chaz@brutus:~$ umount /dev/sda1
umount: /dev/sda1 is not mounted (according to mtab)
chaz@brutus:~$ lsof video/
chaz@brutus:~$
chaz@brutus:~$ sudo mount /dev/sda1 video/
mount: /dev/sda1 already mounted or video/ busy
chaz@brutus:~$

chaz@brutus:~$ sudo apt-get remove evms
Reading package lists... Done
Building dependency tree     
Reading state information... Done
E: Couldn't find package evms
chaz@brutus:~$ ls /etc/ | grep evms
chaz@brutus:~$


Kenny_Strawn 08-27-2010 06:21 PM

I see your problem:

First of all/ there is no directory ~/video. It's ~/Videos, with a capital V. Try mounting with a capital V and see if that does it.

Code:

sudo mount -t ext4 /dev/sda1 Videos/

Daravon 08-27-2010 07:10 PM

Quote:

First of all/ there is no directory ~/video. It's ~/Videos, with a capital V
Orly?

On my system there's no ~/Videos. There is a directory ~/video. I created it. I appreciate the idea but I get the mount error no matter where I attempt to mount /dev/sda1...even if I create a new directory and try to mount it there.

tommcd 08-27-2010 08:15 PM

Post the output of this command:
Code:

sudo mount -t auto /dev/sda1 /mnt
You can replace "auto" with the file system of /dev/sda1 (e.g., ext3 or ext4) if you wish.
This of course assumes that you currently have nothing mounted in /mnt. If you do, then just create a new directory under /mnt or /media or where ever.

Daravon 08-28-2010 07:06 AM

Code:

chaz@brutus:/$ cd mnt/
chaz@brutus:/mnt$ ls
chaz@brutus:/mnt$ cd ..
chaz@brutus:/$ ls
bin    dev  initrd.img      lib32        media        proc  selinux  tmp  vmlinuz
boot  etc  initrd.img.old  lib64        mnt        root  srv      usr  vmlinuz.old
cdrom  home  lib            lost+found  opt        sbin  sys      var
chaz@brutus:/$ sudo mount -t auto /dev/sda1 /mnt
[sudo] password for chaz:
mount: /dev/sda1 already mounted or /mnt busy
chaz@brutus:/$

Does it matter that I'm doing this with ssh? I never mattered before.

tredegar 08-28-2010 07:45 AM

Quote:

mount: /dev/sda1 already mounted or /mnt busy
Maybe it has been "auto-mounted" somewhere?
What is the output of the following commands please:

Code:

mount

ls -l /home <---- That's "minus ell" not "minus one"

And please tell us what filesystem /dev/sda1 was formatted with.

Then, I think we'll be able to give you the exact commands you need.

Daravon 08-28-2010 01:18 PM

This one really has me stumped. /dev/sda1 is formatted ext4. I have a couple files on it, and I have mounted it in the past on this system. I have no idea why, but now it will not mount anywhere. The only thing I can think is that when I added it to my fstab, to try to have it auto-mount, then some program or daemon saw it and put it in a config somewhere and now that's why it won't mount. But I have no idea what that would be.

Code:

chaz@brutus:~$ mount
/dev/sdb2 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/dev/sdb4 on /home type ext4 (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
/home/chaz/.Private on /home/chaz type ecryptfs (ecryptfs_sig=24bb171294c41f37,ecryptfs_fnek_sig=0ae98bbd77893c06,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)
gvfs-fuse-daemon on /home/jami/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=jami)
/dev/sr0 on /media/FliptCD type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=1001,gid=1001,iocharset=utf8,mode=0400,dmode=0500)
chaz@brutus:~$ ls -l /home
total 56
drwxr-xr-x 99 chaz chaz 32768 2010-08-27 17:19 chaz
drwxr-xr-x 75 jami jami  4096 2010-08-27 19:14 jami
drwx------  2 root root 16384 2010-07-05 15:45 lost+found
chaz@brutus:~$

Code:

chaz@brutus:~$ sudo fdisk -l
[sudo] password for chaz:

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2d3b2d3b

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              1      121601  976760001  83  Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009b08c

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1        1305    10482381  82  Linux swap / Solaris
/dev/sdb2  *        1306        2610    10482412+  83  Linux
/dev/sdb3            2611        3915    10482412+  83  Linux
/dev/sdb4            3916      121601  945312795  83  Linux
chaz@brutus:~$

Code:

chaz@brutus:~$ mkdir wtf
chaz@brutus:~$ ls
breakin    documents        keyshit  miscpics        music                pictures      video          x264
codecs          dvdrip-data        live          mnt                #newfile1.lyx#  pulse-backup  vidz
court.pdf  emulation        mems          montana stuff  omicronstuffz        sketchbook    workspace
desktop    jami                miscdocs  mplayer        pics.tar        vboxshare    wtf
chaz@brutus:~$ sudo mount /dev/sda1 wtf/
mount: /dev/sda1 already mounted or wtf/ busy
chaz@brutus:~$ umount /dev/sda1
umount: /dev/sda1 is not mounted (according to mtab)


tredegar 08-29-2010 03:22 AM

Thanks.

It looks like /dev/sda1 is no longer mounted (though it probably was in your post #12).

Please try the following:

1] Remove all reference(s) to /dev/sda1 from /etc/fstab

2] Run the following commands
Code:

sudo mkdir /media/video              # Make a mountpoint for /dev/sda1
sudo chown chaz:chaz /media/video    # chaz owns this mountpoint
sudo chmod 770 /media/video          # and only he can use it
rmdir /home/chaz/video                # remove the previously created directory
ln -sT /media/video /home/chaz/video  # and replace it with a symlink to the mountpoint of /dev/sda1

If you get errors you do not understand tell us exactly what they are.

3] Now add this line to /etc/fstab
Code:

/dev/sda1  /media/video  ext4  0  1
4] Reboot

Your videos should now be where you expect to find them.


All times are GMT -5. The time now is 09:57 PM.