fstab hell (help a n00b out)

PhireSide

Honorary Master
Joined
Dec 31, 2006
Messages
18,269
Reaction score
11,697
Hi,

So I have been struggling with my fstab for a while now and I simply cannot get it to work correctly.

My setup:

-Raspberry Pi 3 running OSMC
-2.5" HDD connected to it via USB, mounted with RW access using fstab for Transmission to work properly
-Nothing else that is special besides my noip-updater and PiVPN

I cannot get my Pi to boot up if the external HDD is detached. I have specified in fstab the nofail switch so that it will continue booting if it does not detect the drive at bootup, but alas it does not want to work and refuses to boot.

Output of fstab below (I have added extra line breaks for ease of reading:

/dev/mmcblk0p1 /boot vfat defaults,noatime,noauto,x-systemd.automount 0 0

UUID=C8EAA545EAA5311C /mnt/elements ntfs-3g rw defaults,noatime,noauto,nofail,uid=1000,gid=1000,dmask=000,umask=000 0 0

# rootfs is not mounted in fstab as we do it via initramfs. Uncomment for remount (slower boot)#/dev/mmcblk0p2 / ext4 defaults,noatime 0 0

Any pointers? To me it seems like Kodi is mounting the drive before fstab can mount it properly, yet I do have RW access with Transmission which indicates that it is parsing the fstab file somehow, but not the nofail switch.

Thanks :)
 
-Raspberry Pi 3 running OSMC
Assuming OSMC uses systemd, try adding the following:
Code:
UUID=C8EAA545EAA5311C /mnt/elements ntfs-3g rw defaults,noatime,noauto,nofail,[b]x-systemd.device-timeout=1[/b],uid=1000,gid=1000,d mask=000,umask=000 0 0
 
Thanks ginggs,

I have tried adding that bit in but after hanging on the boot screen for about two minutes the error returns with the USB drive unplugged.

The full error is off-screen but the bit that I could see went as follows:

END! Dependency failed for /mnt/elements

END! Dependency failed for Local File Systems

Rebooting with the drive reattached makes it all hunky dory again
 
Try removing the fstab entry and rather mounting it with a shell script in .bashrc which will fail gracefully.
 
After messing with a script it seems as if the drive is mounted by Kodi (I presume at this stage) before the script gets a chance to sniff for and mount it. Unfortunately Kodi mounts it as read-only so my Transmission is still not working too well

Time to sleuth a bit more...

EDIT: It seems as if Kodi is mounting it automagically to /media/elements:(
 
Last edited:
Can't you just remount the Kodi mount as read-write?
 
With all my mosquito-hunting I was doing last night I forgot to update here.

I eventually found a solution to my dilemma by using crontab to schedule a mount every five minutes using the below code:

*/5 * * * * sudo mount -t ntfs-3g -o --rw /dev/sda1 /mnt/elements

I then disabled the automount feature with the following command:

sudo systemctl mask udisks udisks-glue

I also commented out my fstab entry, and so far so good. The only downside is that any drive plugged into the Pi will now not automount, but I don't ever use that feature as I tend to just plug it into the Smart TV anyway. It's just nice to stream the videos straight from Kodi, but not a dealbreaker for me.

Thanks for the tips everyone!
 
The simplest solution to me seems so obvious....just don't plug it out. :)
 
I subscribe to that train of thought too.

However I regularly take media to my parents out in the boendoes to keep them busy in the evenings, hence me trying to get this Transmission write access to work properly. Sadly they have no internet out on the farm, and GSM comms are very limited so even LTE is a pipe dream
 
You could have written a script to check the mount, if it is "ro", then remount as "rw", else wait till next time.
This way Kodi can perform the mounting, and the script will simply remount it as "rw" every time it is plugged in again.
 
I'm a total n00b when it comes to scripting so I would need help with that.

I get the basic idea and the logic behind it but the actual writing of the code would give me more grey hairs than I'd care to admit :D
 
I'm a total n00b when it comes to scripting so I would need help with that.

I get the basic idea and the logic behind it but the actual writing of the code would give me more grey hairs than I'd care to admit :D

Something like:
Code:
if mount|grep -q "/media/elements"
then
     echo OK
else
     echo NOK
fi
This is pretty basic.
Replace the "echo" commands with the action you need to take.
"echo OK" should be replaced with your "mount -o remount,rw ..."
"echo NOK" could be removed or you can add a "sleep 5", then wrap it all in a "while true" statement.
 
Top
Sign up to the MyBroadband newsletter
X