Home Assistant addon : FileBrowser

my configuration of HA
hardware, Odroid M1
Add-on version: 1.78.1
System: Home Assistant OS 10.5 (aarch64 / odroid-m1)
Home Assistant Core: 2023.9.2
Home Assistant Supervisor: 2023.09.2

When trying to access webUI for immich it keeps loading until eventually gives error “can’t reach this page”
I checked logs and I find there are issues with postgres DB initiation.
first error:

psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Error : /etc/cont-init.d/99-database.sh exiting 2
/etc/cont-init.d/99-deprecation: executing

Later on I get such repeated errors:

[Nest] 758 - 09/18/2023, 10:20:10 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)…
Error: connect ECONNREFUSED 172.30.32.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)

I am new with HA in general so sorry if it is something simple I am missing but would appreciate for help

btw it also give high recommendation to update Redis :slight_smile:

Fresh install, cant upload anything :frowning:

Error code:

Upload failed: Error: tus: unable to resume upload (new upload cannot be created without an endpoint), originated from request (method: HEAD, url: /api/hassio_ingress/7AYVWZdoQoVjFJoGZmpaawxyBGHyTnAY0oBd5VAFnf4/api/tus/config/www/icons/weather_icons/animated/clear-day.svg?override=false, response code: 405, response text: , request id: n/a)

Hi, this is a known issue from Filebrowser with cloudflare. Please look here : Unable to upload files · Issue #2593 · filebrowser/filebrowser (github.com)

I don’t use CF

One thing you could do is try uploading while connecting with a local ip instead of your domain. This would allow to troubleshoot source of issue

I use local ip

1 Like

Hi, connecting with ip:port works ; it’s the ingress part that is broken due to a new feature that filebrowser has includes (tus.io) that doesn’t seem compatible with the ingress proxy.

Thanks for your wonderful work.
I have a problem with the Immich plugin. I used localdisk as sdb to mount my second raid disk and it worked fine, Immich see all my photos.
After a reboot the raid disk became sda and everything broke.
I’m sorry but I don’t know how to use the labels because I don’t have any partitions on the disk
This is my fdisk

Disk /dev/sda: 16.37 TiB, 18000207937536 bytes, 35156656128 sectors
Disk model: RAID 5/6 SAS 6G
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: MTFDDAK120MBB-1A
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 06998C22-CBD3-47C6-9A60-E3465D5CC774

Device         Start       End   Sectors   Size Type
/dev/sdb1       2048   1050623   1048576   512M EFI System
/dev/sdb2    1050624 232441855 231391232 110.3G Linux filesystem
/dev/sdb3  232441856 234440703   1998848   976M Linux swap

Is it possible to use localdisk mounting by-id to avoid /dev/sdX changing?
Before switching to your plugin I was using immich directly with docker compose and had added a volume through the docker-compose.yml file. This also allowed the length of the path to be reduced
Someone can help me?

Hi, my code detects and support devpath=/dev ; devpath=/dev/disk/by-uuid ; devpath=/dev/disk/by-label. So I would recommend if you have an uuid, to put as localdisk /dev/disk/by-uuid/YOURUUID

Otherwise you could use e2label in the addon Advanced SSH & Web Terminal to set a label.

It worked, thank you!
My problem now is filepath is really too long
/mnt/78c1b9c6-24e6-4709-bd7c-10f204cb0df7/immich
I would like to set a label to short filepath but I can’t because my drive does not have a partition and e2label can’t set a label directly on a disk, but only on partition
Do you know a workaround?

Hi, you can use my automatic script system : Add‐ons feature : customisation · alexbelgium/hassio-addons Wiki (github.com)

In the log you’ll find at a line starting with 01-custom_script.sh the location of a script that is executed at boot.

You need to create that file using the Filebrowser addon with the content below and use /mnt/immich as folder. Guess it should be the easiest way. Alternative: avoid using localdisk altogether and just use a script like the second one

#!/bin/bash
mkdir -p /mnt/immich
ln -s /mnt/78c1b9c6-24e6-4709-bd7c-10f204cb0df7/immich /mnt/immich
echo "symlink done"
#!/bin/bash
mkdir -p /mnt/immich
mount /dev/disk/by-uuid/78c1b9c6-24e6-4709-bd7c-10f204cb0df7 /mnt/immich
echo "disk mounted"

Hi.
I am using Home Assistant Supervised installed on headless mini-PC in my local home network.
The router in my home network doesn’t have static IP address (my ISP doesn’t provide such ability). So I setup external cloud VDS server (with static IP) to access my HA from internet.
The connection between my mini-PC and VDS server implemented via SSH tunnel. So I have access to HA from internet via VDS with static IP. It works fine.
The problem is when I try to delete/edit file using Filebrowser addon, I get error message:
image
Another addon “File Editor” can edit/delete files without problems.
What’s wrong with “File Browser”?

Hi @alexbelgium, the filebrowser loading of my camera recordings folder has gone back to being extremely slow, in fact it currently tries to load the files and eventually fails with the message “Something really went wrong”. The folder contains a large number of files (camera recordings), but the buit-in Media Browser and Samba still load the folder within seconds. As a reminder, the reason I’d prefer to use filebrowser to access the folder is the ability to sort the files, which the built-in media browser lacks.

The filebrowser.sh file above is still in my \addon_configs\db21ed7f_filebrowser folder, and looks like it’s being ran during boot. Are there any modifications that I need to make for it to work again?

Alas there should be no reason. --disable-preview-resize --disable-type-detection-by-header is now embedded in the main code so you shouldn’t need the filebrowser.sh code. Is there any error messages in the launch log ? Did it start with a specific version ?

Pretty sure this is due to nging. Really hard to diagnose as I can’t replicate your exact system or issue… Only element I can thing of is that we could semi-blindly try injecting custom nginx commands, but it would be hit & miss

I think it started with the update that changed the location of the addon files to the new /addon_configs, but I can’t remember the exact version I was running at that time. I should have communicated then, but got caught up, sorry. No errors in the log, it just tries to load the files and then give the “Something really went wrong” error message.

1 Like

Thanks. Could you please try to modify the script as such (new location is /addon_configs/db21ed7f_filebrowser/filebrowser.sh ; or /config/filebrowser.sh from within Filebrowser)

#!/bin/bash

echo "correcting the cache folder"
sed -i 's|--cache-dir="\.\\cache|--cache-dir="/cache|g' /etc/cont-init.d/99-run.sh

And if it doesn’t work, we can go one step further by disabling preview :

#!/bin/bash

echo "correcting the cache folder and disabling thumbnails"
sed -i 's|--cache-dir="\.\\cache|--disable-thumbnails --cache-dir="/cache|g' /etc/cont-init.d/99-run.sh

EDIT : in my initial script the cache folder was invalid. Please try also this code to disable it while keeping thumbnails :

#!/bin/bash

echo "removing the cache folder"
sed -i 's|--cache-dir="\.\\cache||g' /etc/cont-init.d/99-run.sh

No luck with either script unfortunately. The echo command is being displayed in the log, so the script is definitely being executed. Of note, your third script gave me an error for unmatched ", so I edited as such sed -i 's|--cache-dir="\.\\cache"||g' /etc/cont-init.d/99-run.sh, not sure if that’s correct.

I’m wondering if the issue is with the syntax of the sed command? I’m unfortunately not familiar enough with the sed command to figure it out, although I’m in the process of doing some reading for my own learning.

See the log output below from one of the runs, including me trying to open the folder. The log output is the same regardless of which script I run

Starting...
/etc/cont-init.d/00-banner.sh: executing

-----------------------------------------------------------
 Add-on: Filebrowser
 filebrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files
-----------------------------------------------------------
 Add-on version: 2.23.0_8
 You are running the latest version of this add-on.
 System: Home Assistant OS 11.2  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2023.12.4
 Home Assistant Supervisor: 2023.12.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
NoAuth='true'
base_folder='/media'
certfile='fullchain.pem'
keyfile='privkey.pem'
smbv1='false'
ssl='false'
/etc/cont-init.d/00-local_mounts.sh: executing
/etc/cont-init.d/00-smb_mounts.sh: executing
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory

Load environment variables from /config/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f-filebrowser/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 /config/filebrowser.sh if existing
---------------------------------------------------------
If accessing the file with filebrowser it should be mapped to /config/*-filebrowser/filebrowser.sh
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
... script found, executing
correcting the cache folder and disabling thumbnails
/etc/cont-init.d/20-folders.sh: executing
/etc/cont-init.d/99-run.sh: executing
[14:07:17] INFO: NoAuth option selected
[14:07:17] INFO: Starting...
2023/12/30 14:07:17 No config file used
2023/12/30 14:07:17 Listening on [::]:8080
[14:07:17] INFO: Started !
[30/Dec/2023:14:10:16 +0000] 200 192.168.0.222, 172.30.32.1(172.30.32.2) GET / HTTP/1.1 (Mozilla/5.0 (Linux; Android 14; Pixel 7 Build/UQ1A.231205.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.144 Mobile Safari/537.36 Home Assistant/2023.12.4-11898 (Android 14; Pixel 7))
[30/Dec/2023:14:10:16 +0000] 200 192.168.0.222, 172.30.32.1(172.30.32.2) POST /api/renew HTTP/1.1 (Mozilla/5.0 (Linux; Android 14; Pixel 7 Build/UQ1A.231205.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.144 Mobile Safari/537.36 Home Assistant/2023.12.4-11898 (Android 14; Pixel 7))
[30/Dec/2023:14:10:16 +0000] 200 192.168.0.222, 172.30.32.1(172.30.32.2) GET /api/usage/ HTTP/1.1 (Mozilla/5.0 (Linux; Android 14; Pixel 7 Build/UQ1A.231205.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.144 Mobile Safari/537.36 Home Assistant/2023.12.4-11898 (Android 14; Pixel 7))
[30/Dec/2023:14:10:16 +0000] 200 192.168.0.222, 172.30.32.1(172.30.32.2) GET /api/resources/ HTTP/1.1 (Mozilla/5.0 (Linux; Android 14; Pixel 7 Build/UQ1A.231205.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.144 Mobile Safari/537.36 Home Assistant/2023.12.4-11898 (Android 14; Pixel 7))
[30/Dec/2023:14:10:17 +0000] 200 192.168.0.222, 172.30.32.1(172.30.32.2) GET /api/usage/Reolink_doorbell/ HTTP/1.1 (Mozilla/5.0 (Linux; Android 14; Pixel 7 Build/UQ1A.231205.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.144 Mobile Safari/537.36 Home Assistant/2023.12.4-11898 (Android 14; Pixel 7))
[30/Dec/2023:14:11:21 +0000] 200 192.168.0.222, 172.30.32.1(172.30.32.2) GET /api/usage/ HTTP/1.1 (Mozilla/5.0 (Linux; Android 14; Pixel 7 Build/UQ1A.231205.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.144 Mobile Safari/537.36 Home Assistant/2023.12.4-11898 (Android 14; Pixel 7))
[30/Dec/2023:14:11:21 +0000] 200 192.168.0.222, 172.30.32.1(172.30.32.2) GET /api/resources/ HTTP/1.1 (Mozilla/5.0 (Linux; Android 14; Pixel 7 Build/UQ1A.231205.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.144 Mobile Safari/537.36 Home Assistant/2023.12.4-11898 (Android 14; Pixel 7))

Please try this one : sometimes I encountered a bug where the database did not take arguments. This led for example to a request for authentification despite the no-auth variable included. Perhaps the solution could be as easy as resetting the database.

#!/bin/bash

echo "database reset, now taking into account new arguments"
# Delete this line if it works to avoid a database reset at each start
rm /config/filebrowser.dB

sed -i 's|--cache-dir="\.\\cache|--disable-thumbnails --cache-dir="/cache|g' /etc/cont-init.d/99-run.sh
echo "correcting the cache folder and disabling thumbnails"

No luck unfortunately, same behavior. I had tried deleting the database manually previously and that hadn’t helped.

As a reminder, the initial script from July definitely fixed the problem, so I wonder if the problem may be with the new location of the files. Thanks for working with me through this btw, really appreciate it.