Hi
I’m on openSUSE Tumbleweed on both my workstation and laptop.
I currently installed a brand new tumbleweed on the laptop and using it as a test to recover my own stuff from my NAS and forgejo selfhosted instance in case of failure.
My main goal and motivation is to write down a quick README to quickly walk me through a brand new installation process and be operative as quickly as possible.
For this reason I start dealing with my dotfiles using chezmoi to sync them across the 2 machines and my selfhosted forgejo.
I’d like to share the configuration off all my network drives the is currently written in /etc/fstab. This file cannot be managed via chezmoi.
I set out to find a solution to this over-engineered problem and discovered that it is possible to use systemd to automatically mount network folders.
I added these two configuration files in /etc/systemd/system/
:
➜ ~ cat /etc/systemd/system/home-fabio-mnt-magnum-shared.mount
[Unit]
Description=shared folder on Magnum
[Mount]
What=192.168.20.2:/volume1/shared
Where=/home/fabio/mnt/magnum/shared
Options=defaults
Type=nfs
[Install]
WantedBy=multi-user.target
➜ ~ cat /etc/systemd/system/home-fabio-mnt-magnum-shared.automount
[Unit]
Description=Automount of shared on Magnum
[Automount]
Where=/home/fabio/mnt/magnum/shared
TimeoutIdleSec=0
[Install]
WantedBy=multi-user.target
Subsequently:
systemctl daemon-reload
To start the automount service:
systemctl start home-fabio-mnt-magnum-shared.automount
and this follwing command to make it persistent after reboot:
systemctl enable home-fabio-mnt-magnum-shared.automount
My goal is to keep the configuration entirely within my home directory (~/.config/systemd/user/) so I can manage it with my dotfiles via chezmoi, avoiding any modifications to system files like /etc/fstab.
I set
➜ ~ echo $SYSTEMD_UNIT_PATH
/home/fabio/.config/systemd/user
and put the above configuration files inside that folder, but when I try run the same command, it doesn’t work:
░░ The unit UNIT has entered the 'failed' state with result 'resources'.
Oct 19 18:01:50 workstation systemd[1697]: Failed to set up automount Automount of shared on Magnum.
░░ Subject: A start job for unit UNIT has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit UNIT has finished with a failure.
░░
░░ The job identifier is 1028 and the job result is failed.
lines 976-1041/1041 (END)
I wonder if I have really embarked on a non-existent problem and am trying to solve it the wrong way.
I also understand the objection could be “eh but just copy the mount points in /etc/fstab by hand and that’s it”.
And you are also right but now that I’m one step closer to solving it I’m sorry I wasted my time trying to solve it.
Thanks for any suggestions and help!