Curlftpfs and fstab issue

I'm having a hard time getting curlftpfs working with automount at boot when entering it into /etc/fstab (debian 10).
I need to connect to a FTPS server using certificate. This is how it looks:

curlftpfs#172.16.10.12 /mnt/my_ftp fuse allow_other,ssl,cert=/home/ftpscert.pem,no_verify_peer,no_verify_hostname,uid=1000,gid=1000,umask=0022 0 0

I added machine, user and password in the /root/.netrc

After boot the /mnt/my_ftp directory does not get mounted.

Does somebody have an idea where I should look ?

Hi @Cherry666,

does a mount -v /mnt/my_ftp work?

Hello bendingrodriguez,

Yes it does.

try to append ,x-systemd.automount,x-systemd.requires=network-online.target to the 4th column.

The 4th column being the options column... so I presume I need to enter that behind umask=0022 ?

that's right.

Hmm, that reminds me of an iso9660 loopback mount where the iso file was on NFS.
It caused a cyclic dependency error, and dependent on the systemd version and the options it caused
no automatic mount at boot, or
the system came not fully up (systemd sacrificed some services to break the dependency cycle), or
the system got hung for hours during shutdown.
I finally gave up on fstab and systemd, and solved it by using the automounter (autofs service and /etc/auto.direct).

systemd is an eternal source of problems in my experience, both during boot and during shutdown, especially in conjunction with the network. Not for nothing is there a Debian fork that doesn't use it.

Using autofs on any operating system for such (network) filesystems is good practice imho.

The mechanism to configure automatic umount in case of inactivity (defaults are sane) and that request mounts such filesystem(s) seems like the right way to do things from my perspective.

Of course, fstab options today offer a lot of options to manipulate failure or inaccessible scenarios.

And there is a scope what is to be done with that filesystems, since (auto)mount can take a bit to happen (on first request) and stuff may expect faster response times.

Regards
Peasant.

@bendingrodriguez your suggestion works ! Thanks !

I still need to perform mount -a after boot... would autofs make it completely automatic ? If so, how do I achieve that ?

@Cherry666

actually that should happen automatically when the network is up and the mountpoint is accessed the first time. If you do a ls /mnt/my_ftp right after boot & login, i.e. without mount -a, is it mounted? If not, what gives

journalctl -u '*my_ftp*'

Well, to work around the issue, I created a crontab at reboot to perform mount -a

Now, I removed it and restarted (couple of times) the machine and now the automount works properly:

´-- Logs begin at Mon 2021-01-18 15:48:04 CET, end at Mon 2021-01-18 15:49:08 CET. --
Jan 18 15:48:36 ddproxyupstream systemd[1]: Set up automount mnt-my_ftp.automount.´

Doesn't give me a warm fuzzy feeling, but it will do... thanks !

Yes it's a hack.

autofs would be cleaner. During boot it is all just defined not executed; a cyclic dependency does not matter. The first execution happens late, at the first access.
But certain things are brain-damaged in autofs; e.g. you might need a colon prefix to prevent from a wrong interpretation...
The automount debug option is your friend. autofs is a hard way to a clean solution.

Regarding system logs:
maybe it's safer to grep in the journalctl -b output i.e. the boot log.

why that's a hack? It's a clean configuration, the two options are designed to ensure that the dir is mounted via network the first time it is accessed, see e.g. systemd.mount. You could also create a unit file, but that's more work.

Sorry, I did not read carefully.
If the extra mount -a is NOT needed then it's NOT a hack.
The x-systemd.xxx options might indeed solve this cleanly. And then is preferrable over the autofs alternative here.

Now I have curlftpfs mounted at boot... I have the following issue: I am using inotifywait to check the directory mounted with curlftpfs with option -m to check if files arrive (option -created and -moved_to).. but whenever I move or create a file on my ftp server, the command does not get triggered...
Any ideas how come ?

script looks like this:

´
inotifywait -m /path -e create -e moved_to |
while read path action file; do
echo "The file '$file' appeared in directory '$path' via '$action'"
# do something with the file
done
`
If I create a file on the local directory, it does get triggered...

@Cherry666 according to Is there a way to use inotify on remote filesystems (specifically WebDAV)? - Unix & Linux Stack Exchange inotify doesn't work in your case.
A first idea could be a script, cause it doesn't need any changes on the ftp server. Here is a bit hacky python3 (>= 3.6) attempt, since it uses tree instead of the more elaborate os.walk() to get all entries including subdirs:

import os, sys, time, subprocess

PATH = '/path'
SLEEP = 3

def tree():
    try:
        ret = subprocess.run('tree -Ffi --noreport', shell=True, check=True, timeout=3, stdout=subprocess.PIPE)
    except Exceptions as err:
        print(f'error {err} while reading {PATH}', file=sys.stderr)
        return None
    return set(x.decode('utf-8')[2:] for x in ret.stdout.splitlines())

os.chdir(PATH)
t0 = tree()
while True:
    time.sleep(SLEEP)
    t1 = tree()
    if t0 and t1:
        c, m = t1 - t0, t0 - t1
        if c:
            print('created:', c)
        if m:
            print('moved:', m)
        t0 = t1

Thanks for the efforts @bendingrodriguez. That's a bummer...

Python is still a mistery to me, I am planning on changing that soon, any chance on an example in bash ?
The inotifywait would have been handy since I need to monitor (in a loop) for new files in the ftp folder starting with R_ and download that file.

@Cherry666 is it a plain dir or does it contain subdirs? The former would make things easier in bash.

It's a plain dir which will be populated by users... the script needs to monitor the dir and catch the files starting with R_ and download them. Now I come to think of it, I might not need curlftpfs but I might use lftp as ftp client...