Kodi Community Forum
autofs issues - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
---- Thread: autofs issues (/showthread.php?tid=120490)



[LIVE] autofs issues - Mr. Cookie - 2012-01-20

I've been running my XBMC installs in a shared database style for a while now. Everything is going well with it so I decided to go the symlink route for thumbnails.

I followed a guide which said to create an fstab entry for my network share of the thumbnail folder. Unfortunately this did not work for me because I am using wifi and the share tried to mount before the wifi was up. I confirmed this by doing a
Code:
sudo mount -a
over ssh and the share mounted and all was good, just doesnt work on start up.

Next I tried using autofs to do the same thing. Got it all setup and still no dice. Again after startup if I do a
Code:
sudo service autofs start
everything works.

I've tried adding an entry in rc.local to run autofs but still no joy. Anyway to make the command run AFTER everything else is booted and running?


- gsgleason - 2012-01-20

Try adding mount option _netdev and/or soft


- gsgleason - 2012-01-20

Also, autofs shouldn't actually try to mount until the mountpoint is accessed. I have used autofs with my ubuntu minimal install and it worked well, though I was using a wired connection instead of a wireless connection.


- Mr. Cookie - 2012-01-20

From what I understand from google searches is that _netdev is only useful for NFS shares. Either way, I did have that in my fstab but saw errors in dmesg about _netdev being a bad option.

Guess I could learn NFS since all my XBMC boxes will be live installs anyway. Any other options?


- darkscout - 2012-01-20

Now that NFS is built in I did away with it and am going straight with the NFS goodies.


- jawilljr - 2012-01-21

What you could try is to ping the server until it is up...then run the autofs command..

Try adding something like this to your rc.local file:

Code:
HOSTNAME="192.168.1.1"

while ! ping -q -c1 $HOSTNAME &>/dev/null; do
    sleep 1
done
service autofs start

Of course change "HOSTNAME" to whatever the server's IP is.


- norms - 2012-01-21

I've never used autofs before but here is what I do:


From a terminal (SSH in or whatever)

sudo nano /etc/network/if-up.d/fstabmount

add this text:

#!/bin/sh
mount -a

Save the file and exit (CTRL+X and say yes to save)

sudo chmod +x /etc/network/if-up.d/fstabmount


restart and test it out Smile


- Mr. Cookie - 2012-01-22

Thanks for the input guys but still no love.

I first tried the /etc/network/if-up.d/fstabmount method. This is the contents
Code:
#!/bin/sh
sh /home/bob/smbmount.sh

contents of smbmount.sh
Code:
#!/bin/sh
iwconfig >> /home/bob/before
/bin/mount -t smbfs //xbmc_server/thumbs$ /thumbs >> /home/bob/error
echo works > /home/bob/message
iwconfig >> /home/bob/after
It looks a little different now due to some troubleshooting. I wanted to see the output of iwconfig before and after the mount attempt. Also I wanted to see that the script ran and see any errors the mount command might give. Both before and after were empty and error said network unreachable or something similar. The script does run.

Next I tried the rc.local approach.

Contents of rc.local
Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo USB0 > /proc/acpi/wakeup
sh /usr/src/asus-at3iont-i-deluxe-1.0.1/drivers/hid-philips-asus/load-module.sh


HOSTNAME="192.168.50.105"

while ! ping -q -c1 $HOSTNAME &>/dev/null; do
    sleep 1
done
mount -a >> error
echo works2 >> /home/bob/message
exit 0

Again I slightly modified this to see if the script was running and because I removed autofs as part of my troubleshooting the previous method. The script is running as my remote modules are loading. "works2" never appears in the message file however. Perhaps the ping never completes and the code doesn't execute?

Here is the contents of fstab
Code:
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' 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).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sdb1 during installation
# UUID=a951fafd-6f31-4de9-a3a4-d7ca40e22486 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sdb5 during installation
# UUID=308fa216-6b45-401d-bbad-6c7e0e1cc2d2 none            swap    sw              0       0
  //192.168.50.105/thumbs$ /thumbs smbfs guest,auto  0 0

The UUIDs are commented out to avoid error messages of missing disk during bootup. This install is a clone from a smaller usb stick. The UUIDs are off so I just commented them out. I was trying mount -a and a full mount command interchangeably with no results. I did comment out the entry in fstab when using the full mount command.

I also am seeing errors on the mount command by just entering mount -a in a terminal. this is the result:
Code:
Warning: mapping 'guest' to 'guest,sec=none'
error 22 detected on close of mtab

Just for completeness, my contents of /etc/hosts
Code:
127.0.0.1       localhost
127.0.1.1       XBMCLive
192.168.50.105  XBMC_SERVER

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I'm quite clueless at this point and would really like to get this working. Any ideas what is happening?


- norms - 2012-01-22

Quote:I followed a guide which said to create an fstab entry for my network share of the thumbnail folder. Unfortunately this did not work for me because I am using wifi and the share tried to mount before the wifi was up. I confirmed this by doing a
Code:
sudo mount -a
over ssh and the share mounted and all was good, just doesnt work on start up.

You state here that typing sudo mount -a from an ssh terminal successfully mounts your share. But:

Quote:I first tried the /etc/network/if-up.d/fstabmount method. This is the contents
Code:
#!/bin/sh
sh /home/bob/smbmount.sh

Did you, or can you try by changing the contents to what I suggested ?

#!/bin/sh
mount -a

This should effectively work in the same way as you ssh'ing in and typing it in manually as it will only be executed once the network is up, or every time it comes up.


- Mr. Cookie - 2012-01-22

Well I just tried again to be sure and mount -a does not work in that script either.

Now when I do a mount -a from a terminal I get the error:
Code:
error 22 detected on close of mtab

I also get the same error when issuing
Code:
mount -t smbfs //xbmc_server/thumbs$ /thumbs

The mount works just fine and /thumbs shows the files but only after issuing a mount command from a terminal, not with the script. A Google search of "error 22 detected on close of mtab" has 2 results. One of them links to this threadRolleyes

Am I really the only person to see this error? I can reproduce the results on my server as both are clones of the same stick. The server just has more packages installed. Think it has anything to do with it?

Also I assume that you are on wireless as well? Do you use wicd-curses? Maybe there is a small delay between the interface coming up and association to the AP? Just guessing here.


- norms - 2012-01-22

Quote:error 22 detected on close of mtab

I also get that error but was told not to worry about it. My shares work perfectly, one is set up on my netbook over wireless and I had the same issue as you, it was mounted too quickly and the wireless had not came up. The other one is on my HTPC and that is cabled. However, I use CIFS and my share is on a NAS. I would of thought the type of share did not matter especially as yours works from terminal, as in theory, when the network is up, a terminal like command is issued by the script.

I don't know tbh, maybe you using smbfs makes a difference ? Sorry but I can't help you there. Maybe you can try CIFS ?

EDIT*

By the way, for your reference, this is my fstab entry:

//192.168.2.9/Share /home/xbmc/share/ cifs nounix,uid=xbmc,gid=xbmc,file_mode=0777,dir_mode=0777 0 0


- Mr. Cookie - 2012-01-22

Will I got it solved. It appears launching the mount was too early from /etc/network/if-up.d/fstabmount

Instead I made the same script at /etc/wicd/scripts/postconnect/smbmount

contents:
Code:
#!/bin/sh
mount -a

Then sudo chmod +x /etc/wicd/scripts/postconnect/smbmount

All is working now. Thanks for all your help!


- norms - 2012-01-22

Good to hear it is working now Smile


This forum uses Lukasz Tkacz MyBB addons.