Skip to content

No preview of office files anymore and ImagickException: unable to open image #17984

Closed

Description

@schibu83

Since the latest update to 17.0.1 from 16.0.5 the preview-generation for office files (xlsx, docx, pptx) is broken. Previews that were already generated in the past, are still there.
In the logfiles, there are error messages for the new generated or uploaded files. Suspiscious: The preview trys to generate a preview for filename.png instead of filename.xlsx

Steps to reproduce

  1. Install the preview generator from the apps
  2. enable office preview in config.php
  3. Upload office Document or create office document with onlyoffice/ collabora online
  4. reload page or execute cronjob that generates Previews

Expected behaviour

The preview of the document should be visible in the browser instead of the generic filetype-icon

Actual behaviour

no preview is generated, instead there are errors in the log:

ERROR core:

ImagickException: unable to open image `/mnt/xxx/nextcloud/data/xxx/files/Tabelle (2).png': No such file or directory @ error/blob.c/OpenBlob/2701

and

ERROR PHP:

unlink(/mnt/xxx/nextcloud/data/xxx/files/Tabelle (2).png): No such file or directory at /var/www/html/nextcloud/lib/private/Preview/Office.php#65

Server configuration

Operating system:
Debian Stretch, latest updates 18.11.2019

Web server:
nginx/1.10.3

Database:
10.1.41-MariaDB-0+deb9u1 - Debian 9.9

PHP version:
7.2.24-1+020191026.31+debian91.gbpbbacde

Nextcloud version: (see Nextcloud admin page)
17.0.1

Updated from an older Nextcloud/ownCloud or fresh install:
16.0.6

Where did you install Nextcloud from:
official server download-file

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
Enabled:
  - activity: 2.10.1
  - admin_audit: 1.7.0
  - calendar: 1.7.1
  - cloud_federation_api: 1.0.0
  - comments: 1.7.0
  - contacts: 3.1.6
  - dav: 1.13.0
  - event_update_notification: 1.0.0
  - external: 3.4.1
  - federatedfilesharing: 1.7.0
  - files: 1.12.0
  - files_accesscontrol: 1.7.0
  - files_automatedtagging: 1.7.0
  - files_external: 1.8.0
  - files_fulltextsearch: 1.3.6
  - files_fulltextsearch_tesseract: 1.3.1
  - files_pdfviewer: 1.6.0
  - files_rightclick: 0.15.1
  - files_sharing: 1.9.0
  - files_trashbin: 1.7.0
  - files_upload_mtime: 0.1.0
  - files_versions: 1.10.0
  - files_videoplayer: 1.6.0
  - firstrunwizard: 2.6.0
  - fulltextsearch: 1.3.6
  - fulltextsearch_elasticsearch: 1.4.0
  - gallery: 18.4.0
  - groupfolders: 5.0.4
  - impersonate: 1.4.0
  - logreader: 2.2.0
  - lookup_server_connector: 1.5.0
  - mail: 0.18.1
  - metadata: 0.10.0
  - notes: 3.0.3
  - notifications: 2.5.0
  - oauth2: 1.5.0
  - ocr: 4.4.17
  - onlyoffice: 3.0.2
  - password_policy: 1.7.0
  - previewgenerator: 2.1.0
  - privacy: 1.1.0
  - provisioning_api: 1.7.0
  - rainloop: 6.0.4
  - recommendations: 0.5.0
  - serverinfo: 1.7.0
  - sharebymail: 1.7.0
  - socialsharing_email: 1.0.6
  - support: 1.0.1
  - systemtags: 1.7.0
  - text: 1.1.1
  - theming: 1.8.0
  - twofactor_backupcodes: 1.6.0
  - updatenotification: 1.7.0
  - user_external: 0.7.0
  - video_converter: 0.1.2
  - viewer: 1.2.0
  - workflow_pdf_converter: 1.2.0
  - workflowengine: 1.7.0
Disabled:
  - accessibility
  - encryption
  - federation
  - nextcloud_announcements
  - survey_client
  - user_ldap

Nextcloud configuration:

Config report
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "17.0.1.1",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "updater.release.channel": "stable",
        "maintenance": false,
        "theme": "",
        "loglevel": 2,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": "true",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0,
            "dbindex": 0
        },
        "enable_previews": true,
        "preview_libreoffice_path": "\/usr\/bin\/libreoffice",
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\Illustrator",
            "OC\\Preview\\Movie",
            "OC\\Preview\\MSOffice2003",
            "OC\\Preview\\MSOffice2007",
            "OC\\Preview\\MSOfficeDoc",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\PDF",
            "OC\\Preview\\Photoshop",
            "OC\\Preview\\Postscript",
            "OC\\Preview\\StarOffice",
            "OC\\Preview\\SVG",
            "OC\\Preview\\TIFF",
            "OC\\Preview\\Font"
        ],
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "user_backends": [
            {
                "class": "OC_User_IMAP",
                "arguments": [
                    "***REMOVED SENSITIVE VALUE***",
                    993,
                    "ssl"
                ]
            }
        ],
        "app_install_overwrite": [
            "files_upload_mtime"
        ],
        "mysql.utf8mb4": true,
        "onlyoffice": {
            "verify_peer_off": true
        },
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

LDAP config
With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:
Safari 13.0.3
Firefox 70.0.1 (64-Bit)

Operating system:
Mac OS 10.14.6

Activity

  1. added
    0. Needs triage
    on Nov 18, 2019
  2. kesselb commented on Nov 18, 2019

    @kesselb
    Contributor

    $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);

    Could you look for above line and add the following debug code: \OC::$server->getLogger()->debug('Create thumbnail with libreoffice: "' . $exec . '"');

  3. schibu83 commented on Nov 19, 2019

    @schibu83
    Author

    $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);

    Could you look for above line and add the following debug code: \OC::$server->getLogger()->debug('Create thumbnail with libreoffice: "' . $exec . '"');

    Hello kesselb!

    Thank you for your reply. I added the line right after the line 51. But the log looks exactly the same. What did I wrong? :-)

  4. kesselb commented on Nov 19, 2019

    @kesselb
    Contributor

    Probably the message is not logged.

    /**
    * Loglevel to start logging at. Valid values are: 0 = Debug, 1 = Info, 2 =
    * Warning, 3 = Error, and 4 = Fatal. The default value is Warning.
    *
    * Defaults to ``2``
    */
    'loglevel' => 2,

  5. schibu83 commented on Nov 19, 2019

    @schibu83
    Author

    Sorry, that's it. Changed the loglevel to "0" an now there is a debug message in the log:
    {"reqId":"gwSrYCaDSgJmtJ03yZeI","level":0,"time":"2019-11-19T10:34:35+00:00","remoteAddr":"xxx.xxx.xxx.xxx","user":"xxx","app":"no app in context","method":"GET","url":"/core/preview?fileId=214696&x=32&y=32","message":"Create thumbnail with libreoffice: \"/usr/bin/libreoffice -env:UserInstallation=file://'/tmp/owncloud-oc4bdnmao21f/' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '/tmp' '/mnt/xxx/nextcloud/data/xxx/files/Tabelle (2).xlsx'\"","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15","version":"17.0.1.1","id":"5dd3c5406c993"}

    or formated:

    [no app in context] Debug: Create thumbnail with libreoffice: "/usr/bin/libreoffice -env:UserInstallation=file://'/tmp/owncloud-oc4bdnmao21f/' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '/tmp' '/mnt/xxx/nextcloud/data/xxx/files/Tabelle (2).xlsx'"
    
    GET /core/preview?fileId=214696&x=32&y=32
    from xxx.xxx.xxx.xxx by xxx at 2019-11-19T10:34:35+00:00
    
  6. A-Barta commented on Nov 20, 2019

    @A-Barta

    I've opened an issue on the same problem, see #17864

  7. kesselb commented on Nov 20, 2019

    @kesselb
    Contributor

    Cool 👍 I checked the code yesterday and was wondering about that. We are looking for the png at the wrong place.

  8. kesselb commented on Dec 18, 2019

    @kesselb
    Contributor

    Fixed by #18456

  9. SKB-CGN commented on Nov 29, 2021

    @SKB-CGN

    Hi,
    seems, that the error comes again with Nextcloud 22.2.3 after upgrade.

    I do not see office previews anymore.

    Error core ImagickException: unable to open image '/tmp//Address.png': No such file or directory @ error/blob.c/OpenBlob/3533
    Error PHP Error: unlink(/tmp//Address.png): No such file or directory at /usr/local/www/nextcloud/lib/private/Preview/Office.php#66

    Seems, that the instance-id or the folder is not returned properly.

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

    0. Needs triagebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions