hassio-addons: 🐛 [Nextcloud] latest upstream version does not allow to install apps

Description

I can’t enable the External Storage Support App in Nextcloud. When trying to enable it, it says: Error: This app cannot be enabled because it makes the server unstable

I set the Share up as CIFS networkdisks in the Addon Options and rebooted, it looks like sucessful:

[09:22:50] INFO: ...... //192.168.xxx.xxx/SERVER/SHARE1/Subfolder successfully mounted to /mnt/Subfolder with options rw,file_mode=0775,dir_mode=0775,username=user-smb-nextcloud,password=XXXXXXXXXX,nobrl,uid=1000,gid=1000,iocharset=utf8

Any Idea how to resolve that Issue?

Reproduction steps

1. Set up CIFS Share
2. Reboot the Nextcloud-Addon
3. Open the Nextcloud UI, navigate to Apps-> Find "External Storage Support"
4. Click on "Enable"

Addon Logs

Add-on version: 28.0.4
 You are running the latest version of this add-on.
 System: Home Assistant OS 12.1  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2024.3.3
 Home Assistant Supervisor: 2024.03.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
 Defining permissions for main user : 
User UID: 1000
User GID : 1000
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
Full_Text_Search='false'
OCR='false'
OCRLANG='fra'
PGID='1000'
PUID='1000'
additional_apps='inotify-tools'
certfile='fullchain.pem'
cifspassword='xxxxxxxxxxxxx'
cifsusername='xxxxxxxxxxxxx'
default_phone_region='DE'
elasticsearch_server='<ip:port>'
enable_thumbnails='false'
keyfile='privkey.pem'
networkdisks='//192.168.xxx.xxx/SERVER/SHARE1/Subfolder/'
trusted_domains='ha.mydomain.com, ha-dev.mydomain.com'
use_own_certs='true'
/etc/cont-init.d/00-local_mounts.sh: executing
/etc/cont-init.d/00-smb_mounts.sh: executing
Mounting smb share(s)...
... using PUID 1000 and PGID 1000
... mounting //192.168.xxx.xxx/SERVER/SHARE1/Subfolder
[09:22:50] INFO: ...... //192.168.xxx.xxx/SERVER/SHARE1/Subfolder successfully mounted to /mnt/Subfolder with options rw,file_mode=0775,dir_mode=0775,username=user-smb-nextcloud,password=XXXXXXXXXX,nobrl,uid=1000,gid=1000,iocharset=utf8
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory

Load environment variables from /config/addons_config/nextcloud-ocr/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /homeassistant/addons_config/nextcloud-ocr/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables

... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /homeassistant/addons_config/nextcloud-ocr/nextcloud-ocr.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/01-folders.sh: executing
Setting user to 1000:1000
Updating permissions...
... Config directory : /data
... data directory detected : /share/nextcloud
... setting permissions
... done
 
/etc/cont-init.d/02-init_steps.sh: executing
/etc/cont-init.d/02-mariadb_discovery.sh: executing
/etc/cont-init.d/30-ssl.sh: executing
Using referenced ssl certificates
... checking if referenced files exist
... done
/etc/cont-init.d/99-add_packages.sh: executing
/etc/cont-init.d/99-elasticsearch.sh: executing
/etc/cont-init.d/99-ocr.sh: executing
/etc/cont-init.d/99-trusted_domains.sh: executing
 
Starting the upstream container
 
[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────

using keys found in /data/config/keys
Initializing nextcloud 28.0.4.1 (this can take a while) ...
Setting permissions
Initializing finished
Starting...
/etc/cont-init.d/02-init_steps.sh: executing
Setting logs
 
----------------------------------------
 Nextcloud 28.0.4.1 is installed 
----------------------------------------
 
... checking for app updates
... Clean potential errors
Maintenance mode already disabled
... Remove CODE if installed as not compatible
... Define default_phone_region
System config value default_phone_region set to string DE
... Disabling check_data_directory_permissions
System config value check_data_directory_permissions set to boolean false
... disabling thumbnails
System config value enable_previews set to string false
/etc/cont-init.d/02-mariadb_discovery.sh: executing
    0 [>---------------------------]    0 [->--------------------------]---
MariaDB addon was found! It can't be configured automatically due to the way Nextcloud works, but you can configure it manually when running the web UI for the first time using those values :
Database user : service bashio::log.blue Database user : service
Database password : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Database name : nextcloud
Host-name : core-mariadb:3306
---
/etc/cont-init.d/99-add_packages.sh: executing
[09:23:32] INFO: Installing additional apps :
... inotify-tools
/etc/cont-init.d/99-elasticsearch.sh: executing
/etc/cont-init.d/99-ocr.sh: executing
/etc/cont-init.d/99-trusted_domains.sh: executing
[09:23:35] INFO: Currently set trusted domains :
192.168.xxx.xxx:8099
ha.mydomain.com
ha-dev.mydomain.com
[09:23:36] INFO: Trusted domains set in the configuration. Refreshing domains.
[09:23:36] INFO: ... removing previously added trusted domain (except for first one created)
System config value trusted_domains => 2 deleted
System config value trusted_domains => 3 deleted
System config value trusted_domains => 4 deleted
System config value trusted_domains => 5 deleted
[09:23:41] INFO: ... alignement with trusted domains list : ha.mydomain.com, ha-dev.mydomain.com
[09:23:41] INFO: ... adding ha.mydomain.com
System config value trusted_domains => 6 set to string ha.mydomain.com
[09:23:42] INFO: ... adding ha-dev.mydomain.com
System config value trusted_domains => 7 set to string ha-dev.mydomain.com
[09:23:43] INFO: Remaining configurated trusted domains :
[09:23:44] INFO: 192.168.xxx.xxx:8099
ha.mydomain.com
ha-dev.mydomain.com
 
Starting the upstream container
 
[custom-init] No custom files found, skipping...
crond: crond (busybox 1.36.1) started, log level 8
[ls.io-init] done.
[05-Apr-2024 09:23:45] NOTICE: fpm is running, pid 1406
[05-Apr-2024 09:23:45] NOTICE: ready to handle connections

Architecture

No response

OS

HAos

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Comments: 51 (23 by maintainers)

Commits related to this issue

Most upvoted comments

According to this “https://www.reddit.com/r/NextCloud/comments/1bqf8wp/2804_error_this_app_cannot_be_enabled_because_it/” you could enable it manually by running occ app:enable files_external after going in the container using portainer. This link also confirms that it is not linked to the addon, but to the upstream container… Good luck!

i can confirm this is workaround working!

Ok, you probably didn’t get the message. So I will try to explain in more straightforward way.

It is rude to start switch to other language that the one in which given topic is discussed. It is rude because you automatically expect that other people who cooperate on the issuse will now start using translator just to overcome your inabilities.

So thank you, that next time you will try to use English.

Ok, vous n’avez probablement pas compris le message. Je vais donc essayer de vous expliquer de manière plus simple.

Il est impoli de commencer à passer à une autre langue que celle dans laquelle le sujet donné est abordé. C’est impoli car vous vous attendez automatiquement à ce que d’autres personnes qui coopèrent sur le problème commencent désormais à utiliser un traducteur juste pour surmonter vos incapacités.

Alors merci, la prochaine fois, vous essaierez d’utiliser l’anglais.

Sorry guys, my Klingon is little bit rusty, would you please prefer to speak UN galactic standard?

Hélas il est peu recommandé de revenir sur des versions précédentes de Nextcloud, car cela peut causer des problèmes de corruption de database… La solution la plus simple a court terme est d’éviter d’utiliser ssl car le problème de base est sur la redirection https -> http ; sinon je vais tenter de regarder mais cela ne dois pas être évident à faire car l’issue est ouverte depuis un moment sur nextcloud : https://github.com/nextcloud/server/issues/44685

yes I’ve checked using portainer that the files are modifed and I’ve tried in incognito mode to avoid the cache ; I’ll try again tomorrow but don’t see what else to do

For sure the file is used though - if I delete it then the apps page doesn’t work anymore

BUT beware, this are not the issues! just check some of them, they are completely fine, having inside strings like.

		/**
		 * @type UserConfig
		 * @see /apps/files/lib/Service/UserConfig.php
		 */
		_filesConfig: undefined,

I really think, that that fix is only where the original nextcloud commit has:

return api.get(generateUrl('apps/files'))

and that seems to be only at one place - the one you already fixed:

# nextcloud$ grep -R -l "generateUrl('apps/files')" *
dist/settings-vue-settings-apps-users-management.js.map

and correspondig minified dist/settings-vue-settings-apps-users-management.js:

grep -R -l '"apps/files"' *
dist/settings-vue-settings-apps-users-management.js

So to my best knowledge it shall be working…

Not all are javascripts, only those

# nextcloud$ grep -R -l 'apps/files' * | grep '.js'
apps/files_pdfviewer/js/files_pdfviewer-public.js.map
apps/files_pdfviewer/js/files_pdfviewer-vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-DBGB1Rec_mjs.js
apps/files_pdfviewer/js/files_pdfviewer-main.js
apps/files_pdfviewer/js/files_pdfviewer-vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-DBGB1Rec_mjs.js.map
apps/files_pdfviewer/js/files_pdfviewer-main.js.map
apps/files_pdfviewer/js/files_pdfviewer-public.js
apps/bruteforcesettings/js/bruteforcesettings-vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-DBGB1Rec_mjs.js
apps/bruteforcesettings/js/bruteforcesettings-vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-DBGB1Rec_mjs.js.map
apps/files_sharing/js/public.js
apps/files_sharing/openapi.json
apps/federatedfilesharing/js/external.js
apps/files_trashbin/openapi.json
apps/files_reminders/openapi.json
apps/viewer/js/viewer-main.mjs.map
apps/viewer/js/viewer-main.mjs
apps/files_downloadlimit/js/files_downloadlimit-admin.mjs
apps/files_downloadlimit/js/files_downloadlimit-admin.mjs.map
apps/files_downloadlimit/js/files_downloadlimit-main.mjs
apps/files_downloadlimit/js/files_downloadlimit-main.mjs.map
apps/text/js/vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-DM4uLuEW_mjs-node_modules_nextc-b13f7b.js.map
apps/text/js/vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-DM4uLuEW_mjs-node_modules_nextc-b13f7b.js
apps/files_external/js/settings.js
apps/files_external/openapi.json
apps/notifications/js/notifications-vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-ClzJbciL_mjs.js.map
apps/notifications/js/notifications-vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-ClzJbciL_mjs.js
apps/photos/js/photos-vendors-node_modules_nextcloud_upload_node_modules_nextcloud_dialogs_dist_chunks_FilePicker-0-aee94f.js
apps/photos/js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js
apps/photos/js/photos-vendors-node_modules_nextcloud_upload_node_modules_nextcloud_dialogs_dist_chunks_FilePicker-0-aee94f.js.map
apps/photos/js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js.map
apps/files_versions/openapi.json
apps/privacy/js/privacy-vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-DBGB1Rec_mjs.js.map
apps/privacy/js/privacy-vendors-node_modules_nextcloud_dialogs_dist_chunks_FilePicker-DBGB1Rec_mjs.js
apps/privacy/js/privacy-main.js.map
apps/privacy/js/privacy-main.js
apps/files/js/filelist.js
apps/files/js/tagsplugin.js
apps/files/js/recentfilelist.js
apps/files/js/files.js
apps/files/js/app.js
apps/files/openapi.json
core/js/tests/specs/coreSpec.js
core/js/tests/specHelper.js
dist/files_external-init.js
dist/settings-vue-settings-apps-users-management.js.map
dist/files_sharing-personal-settings.js
dist/files_sharing-additionalScripts.js.map
dist/files_sharing-main.js.map
dist/core-unified-search.js.map
dist/9558-9558.js
dist/files-main.js.map
dist/files_reminders-init.js
dist/files_sharing-init.js.map
dist/files-init.js.map
dist/files_versions-files_versions.js
dist/files_sharing-files_sharing_tab.js.map
dist/files_sharing-collaboration.js.map
dist/files_trashbin-main.js.map
dist/7560-7560.js
dist/4997-4997.js.map
dist/files-init.js
dist/files_sharing-init.js
dist/files-personal-settings.js
dist/files-main.js
dist/files_reminders-init.js.map
dist/files_external-init.js.map
dist/files_sharing-additionalScripts.js
dist/files_trashbin-main.js
dist/systemtags-init.js.map
dist/files-personal-settings.js.map
dist/files_sharing-personal-settings.js.map
dist/4997-4997.js
dist/files-search.js.map
dist/7560-7560.js.map
dist/files-reference-files.js.map
dist/files-sidebar.js
dist/files_versions-files_versions.js.map
dist/core-unified-search.js
dist/settings-vue-settings-apps-users-management.js
dist/files-reference-files.js
dist/files-sidebar.js.map
dist/settings-vue-settings-apps-users-management.js.map.ptched
dist/core-main.js.map
dist/9558-9558.js.map

Yep, as I am afraid that single function in src is on many more places…

# nextcloud$ grep -R 'apps/files' * | wc -l 
174

No worry, I don’t know anything about JS either, just quick googled info. 😃

echo “Modifying source” sed -i ‘s|apps/files|apps/files/|g’ /app/www/src/dist/settings-vue-settings-apps-users-management.js.map sed -i ‘s|apps/files|apps/files/|g’ /app/www/src/dist/settings-vue-settings-apps-users-management.js

Yep, this modified version should do the trick.

Based on my knowledge minified file would be used. So to be safe you need to modify both.

I was wrong

you need to edit:

settings-vue-settings-apps-users-management.js

and replace string "apps/files" by "apps/files/"

The map file is just kind of optional to modify.

this is how it look in the minified code:

(e.commit(“startLoading”,n),e.commit(“startLoading”,“install”),v((0,p.Jv)(“settings/apps/enable”),{appIds:n,groups:i}).then((r=>(e.commit(“stopLoading”,n),e.commit(“stopLoading”,“install”),n.forEach((t=>{e.commit(“enableApp”,{appId:t,groups:i})})),g((0,p.Jv)(“apps/files”)).then((()=>{r.data.update_required&&((0,c.cf)(t(“settings”,“The app has been enabled but needs to be updated. You will be redirected to the update page in 5 seconds.”),{onClick:()=>window.location.reload(),close:!1}),setTimeout((function(){location.reload()}),5e3))})).cat

I’ll try to use this file on my instance at boot to check if it works As there are two files!

dist/settings-vue-settings-apps-users-management.js

and

dist/settings-vue-settings-apps-users-management.js.map

Based on my knowledge minified file would be used. So to be safe you need to modify both.

wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
cd nextcloud/
grep -R "return api.get(generateUrl('apps/files'))" *
> dist/settings-vue-settings-apps-users-management.js.map
....
garbage one line output here...

So yep, it seem that source js is minified…

Awesome, yes its working Great and instantly! I wish i would have as much as Knowledge. Thank you so much for helping me out there! 👍 👍

For Reference: If somebody is looking for a Way to do file Operations directly in the Nextcloud Data Folder, and to make them visible in Nextcloud via syncing - this is your Copy, Paste and Restart Addon Solution 💯

Hi, sorry I wrote that code from my couch without testing it 😃 Here is a code tested as working :

#!/usr/bin/with-contenv bashio
# shellcheck shell=bash

#################
# CODE INJECTOR #
#################

# Any commands written in this bash script will be executed at addon start
# See guide here : https://github.com/alexbelgium/hassio-addons/wiki/Add%E2%80%90ons-feature-:-customisation

# Runs only after initialization done
# shellcheck disable=SC2128
mkdir -p /scripts
if [ ! -f /app/www/public/occ ]; then cp /config/addons_autoscripts/"$(basename "${BASH_SOURCE}")" /scripts/ && exit 0; fi

echo "Scanning files"
sudo -u abc php /app/www/public/occ files:scan --all
echo "This is done !"

Hi,

To begin with, I’ve encoutered the same issue as you regarding the unability to install new apps. After investigating it is confirmed to be an upstream issue : https://github.com/linuxserver/docker-nextcloud/issues/422 . To solve it I’ve installed portainer, then manually enabled additional apps using for example occ app:enable external for the “external” app

Regarding the usage of startup script, you probably should try with

echo "Scanning files"
sudo -u abc php /app/www/public/occ files:scan --all
echo "This is done !"

In theory it should work 😃

Thank you so much for taking your Time and showing and explaining my Option! As im still in the Phase of observing how it works with my system, i think ill keep the standard Setup by now. Sooner or later (maybe sooner 😄) ill start from scratch anyway, using a big ssd as storage.

The Hint with autoscript, and Options to run that is superhelpful! Thanks! Will give it a shot during the next Days…

I’ll keep that Ticket open in Case something change. I can just add: I restored the second last Version from an older Homeassistant-Backup. Indeed, with Nextcloud 28.0.3 there is no problem at all, i could add external Folders right away. In case somebody has the same Problems and an older Backup…

Thanks again mate! The only Problem with your great Addon-Collection: Too many Temptations. If id use all interesting ones it’s surely screw my RPi… 😄

Hello! Indeed if you want to use your external drive it would likely be more preferable that you restart from scratch, and directly use /mnt/subfolder/nextcloud as a data folder. This is how my own system is configured. I don’t think nextcloud allows to add additional folders after initial config but I might be wrong…

Another way would be that you could have a script that periodically moves your files. For example, an automation that executes every 30 minutes a cp command so that everytime someone uploads to the folder it gets copied to a folder visible by nextcloud ? Usually I simply use the nextcloud app, which allows uploading directly to the nextcloud folders 😃

To run custom commands I don’t think it’s easy to do it from a shell_command as those run in the homeassistant container, while you would need to run it in the nextcloud container… The easiest way is to use my autoscript feature, that allows you to manually run commands when the addon starts : https://github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-customisation . As this is injected as addon start, it will also stay there even when updating the addon, which would not be the case if you modify the code directly using portainer. There is then two ways to run it regularly:

  • By restarting the addon : What I’ve done to trigger a backup of my files for example is embed a “cp -rnf /mnt/disk/* /mnt/backupdisk/*” in the startup script of one of my addon, and make an automation to restart this addon nightly. This allows the code to run nightly within the addon.
  • By cron : Of course here you would likely prefer a regular trigger, so the best way would be to use this code injection to create a cron job…

Hope this is helpful to you 😃

And thanks for the very kind words and appreciation !

According to this “https://www.reddit.com/r/NextCloud/comments/1bqf8wp/2804_error_this_app_cannot_be_enabled_because_it/” you could enable it manually by running occ app:enable files_external after going in the container using portainer. This link also confirms that it is not linked to the addon, but to the upstream container… Good luck!

Hi, I see the same issue on my instance but I think it is more due to nextcloud than the addon… Perhaps an incompatibility of version? I think you’d have more chance posting on their forum where they have seemed to have encountered that issue before : https://help.nextcloud.com/t/external-storage-support-cannot-be-enabled/120830

But anyway you don’t really need it : you can use the /mnt/Subfolder folder as if it was a native folder - this app is only used if you want to mount the SMB drive from nextcloud