Closed Lord-Dimwit-Flathead-the-Excessive closed 9 months ago
OK first dumb question, what's wrong with the recipe given in the Network Block Device (NBD) Mode wiki page? Why is the wrapper script needed?
Even with systemd in control, you should still be able to manually stop and start using systemctl...
Merely a convenience until I get the service working. Remember, I don't have code that will create the /run/s3backer-nbd directory for the nbdkit. So without the wrapper on boot, s3backer fails with:
Feb 18 19:04:40 nfs s3backer[624]: /run/s3backer-nbd/0000000000000005_0000000000000236: No such file or directory
With it, startups are working fine.
It is only when I try to stop the service using systemctl (or shutdown/reboot) that I get the timeout and the s3 filesystem is left in a "mounted" state. This behavior is consistent whether I use
ExecStart=-/usr/local/bin/s3b-wrapper.sh --start
ExecStop=-/usr/local/bin/s3b-wrapper.sh --stop
or
ExecStart=/usr/bin/s3backer --nbd --force --configFile=/etc/s3backer.conf wasabi.bucket.test2 /dev/nbd0
in the service file.
But the filesystem cleanly shuts down if I umount /mnt/s3b;killall s3backer
. It just doesn't seem to want to work from within systemd.
Tuesday I plan on rebuilding the target (Debian 12). Might be informative to try it on Ubuntu as well. This really feels like it has more to do with the OS than the code...
OK thanks for clarifying. systemd is supposed to be smart enough to know that if you ask it to stop the service, it must unmount the filesystem first. This is what the x-systemd.requires=s3backer-nbd.service
bit in /etc/fstab
is for.
Yes. And I think that is actually working. At least journalctl indicates the volume is being dismounted well prior to the timeout.
It appears to me that killing s3backer behaves differently from within systemd than it does from the user space. But I want to "double check" this behavior on virgin builds of Debian and Ubuntu before you invest more time in it. It is entirely possible my current environment is corrupted. I have "played" a lot with it in my troubleshooting efforts to this point. I'll update Wednesday.
OK, on fresh rebuilds of Debian 12 (6.1.0-18-amd64) and Ubuntu 22.04.4 (5.15.0-94-generic) I am not getting any timeouts - everything is working great. Please disregard/close. Thank, Archie.
OK great, thanks for the update.
This one, I am not at all sure what is going on ... I have written a "wrapper" to manually start and stop the s3 device and it works fine. But if I do systemctl stop s3backer-nbd.service or reboot, I get a 90 second timeout and the mount object is left on the drive.
Here's journctl: