summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-05-19 22:30:28 +0200
committerLennart Poettering <lennart@poettering.net>2010-05-19 22:30:28 +0200
commitca9a0317a45f8a4ab702e9b8ce4542d8452a47ad (patch)
tree568d65761ec8c59565b9fd27d8ed57cac20f6f98 /src
parentdfca381db341205b7a68f40ef2b7550ac6972cab (diff)
automount: try to modprobe autofs4 if its lacking
Diffstat (limited to 'src')
-rw-r--r--src/automount.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/automount.c b/src/automount.c
index 32680461c2..730b1572c2 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -276,8 +276,18 @@ static int open_dev_autofs(Manager *m) {
return m->dev_autofs_fd;
if ((m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY)) < 0) {
- log_error("Failed to open /dev/autofs: %s", strerror(errno));
- return -errno;
+
+ if (errno == ENOENT || errno == ENODEV) {
+ log_error("Your kernel apparently lacks built-in autofs4 support. Please fix that. "
+ "We'll now try to work around this by calling 'modprobe autofs4'...");
+ system("/sbin/modprobe -q -- autofs4");
+ m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY);
+ }
+
+ if (m->dev_autofs_fd < 0) {
+ log_error("Failed to open /dev/autofs: %s", strerror(errno));
+ return -errno;
+ }
}
init_autofs_dev_ioctl(&param);