5

I have autofs all setup, and it correctly mounts my shared directories.

However, right now, I have to manually run sudo upstart autofs start after every boot, before the automounting actually works.

I think in installed autofs manually through synaptic, though it has been a while. The computer in question is used as a lightweight server, and rarely gets restarted, so having to manually start a service isn't too big a deal, but my backups do not work until autofs is running, so I do worry.

7
  • I can't help directly, but I can confirm that autofs from the repositories is definitely auto-started on login/startup and will mount anything it sees in /etc/auto.master automatically. – Scaine Oct 24 '11 at 14:36
  • @Scaine - Well, damn if I know what's going on, then. Maybe it was packaged into the xubuntu installation, and just not enabled until I set it up. – Fake Name Oct 24 '11 at 14:40
  • I'd do a re-install of autofs through synaptic, but getting it working at all was an enormous pain, and I don't know if a re-install would clobber my config files. Frankly, considering how much of a complete PITA it was to get working, I really don't want to to touch autofs itself, for fear of breaking it. – Fake Name Oct 24 '11 at 14:42
  • Most of the configuration for autofs is just /etc/auto*.*. You'll have a master file, two or three scripts (auto.smb, auto.net and such like) and for each network share you'll have auto.smb.SERVERNAME or similar. It should (grin) be relatively easy to back up, then restore! Should be... – Scaine Oct 24 '11 at 14:48
  • Anyone? This is still an issue for me.... – Fake Name Dec 8 '11 at 12:30
4
+50

Add this to /etc/rc.local

Using any editor:

Graphical

gksu gedit /etc/rc.local

Command line

sudo -e /etc/rc.local 

add / edit the following:

#!/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.

service autofs start &

mount -a

exit 0

You could probably improve on that a bit, 4 60 second sleep are probably excessive, I would try one, and increase the number if needed.

Make it executable

sudo chmod u+x /etc/rc.local

Reboot and it should work. If not, try adding a sleep as per the bug report below.

See also Bug Report

5
  • I think the restarts may not be needed. All I have to do to get autofs to work normally is just issue a sudo service autofs start. The problem isn't that it's failing, it's that it is never starting. Anyways, I will try this when I get home from work later today. – Fake Name Dec 9 '11 at 0:03
  • I agree, the start ... sleep ... restart ... sleep ... seems excessive, probably written in frustration, but probably after a shorter script fails. Give it a try and you can of course optimize it for your needs. – Panther Dec 9 '11 at 0:12
  • Do you still need assistance ? – Panther Dec 11 '11 at 18:46
  • Nope, that did it. I just put service autofs start in rc.local, without any sleep or repetitions. I still wonder how I installed autofs without it bing set up to start, though. – Fake Name Dec 12 '11 at 10:15
  • Thank you for commenting back on the requirement for the sleep. I will revise my answer. As far as it not working out of the box, aye it is a bug. My guess would be autofs is running too soon, without waiting for some service to finish. – Panther Dec 12 '11 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.