[GH-ISSUE #2139] Add support for systemd mount units #1089

Closed
opened 2026-03-04 01:51:18 +03:00 by kerem · 3 comments
Owner

Originally created by @guss77 on GitHub (Mar 27, 2023).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/2139

Additional Information

Version of s3fs being used (s3fs --version)

1.90

Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse or dpkg -s fuse)

2.9.9-5ubuntu3

Kernel information (uname -r)

5.19.0-38-generic

GNU/Linux Distribution, if applicable (cat /etc/os-release)

PRETTY_NAME="KDE neon Unstable Edition"
NAME="KDE neon"
VERSION_ID="22.04"
VERSION="Unstable Edition"
VERSION_CODENAME=jammy
ID=neon
ID_LIKE="ubuntu debian"
HOME_URL="https://neon.kde.org/"
SUPPORT_URL="https://neon.kde.org/"
BUG_REPORT_URL="https://bugs.kde.org/"
PRIVACY_POLICY_URL="https://kde.org/privacypolicy/"
UBUNTU_CODENAME=jammy

How to run s3fs, if applicable

I want to use a systemd mount unit to mount the S3 file system. My best attempt so far is as follows:

~/.config/systemd/user/home-odeda-mnt-s3.mount:

[Unit]
Description=My S3 bucket

[Mount]
What=my-bucket
Where=%h/mnt/s3
Options=use_path_request_style,profile=myprofile
Type=fuse.s3fs

which does call onto s3fs, but the problem is that systemd understands the what as a relative path name and it canonicalize it as %h/my-bucket before submitting it to s3fs (for some reason - I'm not sure why), which results in the following log:

s3fs syslog messages (grep s3fs /var/log/syslog, journalctl | grep s3fs, or s3fs outputs)

Mar 27 15:04:19 vesho s3fs[2728865]: s3fs version 1.90(unknown) : s3fs -o rw,use_path_request_style,profile=myprofile,dev,suid /home/odeda/my-bucket /home/odeda/mnt/s3
Mar 27 15:04:19 vesho s3fs[2728865]: Loaded mime information from /etc/mime.types
Mar 27 15:04:19 vesho s3fs[2728865]: s3fs: BUCKET /home/odeda/my-bucket -- bucket name contains an illegal character.
Mar 27 15:04:19 vesho systemd[2805]: home-odeda-mnt-s3.mount: Mount process exited, code=exited, status=1/FAILURE
Mar 27 15:04:19 vesho systemd[2805]: home-odeda-mnt-s3.mount: Failed with result 'exit-code'.

Details about issue

It would be great if s3fs can be configured (using an option?) or auto-detect that it is called in such a weird way and workaround the issue.

One possible solution that I though might make sense is to specify the What field as an S3 url (s3://my-bucket) - in such a case systemd "understands" that this is a network path and doesn't rewrite it, causing the following s3fs log:

Mar 27 15:07:37 vesho s3fs[2736490]: s3fs version 1.90(unknown) : s3fs -o rw,use_path_request_style,profile=myprofile,dev,suid s3://my-bucket /home/odeda/mnt/s3
Mar 27 15:07:37 vesho s3fs[2736490]: s3fs: unable to access MOUNTPOINT s3://my-bucket: No such file or directory
Mar 27 15:07:37 vesho systemd[2805]: home-odeda-mnt-s3.mount: Mount process exited, code=exited, status=1/FAILURE
Mar 27 15:07:37 vesho systemd[2805]: home-odeda-mnt-s3.mount: Failed with result 'exit-code'.

But if s3fs can be taught to ignore the s3:// prefix, that would allow this configuration to work.

Originally created by @guss77 on GitHub (Mar 27, 2023). Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/2139 ### Additional Information #### Version of s3fs being used (`s3fs --version`) 1.90 #### Version of fuse being used (`pkg-config --modversion fuse`, `rpm -qi fuse` or `dpkg -s fuse`) 2.9.9-5ubuntu3 #### Kernel information (`uname -r`) 5.19.0-38-generic #### GNU/Linux Distribution, if applicable (`cat /etc/os-release`) PRETTY_NAME="KDE neon Unstable Edition" NAME="KDE neon" VERSION_ID="22.04" VERSION="Unstable Edition" VERSION_CODENAME=jammy ID=neon ID_LIKE="ubuntu debian" HOME_URL="https://neon.kde.org/" SUPPORT_URL="https://neon.kde.org/" BUG_REPORT_URL="https://bugs.kde.org/" PRIVACY_POLICY_URL="https://kde.org/privacypolicy/" UBUNTU_CODENAME=jammy #### How to run s3fs, if applicable I want to use a systemd mount unit to mount the S3 file system. My best attempt so far is as follows: `~/.config/systemd/user/home-odeda-mnt-s3.mount`: ``` [Unit] Description=My S3 bucket [Mount] What=my-bucket Where=%h/mnt/s3 Options=use_path_request_style,profile=myprofile Type=fuse.s3fs ``` which does call onto s3fs, but the problem is that systemd understands the `what` as a relative path name and it canonicalize it as `%h/my-bucket` before submitting it to `s3fs` (for some reason - I'm not sure why), which results in the following log: #### s3fs syslog messages (`grep s3fs /var/log/syslog`, `journalctl | grep s3fs`, or `s3fs outputs`) ``` Mar 27 15:04:19 vesho s3fs[2728865]: s3fs version 1.90(unknown) : s3fs -o rw,use_path_request_style,profile=myprofile,dev,suid /home/odeda/my-bucket /home/odeda/mnt/s3 Mar 27 15:04:19 vesho s3fs[2728865]: Loaded mime information from /etc/mime.types Mar 27 15:04:19 vesho s3fs[2728865]: s3fs: BUCKET /home/odeda/my-bucket -- bucket name contains an illegal character. Mar 27 15:04:19 vesho systemd[2805]: home-odeda-mnt-s3.mount: Mount process exited, code=exited, status=1/FAILURE Mar 27 15:04:19 vesho systemd[2805]: home-odeda-mnt-s3.mount: Failed with result 'exit-code'. ``` ### Details about issue It would be great if s3fs can be configured (using an option?) or auto-detect that it is called in such a weird way and workaround the issue. One possible solution that I though might make sense is to specify the `What` field as an S3 url (`s3://my-bucket`) - in such a case systemd "understands" that this is a network path and doesn't rewrite it, causing the following s3fs log: ``` Mar 27 15:07:37 vesho s3fs[2736490]: s3fs version 1.90(unknown) : s3fs -o rw,use_path_request_style,profile=myprofile,dev,suid s3://my-bucket /home/odeda/mnt/s3 Mar 27 15:07:37 vesho s3fs[2736490]: s3fs: unable to access MOUNTPOINT s3://my-bucket: No such file or directory Mar 27 15:07:37 vesho systemd[2805]: home-odeda-mnt-s3.mount: Mount process exited, code=exited, status=1/FAILURE Mar 27 15:07:37 vesho systemd[2805]: home-odeda-mnt-s3.mount: Failed with result 'exit-code'. ``` But if s3fs can be taught to ignore the `s3://` prefix, that would allow this configuration to work.
kerem closed this issue 2026-03-04 01:51:18 +03:00
Author
Owner

@guss77 commented on GitHub (Mar 28, 2023):

Terribly sorry about the duplicates - every time I posted, I got a 500 error page, so I thought it didn't submit properly.

<!-- gh-comment-id:1486188900 --> @guss77 commented on GitHub (Mar 28, 2023): Terribly sorry about the duplicates - every time I posted, I got a 500 error page, so I thought it didn't submit properly.
Author
Owner

@knorr3 commented on GitHub (May 2, 2023):

I am using s3fs in combination with systemd mount units without any problems.
What is this %h doing in your configuration?

My config looks like this

What=my-bucket-123456789
Where=/home/ubuntu/my-bucket-123456789  

You also need to add _netdev to your Options (as shown here https://github.com/s3fs-fuse/s3fs-fuse#examples)

<!-- gh-comment-id:1531450942 --> @knorr3 commented on GitHub (May 2, 2023): I am using s3fs in combination with systemd mount units without any problems. What is this `%h` doing in your configuration? My config looks like this ``` What=my-bucket-123456789 Where=/home/ubuntu/my-bucket-123456789 ``` You also need to add `_netdev` to your `Options` (as shown here https://github.com/s3fs-fuse/s3fs-fuse#examples)
Author
Owner

@guss77 commented on GitHub (May 2, 2023):

What is this %h doing in your configuration?

From man systemd.unit:

"%h" - User home directory

You also need to add _netdev to your Options (as shown here https://github.com/s3fs-fuse/s3fs-fuse#examples)

That was indeed the problem - with _netdev, everything works. I must have missed that part in the README, Reading about it in man mount doesn't really explain why this is needed, but man systemd.mount has this to say:

Mount units referring to local and network file systems are distinguished by their file system type specification. In some cases this is not sufficient (for example network block device based mounts, such as iSCSI), in which case _netdev may be added to the mount option string of the unit, which forces systemd to consider the mount unit a network mount.

<!-- gh-comment-id:1531560258 --> @guss77 commented on GitHub (May 2, 2023): > What is this `%h` doing in your configuration? From `man systemd.unit`: > "%h" - User home directory > You also need to add `_netdev` to your `Options` (as shown here https://github.com/s3fs-fuse/s3fs-fuse#examples) That was indeed the problem - with `_netdev`, everything works. I must have missed that part in the README, Reading about it in `man mount` doesn't really explain why this is needed, but `man systemd.mount` has this to say: > Mount units referring to local and network file systems are distinguished by their file system type specification. In some cases this is not sufficient (for example network block device based mounts, such as iSCSI), in which case _netdev may be added to the mount option string of the unit, which forces systemd to consider the mount unit a network mount.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#1089
No description provided.