Skip to content

[WARN] image commit error 1 error occurred, invalid cross-device link #1958

Closed

Description

@tigerInLuck

I deployed Remark42 through the Dock.

Docker-compose.yml file:

services:
remark42:
image:  ghcr.io/umputun/remark42:latest
container_name: remark42
hostname: remark42
restart: always

ports:
- "127.0.0.1:8080:8080"

env_file:
- /etc/remark42/.env

volumes:
- /var/lib/remark42/data/bbolt.db:/srv/var/db/bbolt.db
- /var/lib/remark42/pictures:/srv/var/pictures
- /var/lib/remark42/avatars:/srv/var/avatars
- /var/lib/remark42/backup:/srv/var/backup
- /var/log/remark42:/srv/var/logs

logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"

When I test posting a photo comment, I found an error message in the log:

remark42  | 2025/10/13 04:01:45.073 [WARN]  image commit error 1 error occurred:

remark42  | * failed to commit image email_83c59b80baf222e8912c581696e095d681887ead/ d3mbtfspjegs72v9dhk0: failed to commit image email_83c59b80baf222e8912c581696e095d681887ead/d3mbtfspjegs72v9dhk0: rename var/pictures.staging/ email_83c59b80baf222e8912c581696e095d681887ead/90/d3mbtfspjegs72v9dhk0 var/pictures/email_83c59b80baf222e8912c581696e095d681887ead/90/d3mbtfspjegs72v9dhk0: invalid cross-device link

remark42  | 2025/10/13 04:10:54.691 [INFO]  remove staging image var/pictures.staging/email_83c59b80baf222e8912c581696e095d681887ead/90/d3mbtfspjegs72v9dhk0, age 14m9.622725285s

error: invalid cross-device link

My picture is lost! How can I solve this problem?

Activity

  1. tigerInLuck commented on Oct 13, 2025

    @tigerInLuck
    Author

    It's OK:

    volumes:
          - /var/lib/remark42:/srv/var
    
  2. umputun commented on Oct 13, 2025

    @umputun
    Owner

    The issue is caused by a filesystem boundary problem with the Docker volume mounting configuration.

    Looking at backend/app/store/image/fs_store.go:63, the code uses os.Rename() to move images from staging to permanent storage:

      if err := os.Rename(stagingImage, permImage); err != nil {
          return fmt.Errorf("failed to commit image %s: %w", id, err)
      }

    The os.Rename() system call only works within the same filesystem. When you try to rename/move a file across different filesystems, it fails with the error invalid cross-device link (EXDEV).

    Why This Happens with Your Docker Setup

    In your docker-compose.yml:

    • Pictures directory (/srv/var/pictures) → mounted to /var/lib/remark42/pictures (external volume/filesystem)
    • Staging directory (/srv/var/pictures.staging) → NOT mounted, stays on container's internal filesystem

    When Remark42 tries to commit an image, it attempts to rename from:

    • Source: /srv/var/pictures.staging/... (container filesystem)
    • Destination: /srv/var/pictures/... (mounted volume filesystem)

    These are two different filesystems, so os.Rename() fails.

    Quick fix for you - Mount the staging directory as a volume too

    moved to discussion, because this is not really a bug report

  3. Repository owner locked and limited conversation to collaborators on Oct 13, 2025
  4. converted this issue into a discussion #1959 on Oct 13, 2025
  5. added this to the v1.15.0 milestone on Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions