You are not logged in.
Pages: 1
Hi,
I've ran into this odd problem when I've configured automount NFS shares over local wifi network from https://wiki.archlinux.org/title/NFS_ via systemd/timers. So I have auto_share.timer that triggers auto_share.service which fails afterward. fstab was edited as advised on the same page I referenced and auto_share script is at /usr/local/bin also as instructed.
From journalctl command.
Jan 02 00:51:01 archXPS kernel: audit: type=1130 audit(1672638661.757:109): pid=1 uid=0 auid=4294967295 ses=4>
Jan 02 00:51:01 archXPS audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=auto_sha>
Jan 02 00:51:01 archXPS systemd[1]: Failed to start Automount NFS shares.
Jan 02 00:51:01 archXPS systemd[1]: auto_share.service: Failed with result 'exit-code'.
Jan 02 00:51:01 archXPS systemd[1]: auto_share.service: Main process exited, code=exited, status=32/n/aAlso
systemctl status auto_share.service
× auto_share.service - Automount NFS shares
Loaded: loaded (/etc/systemd/system/auto_share.service; disabled; preset: disabled)
Active: failed (Result: exit-code) since Mon 2023-01-02 01:00:14 EST; 16s ago
TriggeredBy: ● auto_share.timer
Process: 3100 ExecStart=/usr/local/bin/auto_share (code=exited, status=32)
Main PID: 3100 (code=exited, status=32)
CPU: 29ms
Jan 02 01:00:14 archXPS systemd[1]: Starting Automount NFS shares...
Jan 02 01:00:14 archXPS systemd[1]: auto_share.service: Main process exited, code=exited, status=32/n/a
Jan 02 01:00:14 archXPS systemd[1]: auto_share.service: Failed with result 'exit-code'.
Jan 02 01:00:14 archXPS systemd[1]: Failed to start Automount NFS shares.Just to make sure, those shares are available and I'm using those on my other laptop running arch so I'm confused here as to why the same settings do not work as expected. Need help to find what I'm missing here.
Last edited by shuruper (2023-01-02 23:07:55)
Offline
as advised on the same page… From journalctl command.
Don't paraphrase and don't copy out of the pager.
The timer triggers, so that seems ok.
Post your fstab and the /etc/systemd/system/auto_share.service
I'm using those on my other laptop
Can you mount the share on the problematic system in a non-fancy fashion?
https://wiki.archlinux.org/title/NFS#Manual_mounting
Online
seth, thanks for helping me out here.
Manual mounting is working, it umounts itself after about 1 minute due to failed automount attempt (checked that by stopping the auto_share.timer).
my fstab:
cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme1n1p2
UUID=a4df3545-a230-4fe4-8c09-6ed154d688b1 / ext4 rw,relatime 0 1
# /dev/nvme1n1p3
UUID=411574bc-4210-4585-a6e3-6a5280882efc /home ext4 rw,relatime 0 2
/swapfile none swap defaults 0 0
mycloudex2ultra:/nfs/Public /home/rutkaf/shared nfs noauto,nofail,noatime 0 0
mycloudex2ultra:/nfs/data /home/rutkaf/data_nas nfs noauto,nofail,noatime 0 0
https://dav.box.com/dav /home/rutkaf/box davfs rw,user,uid=rutkaf,noauto 0 0Auto_share.service :
cat /etc/systemd/system/auto_share.service
[Unit]
Description=Automount NFS shares
After=syslog.target network.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/auto_share
[Install]
WantedBy=multi-user.targetOffline
ExecStart=/usr/local/bin/auto_shareYeah, that script now becomes very relevant, too ![]()
it umounts itself after about 1 minute due to failed automount attempt
You mean you can manually mount the share, but then the auto_share.timer triggers the auto_share.service and that results in the share getting unmounted??
How frequently is the timer triggered?
Sanity check: what's the background of this approach and would you possibly be better off w/ a systemd-automount (mount on demand, ie. when you try to access the share)?
Eg. sth. like
mycloudex2ultra:/nfs/Public /home/rutkaf/shared nfs users,intr,noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,actimeo=3,noatime,soft,bg,nolock 0 0Online
so this is the auto_share code I'm using
#!/bin/bash
function net_umount {
umount -l -f $1 &>/dev/null
}
function net_mount {
mountpoint -q $1 || mount $1
}
NET_MOUNTS=$(sed -e '/^.*#/d' -e '/^.*:/!d' -e 's/\t/ /g' /etc/fstab | tr -s " ")$'\n'b
printf %s "$NET_MOUNTS" | while IFS= read -r line
do
SERVER=$(echo $line | cut -f1 -d":")
MOUNT_POINT=$(echo $line | cut -f2 -d" ")
# Check if server already tested
if [[ "${server_ok[@]}" =~ "${SERVER}" ]]; then
# The server is up, make sure the share are mounted
net_mount $MOUNT_POINT
elif [[ "${server_notok[@]}" =~ "${SERVER}" ]]; then
# The server could not be reached, unmount the share
net_umount $MOUNT_POINT
else
# Check if the server is reachable
ping -c 1 "${SERVER}" &>/dev/null
if [ $? -ne 0 ]; then
server_notok[${#server_notok[@]}]=$SERVER
# The server could not be reached, unmount the share
net_umount $MOUNT_POINT
else
server_ok[${#server_ok[@]}]=$SERVER
# The server is up, make sure the share are mounted
net_mount $MOUNT_POINT
fi
fi
doneYou mean you can manually mount the share, but then the auto_share.timer triggers the auto_share.service and that results in the share getting unmounted??
How frequently is the timer triggered?
Yes, I can mount it by running "mount -t nfs servername:/nfs/share /share" and if the timer is started/enabled it will umount itself after ~1 min which is the auto_share.timer frequency.
Sanity check: what's the background of this approach and would you possibly be better off w/ a systemd-automount (mount on demand, ie. when you try to access the share)?
The background is pretty simple - I was using this kind of a mount script for ~2 years on my other laptop and it worked like a charm out of the box (i.e. after I followed the description from NFS wiki page). So now I'm kind if curious as to what I've missed here.
Mount option using fstab with x-systemd.automount does work actually. And this fact helped me realize that the server name "mycloudex2ultra" isn't a good one - ones I replaced it with the actual IP - automount script started to work!
So the hassle was to not forget the /etc/hosts file.
Anyways, thanks for your help and I'm marking this thread as Solved.
Last edited by shuruper (2023-01-03 04:01:08)
Offline
Pages: 1