Systemd-mount for bcachefs: "Where= path is not absolute"

TL;DR: Can’t mount a bcachefs pool with systemd, guess I’ll just use /etc/fstab.
(Also maybe we need a bcachefs tag?)


Hey there.
Here’s what I have put in inside /etc/systemd/system/mash.mount:

[Unit]
Description=BCacheFS pool made up of unwanted drives

[Mount]
What='/dev/sdc:/dev/sdd:/dev/sde:/dev/sdf'
Where=mash.mount
Type=bcachefs
Options=defaults

[Install]
WantedBy=multi-user.target

(I haven’t put an owner, not sure where to do it, likely in the Options section?)

I have checked the paths to the devices with lsblk and ls -la /dev/disk/by-id and systemd-mount --list --full; I am 100% sure they are correct.

So let’s enable the unit and check its status: and then, which gives me:

❯ sudo systemctl enable mash.mount
❯ sudo systemctl status mash.mount
○ mash.mount - BCacheFS pool made up of unwanted drives
     Loaded: loaded (/etc/systemd/system/mash.mount; enabled; preset: disabled)
     Active: inactive (dead)
      Where: /mash
       What: '/dev/sdc:/dev/sdd:/dev/sde:/dev/sdf'

Feb 01 21:02:59 s1 systemd[1]: /etc/systemd/system/mash.mount:10: Where= path is not absolute, ignoring: mash.mount

Tried without the single quotes in the What parameter, same thing. So OK, I have no idea how to fix that because bcachefs docs say that this is the “what” part of mounting it. Next thing I tried:

❯ sudo systemd-mount --type bcachefs --owner dimi '/dev/sdc:/dev/sdd:/dev/sde:/dev/sdf' /mash
Failed to make path /dev/sdc:/dev/sdd:/dev/sde:/dev/sdf absolute: No such file or directory

Puzzling, because looking at the docs, I am putting the “what to mount” first, with single quotes, to make sure it’s a singular argument for zsh, and only then I am putting the desired mount point. Desperate, I tried putting --discover in there as well, but no change.

Finally, just doing this manually:

sudo mount -v -t bcachefs -o uid=dimi,forceuid,gid=wheel,forcegid,rw '/dev/sdc':'/dev/sdd':'/dev/sde':'/dev/sdf' /mash

…works just fine. So if I (we?) can’t make this work I’ll be using good old /etc/fstab.

Any thoughts?

I am really not good at this. I changed the Where like so:

Where=/mash

And then enabling + getting status gives me this:

○ mash.mount - BCacheFS pool made up of unwanted drives
     Loaded: loaded (/etc/systemd/system/mash.mount; enabled; preset: disabled)
     Active: inactive (dead) since Thu 2024-02-01 21:29:08 UTC; 10s ago
   Duration: 57.423s
      Where: /mash
       What: /dev/sdc:/dev/sdd:/dev/sde:/dev/sdf

Feb 01 21:29:08 s1 systemd[1]: mash.mount: Deactivated successfully.

Confusing.

Did you start it?

OK I am giving up for now.

Here are the contents of the unit file:

[Unit]
Description=BCacheFS pool made up of unwanted drives

[Mount]
What=/dev/sdc:/dev/sdd:/dev/sde:/dev/sdf
Where=/mash
Type=bcachefs
Options=uid=dimi,forceuid,gid=wheel,forcegid,rw

[Install]
WantedBy=multi-user.target

And here’s what the bottom of journalctl showed me:

❯ sudo systemctl daemon-reload
❯ journalctl -xe

Feb 01 21:36:08 s1 systemd[1]: dev-sdc:-dev-sdd:-dev-sde:-dev-sdf.device: Job dev-sdc:-dev-sdd:-dev-sde:-dev-sdf.device/start timed out.
Feb 01 21:36:08 s1 systemd[1]: Timed out waiting for device /dev/sdc:/dev/sdd:/dev/sde:/dev/sdf.
░░ Subject: A start job for unit dev-sdc:-dev-sdd:-dev-sde:-dev-sdf.device has failed
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A start job for unit dev-sdc:-dev-sdd:-dev-sde:-dev-sdf.device has finished with a failure.
░░
░░ The job identifier is 28393 and the job result is timeout.
Feb 01 21:36:08 s1 systemd[1]: Dependency failed for BCacheFS pool made up of unwanted drives.
░░ Subject: A start job for unit mash.mount has failed
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A start job for unit mash.mount has finished with a failure.
░░
░░ The job identifier is 28389 and the job result is dependency.
Feb 01 21:36:08 s1 systemd[1]: mash.mount: Job mash.mount/start failed with result 'dependency'.
Feb 01 21:36:08 s1 systemd[1]: dev-sdc:-dev-sdd:-dev-sde:-dev-sdf.device: Job dev-sdc:-dev-sdd:-dev-sde:-dev-sdf.device/start failed with result 'timeout'.

Tried with start, seems to hang forever. Daemon reload seemed to at least time out after 10 or so seconds.

If you have it in fstab, it will automatically create an ephemeral mount file which you could inspect.

Walk me through this, please? I am putting an entry in /etc/fstab and then I run what? sudo mount -a? And then where would the ephemeral mount unit file be? Again in /etc/systemd/system/?

You can get it with systemctl cat mash.mount

❯ sudo mount -a # have already put the right /etc/fstab entry at this point
❯ sudo systemctl daemon-reload
❯ sudo systemctl cat mash.mount
# /run/systemd/generator/mash.mount
# Automatically generated by systemd-fstab-generator

[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
Before=local-fs.target
After=blockdev@dev-sdc:-dev-sdd:-dev-sde:-dev-sdf.target

[Mount]
What=/dev/sdc:/dev/sdd:/dev/sde:/dev/sdf
Where=/mash
Type=bcachefs
Options=uid=dimi,forceuid,gid=wheel,forcegid,rw

The /mash path shows my files, so it seems to be working.

Hm, alright then. Guess I’ll just copy-paste that. Thank you.

OK, I have unmounted the FS, commented out the /etc/fstab entry, commented out the SourcePath in the unit file after copying it inside /etc/systemd/system/, did a daemon reload, nothing. Tried to start it, it hangs up. :man_shrugging:

Here’s the status:

○ mash.mount - BCacheFS pool made up of unwanted drives
     Loaded: loaded (/etc/systemd/system/mash.mount; enabled; preset: disabled)
     Active: inactive (dead) since Thu 2024-02-01 22:10:54 UTC; 3min 33s ago
   Duration: 1min 43.839s
      Where: /mash
       What: /dev/sdc:/dev/sdd:/dev/sde:/dev/sdf
       Docs: man:fstab(5)
             man:systemd-fstab-generator(8)
        CPU: 9ms

Feb 01 22:10:54 s1 systemd[1]: mash.mount: Deactivated successfully.
Feb 01 22:13:50 s1 systemd[1]: Dependency failed for BCacheFS pool made up of unwanted drives.
Feb 01 22:13:50 s1 systemd[1]: mash.mount: Job mash.mount/start failed with result 'dependency'.

Anything else I can do? If not I’ll just uncomment the /etc/fstab entry and be done with this.

I will admit that I know very little about bcachefs, but it doesn’t seem right to me that you are trying to mount whole drives instead of partitions.

No, that’s how it works, it uses the entire device(s).