Nextcloud snap external ftps storage unable to install self-singed certificate

Nextcloud version = 21.0.3snap1
OS= Ubuntu 20.04.2 LTS focal
Apache 2.4
PHP 7.4
MySQL 8

The issue you are facing:

I have openmediavalut ftps and smb server attached to a static ip at home. A month ago, I moved my Nextcloud instance (which was also connected to that static ip at home) to amazon EC2. Since I needed more storage, I wanted to access my openmediavault server at home. I have the firewall configured for my Aws instance to only accessible only from the openmediavault instance, but since openmediavault instance have self-signed certificate, I need to install the certificate to access my openmediavault instance. I tried to install certificate with this comand:

sudo nextcloud.occ security:certificates:import /home/ubuntu/snap/nextcloud/omv.cer
get the output:

2021/07/10 09:14:32.215990 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse /etc/fstab: expected between 3 and 6 fields, found 1

In Certificate.php line 64:

  Certificate could not get parsed.


security:certificates:import <path>

Is this the first time you’ve seen this error? YES

Steps to replicate it:
on a snap install

  1. create a self-singed certificate
  2. run sudo nextcloud.occ security:certificates:import /home/ubuntu/snap/nextcloud/your cer.cer

The output of your Nextcloud log in Admin > Logging:

Error PHP Error: stat(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed at /snap/nextcloud/28403/htdocs/apps/files_external/lib/Lib/Storage/StreamWrapper.php#127 2021-07-10T11:22:04+0300

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' =>
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'passwordsalt' => '*************************',
  'secret' => '*******************************',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'my doman name',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.3.1',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '*******************************************************',
  'installed' => true,
  'instanceid' => 'ocny47h2h3uo',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpauth' => 1,
  'mail_from_address' => '*********************************************',
  'mail_domain' => '*************************************************',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => '************************************************',
  'mail_smtppassword' => '****************************************************,
  'default_phone_region' => 'TR',
  'maintenance' => false,
  'loglevel' => 2,
);

The output of your Apache/nginx/system log in /var/log/____:
not a Apache thing

Try putting the file in /root/snap/nextcloud/current before trying to import it.