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-30-2010 06:30 PM

I followed the above steps exactly and got the same error upon reboot that I got before, other than the location is of course different this time... when I rebooted the "Kubuntu" splash screen said "there was an error mounting /media/video, press S to skip or ESC to reboot". I think the system tried to mount it and it failed the same way. I'm not sure how to go back and look at exactly what happened.

Code:

chaz@brutus:~$ dmesg | grep mount
[    7.389829] EXT3-fs: mounted filesystem with ordered data mode.
[  16.870643] EXT4-fs (sdb4): mounted filesystem with ordered data mode
chaz@brutus:~$

I can repartition the disk; it would probably have been less work to try that earlier, but I would like to know why it decided it will not mount.

tredegar 08-31-2010 05:39 AM

Perhaps the disk has a filesystem error, in which case you should unmount it and then try running sudo fsck.ext4 /dev/sda1 on it, to see if it can be repaired.

Meanwhile, you can try mounting it manually, and see what the error is. You have already created the mountpoint at /media/video so try this:

Code:

sudo mount -t ext4 /dev/sda1 /media/video
If it complains it is already mounted, what is the output of mount (we are saying, "If you say it is already mounted, tell us where it is mounted").

dmesg | grep sda1 will be more informative than dmesg | grep mount

Daravon 08-31-2010 06:18 PM

Trying to mount it manually gives me the same error I've been getting.

Code:

chaz@brutus:~$ sudo mount /dev/sda1 /media/video/
mount: /dev/sda1 already mounted or /media/video/ busy
chaz@brutus:~$

Here is the output of mount...I did this earlier in the thread not sure if it's different this time.
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)
chaz@brutus:~$

When I try to fsck it, I get an error that is vaguely similar to the error that mount gives

Code:

chaz@brutus:~$ umount /dev/sda1
umount: /dev/sda1 is not mounted (according to mtab)
chaz@brutus:~$ sudo fsck.ext4 /dev/sda1
e2fsck 1.41.11 (14-Mar-2010)
fsck.ext4: Device or resource busy while trying to open /dev/sda1
Filesystem mounted or opened exclusively by another program?
chaz@brutus:~$

Here is the dmesg | grep sda

Code:

chaz@brutus:~$ dmesg | grep sda1
[    1.700182]  sda: sda1
[  16.914415] EXT4-fs (sda1): VFS: Can't find ext4 filesystem
chaz@brutus:~$


tommcd 08-31-2010 07:15 PM

Quote:

Originally Posted by Daravon (Post 4084105)
When I try to fsck it, I get an error that is vaguely similar to the error that mount gives

Try booting from the Ubutnu (or Kubuntu, which ever you have) live CD. Then run the fsck command that Tredgear posted:
Code:

sudo fsck.ext4 /dev/sda1
Your partitions will not be mounted when you boot the live CD, so you should be able to fsck /dev/sda1 from the live CD.
After you fsck /dev/sda1, then see if you can now mount it from the live CD:
Code:

sudo mount /dev/sda1 /mnt
Post back any errors you get from the fsck or the mount command from the live CD.

tredegar 09-01-2010 11:46 AM

I am having trouble working out what is going on, but in post #18 you say
Quote:

[ 16.914415] EXT4-fs (sda1): VFS: Can't find ext4 filesystem
and I am thinking "VFS"?? What is VFS? Is it a "Virtual Filesystem"? Is there something "virtual" about your setup?

Daravon 09-01-2010 08:37 PM

Quote:

Try booting from the Ubutnu (or Kubuntu, which ever you have) live CD. Then run the fsck command that Tredgear posted:

sudo fsck.ext4 /dev/sda1

I booted the Gparted LiveCD, because it's what I had. When I ran that command, I got a bunch of "checksum is invalid, would you like to fix?" errors and I said yes to them, but they just kept coming. After I said "Yes" to like 100 checksum errors I said screw this, and just used gparted to reformat the entire /dev/sda1 disk to ext3. Then I rebooted.

When I rebooted, I got the same exact error I had before...the Kubuntu splash screen said there was a problem mounting /dev/sda1. I pressed S to skip, then after my system booted I'm having exactly the same problem...even though the disk is freshly formatted! How can this be? Do I need to reinstall Ubuntu?

Quote:

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:~$ sudo mount /dev/sda1 /media/
floppy0/ video/
chaz@brutus:~$ sudo mount /dev/sda1 /media/video/
mount: /dev/sda1 already mounted or /media/video/ busy
chaz@brutus:~$ cd /media/
chaz@brutus:/media$ ls
floppy floppy0 video
chaz@brutus:/media$ cd video/
chaz@brutus:/media/video$ ls
chaz@brutus:/media/video$ 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)
none on /var/lib/ureadahead/debugfs type debugfs (rw,relatime)
/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_b ytes=16)
gvfs-fuse-daemon on /home/chaz/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=chaz)
chaz@brutus:/media/video$
Quote:

What is VFS? Is it a "Virtual Filesystem"? Is there something "virtual" about your setup?
I have an encrypted home directory, but I didn't do anything special except choose "yes" to the "do you wish to encrypt your home directory?" question on the Ubuntu CD. I'm pretty sure the encrypted home directory uses some kind of virtual file system scheme to do its magic, but I really don't understand why that's causing my mounting-new-hard-drive problem. USB drives work fine btw.

tommcd 09-01-2010 09:09 PM

Perhaps try mounting /dev/sda1 using it's UUID, since Ubuntu uses UUIDs to identify partitions in fstab.
First, run: "sudo blkid". This will list the partitions and their respective UUIDs. Then to mount /dev/sda1 run:
Code:

sudo mount -t ext3 UUID /mnt/videos
where UUID is the correct UUID for /dev/sda1. You can of course choose a different mount point if you wish.

Daravon 09-01-2010 10:13 PM

When I run blkid, it doesn't list the UUID for /dev/sda1. And when I tried to feed blkid "/dev/sda1" it returned nothing.

Code:

chaz@brutus:~$ sudo blkid
[sudo] password for chaz:
/dev/sdb2: UUID="5c3f60ff-52d9-4b8f-9748-7e7013a83d64" TYPE="ext3"
/dev/sdb3: UUID="e9e41c1b-725f-4454-bf36-1df1f3c0ef41" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb4: UUID="97c716be-7ef5-4251-9723-d64687ed6fe1" TYPE="ext4"
/dev/mapper/cryptswap1: UUID="2cddbf6b-d632-4a40-853f-7408a66f35dd" TYPE="swap"
chaz@brutus:~$ man blkid
chaz@brutus:~$ sudo blkid /dev/sda1
chaz@brutus:~$


crts 09-02-2010 06:51 AM

Hi,

some irregularities I noticed:
Quote:

I can run sudo mount /dev/sdb video/ and it will mount fine ...
So is your new drive /dev/sdb or /dev/sda. Furthermore did you really format directly /dev/sdb or did you create a partition first and format /dev/sd(a,b?)1?
From your follow-up posts I am going to assume that you meant /dev/sda1 is your new partition on your new drive.

if I understood you correctly then you can confirm that
- on your new drive there is nothing unusual like an lvm or encrypted disk etc.
- it does mount without problem when using a liveCD
- it is an internal drive and not an external USB drive

So if it is an internal drive then I assume that your OS-drives got recognized as /dev/sdaX earlier. After you installed the second hd this changed to /dev/sdbX. So maybe there is some confusion because of the changed device names. Now your new disk appears as /dev/sda1. This should not cause any trouble normally, that is what UUID is for. However, you could try running
Code:

sudo update-grub2
sudo grub-install /dev/sdb

anyway. Just to be sure.


Also, whenever I use (g)parted to partition a drive I get problems when trying to install grub afterwards. Something about misaligned boundaries. So if possible I prefer fdisk for partitioning and after that format it manually.

Daravon 09-02-2010 08:10 AM

Quote:

From your follow-up posts I am going to assume that you meant /dev/sda1 is your new partition on your new drive.
That's correct. The most recent fdisk -l is correct. But anyway, if you really want to know the history:

Originally I had one 1TB hard drive. Call it Drive1. It was my old hard drive. It was formatted with ReiserFS. I'd had it for years.

I wanted to get away from Reiser so some weeks ago when the new Ubuntu came out, I bought a new 1TB hard drive (call it Drive2). I plugged Drive2 into my system all by itself, partitioned and installed Ubuntu with the alternate CD. I said that I wanted to encrypt my home directory. So I had a new install but the home directory was 'empty' and all my data was still on my old Drive1.

Then, I plugged in Drive1 as well, rebooted and manually mounted it (with no problems) and copied the entire contents of the old home partition from Drive1 onto the new, encrypted home directory on Drive2. This transferred all my files and my settings to the new system, and the transition away from Reiser was complete.

Then, I used parted to delete and repartition Drive1 with one big Ext4 partition. I mounted this hard drive manually at least several times with no problems and copied a couple files to it just for testing purposes. I intended it to me my new drive for holding videos. Then I tried to add it to my fstab to have it mount to /home/video, and I could not do so because my encrypted home directory does not exist until I log in, so fstab couldn't mount it somewhere that doesn't exist. Then I made this thread saying "WTF". I figured out the reason it originally wouldn't mount with fstab, but now ever since then, when I try to mount the "new" hard drive to my system, or I try to have fstab do it, I get this error, even after repartitioning it again completely, and no matter where I attempt to mount it.

Quote:

on your new drive there is nothing unusual like an lvm or encrypted disk etc.
On the blank drive that I am attempting to mount to my running system and failing, all it has is one Ext3 partition. Before it had one Ext4 partition. I used parted to make the original ext4 partition, and I used gparted to make the most recent ext3 partition.
Quote:

it does mount without problem when using a liveCD
I'm not sure of that yet. I don't think I tried to mount it when I had the gparted CD running. Gparted managed to partition it, so if gparted needs to mount it to do that, we can conclude that it mounted fine with the liveCD.

Quote:

it is an internal drive and not an external USB drive
It's kind of hanging out of my case right now, but it is hooked up with SATA cables, so I guess it's internal.

crts 09-02-2010 09:46 AM

Hi,

ok, this sounds like we are chasing needles here. Can you post the output of the following commands
Code:

sudo cat /proc/mounts
sudo find / -type f -name '*.lock' -print
sudo find / -type d -exec sh -c 'mountpoint -q "${1}" && echo "${1}"' '{}' '{}' \;

This sounds rather unlikely, but is there any chance the drive might be damaged?
Also, I am not sure about gparted. I do not use it. However, parted does not create a filesystem although it has an option that it can. I always ran into problems with it.
So can you - from the liveCD - repartition/reformat it using fdisk/mke2fs? Pay attention that you get the correct device name when you run the liveCD. The device names might differ when using the liveCD, i.e. the 'video hd' might be /dev/sda on your OS but when using the liveCD it might be recognized as /dev/sdb. So run fdisk -l first to identify the correct hd.
Partition the 'video hd' with 'fdisk /dev/sdX'. Make sure that you write the changes to disk before you exit fdisk.
Then format it
Code:

mke2fs -j -c -c /dev/sdX1 # will perform a read-write check and create an ext3 filesystem
This will take some time to complete.

Quote:

It's kind of hanging out of my case right now, but it is hooked up with SATA cables, so I guess it's internal.
Yes, that still does qualify as internal. The reason I ask is that, e.g., my external USB drive sometimes needs to be attached by using two USB ports. I just wanted to make sure that this is not the case.
I assume you already double-checked that the contacts are attached properly, anyway.

Did you try the reinstalling grub? Even if it sounds unlikely after your description let us keep it as a possibility in mind.

Daravon 09-02-2010 09:22 PM

Code:

chaz@brutus:~$ sudo cat /proc/mounts
[sudo] password for chaz:
rootfs / rootfs rw 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
none /proc proc rw,nosuid,nodev,noexec,relatime 0 0
none /dev devtmpfs rw,relatime,size=1892536k,nr_inodes=473134,mode=755 0 0
none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
/dev/disk/by-uuid/5c3f60ff-52d9-4b8f-9748-7e7013a83d64 / ext3 rw,relatime,errors=remount-ro,data=ordered 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/security securityfs rw,relatime 0 0
none /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
none /var/run tmpfs rw,nosuid,relatime,mode=755 0 0
none /var/lock tmpfs rw,nosuid,nodev,noexec,relatime 0 0
none /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0
/dev/sdb4 /home ext4 rw,relatime,barrier=1,data=ordered 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
/home/chaz/.Private /home/chaz ecryptfs rw,relatime,ecryptfs_fnek_sig=0ae98bbd77893c06,ecryptfs_sig=24bb171294c41f37,ecryptfs_cipher=aes,ecryptfs_key_bytes=16 0 0
gvfs-fuse-daemon /home/chaz/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
gvfs-fuse-daemon /home/jami/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=1001,group_id=1001 0 0
chaz@brutus:~$

Code:

chaz@brutus:~$ sudo find / -type f -name '*.lock' -print

/home/jami/.openoffice.org/3/.lock
/home/jami/.hplip/hp-systray.lock
/home/jami/.qt/.qt_plugins_3.3rc.lock
/home/jami/.qt/.qtrc.lock
/home/jami/.gksu.lock
/home/chaz/documents/sdbu/nixbackups/.qt/.qtrc.lock
/home/chaz/documents/sdbu/nixbackups/.qt/.qt_plugins_3.3rc.lock
/home/chaz/documents/sdbu1009/nixbackups/.qt/.qtrc.lock
/home/chaz/documents/sdbu1009/nixbackups/.qt/.qt_plugins_3.3rc.lock
/home/chaz/documents/usdbu10/nixbackups/.qt/.qtrc.lock
/home/chaz/documents/usdbu10/nixbackups/.qt/.qt_plugins_3.3rc.lock
/home/chaz/documents/usdbackup/nixbackups/.qt/.qtrc.lock
/home/chaz/documents/usdbackup/nixbackups/.qt/.qt_plugins_3.3rc.lock
/home/chaz/documents/usdbackup/chaz's folder/.qt/.qtrc.lock
/home/chaz/documents/usdbackup/chaz's folder/.qt/.qt_plugins_3.3rc.lock
/home/chaz/documents/usdbackup/chaz's folder/.gksu.lock
/home/chaz/documents/usdbackup/chaz's folder/.ktorrent.lock
/home/chaz/.gksu.lock
/home/chaz/.openoffice.org/3/.lock
/home/chaz/.ktorrent.lock
/home/chaz/.hplip/hp-systray.lock
/etc/.pwd.lock
/etc/.java/.systemPrefs/.system.lock
/tmp/orbit-jami/bonobo-activation-register-3f503629d48f9911491e5b294c7f8755.lock
/tmp/orbit-chaz/bonobo-activation-register-ceb40232be18eb2d8c9393094c7efdf6.lock
/var/lib/nfs/.etab.lock
/var/lib/nfs/.xtab.lock
chaz@brutus:~$
chaz@brutus:~$ ~;2B


crts 09-02-2010 10:40 PM

Hi,

- what about the other 'find' command?
- Did you repartition using fdisk, not (g)parted? And then format with the command I provided?

Daravon 09-08-2010 08:34 AM

I started running

Code:

mke2fs -j -c -c /dev/sdX1 # will perform a read-write check and create an ext3 filesystem
last night at around 9pm. This morning at 6 it was still going! We are having a tropical storm here in Dallas and I hope my power doesn't flicker.

Daravon 09-08-2010 07:17 PM

My power went out halfway through. Wonderful. I will run it again overnight I guess. Do I have to use a LiveCD, or can I just use my normal system?


All times are GMT -5. The time now is 05:52 PM.