Cannot mount on MacOS with macFUSE 4.x

I just upgraded from FUSE 3.x to 4.x (now called macFUSE) on Big Sur (Macbook Pro 13 / 2017), and I can’t get restic to mount the repository. I’m using restic 0.11.0 compiled with go1.15.3 on darwin/amd64

Here is the script I run:

# Prompt for repository keys
	read -sp 'Enter B2 account ID: ' accountid
	read -sp 'Enter B2 application key: ' applicationkey
	read -sp 'Enter restic repository password: ' resticpw

# Environment variables needed for all tasks

	export B2_ACCOUNT_ID=$accountid
 	export B2_ACCOUNT_KEY=$applicationkey
	export RESTIC_REPOSITORY="b2:XXXXXX:/"
	export RESTIC_PASSWORD=$resticpw

# Mount

	/Applications/restic mount --verbose 3 ~/Backup

This is the output I get:

repository af42bbe4 opened successfully, password is correct

Mountpoint 3 doesn't exist, creating it

cannot locate OSXFUSE

unable to umount (maybe already umounted or still in use?): unmount 3: operation not permitted

I was able to effectively mount using FUSE 3.x.

Any thoughts?

Welcome back!

Sorry about that, but it’s unlikely we’ll be able to resolve it. Even worse, it’s likely that we’ll have to drop fuse/mount support for macOS entirely. Here’s a bit of background: https://github.com/restic/restic/issues/3096

Thanks for the quick response!

Is there any other solution I could use to mount and browse a backup repository from MacOS? I guess I could downgrade back to Fuse 3.x, but that likely isn’t sustainable. Docker? Any other ideas?

Sadly, there isn’t, at least for now. We have plans to add a WebDAV server which can be mounted on macOS and Windows, but that’s not implement (yet).

btw, in a pinch you could use docker for macos to accomplish this. here’s an example:

docker-compose.yml

version: "2"

services:
  restic:
    build: .
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse:/dev/fuse
    environment:
      - TZ=America/Chicago
      - RESTIC_REPOSITORY=<REPO HERE>
      - RESTIC_PASSWORD=<PASSWORD_HERE>
    ports:
      - "8888:8888"
    volumes:
      - cache:/root/.cache/restic

volumes:
  cache:

Dockerfile

FROM ubuntu:focal

ENV RESTIC_VERSION 0.11.0
ENV RESTIC_URL https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2

RUN apt-get update && apt-get install -y curl fuse python3 \
  && curl -L $RESTIC_URL | bzip2 -d >/usr/local/bin/restic \
  && chmod +x /usr/local/bin/restic \
  && mkdir /root/mnt

COPY cmd.sh /root
CMD ["/root/cmd.sh"]

cmd.sh

#!/bin/bash

python3 -m http.server --directory /root/mnt 8888 &
restic mount /root/mnt

And then run docker-compose up --build and access the mount at http://localhost:8888. A more complete solution would probably be to start a simple webdav server instead of python http server. Perhaps micromata/dave would be a candidate?

Thanks for this! Works well as an interim solution.

I didn’t want to save my password to a file on my laptop, so I tweaked the docker-compose to read this (leaving password bank intentionally):

version: "2"

services:
  restic:
    build: .
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse:/dev/fuse
    environment:
      - TZ=America/Santiago
      - B2_ACCOUNT_ID=XXXXX
      - B2_ACCOUNT_KEY=XXXX
      - RESTIC_REPOSITORY=XXXX
      - RESTIC_PASSWORD
    ports:
      - "8888:8888"
    volumes:
      - cache:/root/.cache/restic

volumes:
  cache:

And then created this script to prompt for the password and run the docker:

#!/bin/bash

read -sp 'Enter restic repository password: ' resticpw
export RESTIC_PASSWORD=$resticpw
docker-compose up --build

I’m sure there are better ways to do this, but this minimum solution worked well for me.

Thanks again!

Gabe

Can anyone where advise the ill-informed, I am trying to spin up the docker container but getting this error:

restic_1  | Fatal: unable to open config file: Stat: stat /Users/david/Desktop/Test/config: no such file or directory
restic_1  | Is there a repository at the following location?
restic_1  | /Users/david/Desktop/Test

the repo+config exists, i can run backup commands on it, but the dockerfile can’t see it.

the previous examples assumed a network endpoint for the restic repository. since you’re trying to use a filesystem path on your mac, you’ll need to expose that to the docker container.

for example, you could add something like the following under volumes:

      - /Users/david/Desktop/Test:/root/repo

and then set RESTIC_REPOSITORY to /root/repo.

if you do that, you’ll likely get an os prompt to allow docker access to Desktop that you’ll need to accept.

Just came across this thread, figured I’d post my workaround for anyone else googling…

First, I created a Docker image that loads the required dependencies into Alpine Linux:

$ cat Dockerfile
FROM alpine:latest

RUN apk update && apk add fuse openssh-client restic
RUN mkdir /restic && chmod 777 /restic

$ docker build -t my-restic .

Then I use plain-vanilla Docker (without Compose) to spin up a container that mounts the repository. It passes through /dev/fuse and grants SYS_ADMIN capability, and sends 2 volumes through to the container: ssh keys and a “drop box” to put restored files into. The RESTIC_REPOSITORY and RESTIC_PASSWORD environment variables come from a .envrc file that my shell picks up.

$ docker run -it --rm -v /Users/<<me>>/.ssh:/root/.ssh -v /Users/<<me>>/restic/dropbox:/dropbox -e RESTIC_PASSWORD -e RESTIC_REPOSITORY --name restic --cap-add SYS_ADMIN --device /dev/fuse daaave/restic restic mount /restic

Aside: Yes, I realize passing one’s entire .ssh directory into a Docker container is a bad idea. This is an example; in “production” I’d create a dedicated keypair and only expose those to the container.

Finally, I can use Docker’s exec command to explore the mounted snapshots and copy files into the drop-box:

$ docker exec -it restic ls -a /restic/hosts/<<machine>/latest/<<path>>
.
..
<<files>>

$ docker exec -it restic cp /restic/hosts/<<machine>>/latest/<<path/to/file/i/want>> /dropbox

Mostly this is useful for navigating the snapshots; I realize individual paths can be restored with a standard restic run on my Mac once known, but once the repository is mounted, might as well just use it.

HTH,
Dave

2 Likes