Skip to content

Instantly share code, notes, and snippets.

@davidmankin
Last active February 27, 2024 03:31
Show Gist options
  • Save davidmankin/d243f6b7fbc103d42cd73333c601896d to your computer and use it in GitHub Desktop.
Save davidmankin/d243f6b7fbc103d42cd73333c601896d to your computer and use it in GitHub Desktop.
home-assistant/supervisor Issue #4358 workaround

This page documents what to do when you hit Issue #4385 where you get the error "Cannot mount NetworkVolume at /data/mounts/NetworkVolume because it is not empty".

(Steps derived from helpful comment by Kjeldgaard here: home-assistant/supervisor/issues/4358#issuecomment-1818009197)

One time Setup:

Install Advanced SSH & Web Terminal add-on.

Configure it (Settings > Add-ons > Advanced SSH & Web Terminal > Info tab)

  1. Turn off Start at Boot
  2. Turn on Auto Update
  3. Turn off Show in sidebar in the Add-on config (optional)
  4. Disable Protection mode in the Add-on config

Configure it (Configuration tab) (docs) by clicking the “Configuration” tab

  1. Set ssh.user to a new username not root for more obscurity
  2. Add to ssh.authorized_keys a new ssh key (I manage mine with Secretive.)
  3. Change the port to something other than 22 for more obscurity

Start the add-on.

Check the Logs tab of the add-on to be sure it worked.

Stop the add-on

Every Time

Step 1: Get the disk remounted on NAS

My setup breaks because when my NAS reboots I have to login and remount the encrypted volumes before it exposes them to CIFS.

Instructions for Synology:

  1. Login to the NAS
  2. Go to Control Panel > Shared Folder > habackups > Encryption drop-down menu > Mount
  3. Enter the Encryption Key from 1Password

Step 2: Clean up cruft on Home Assistant

  1. Verify the mount name by going to (Home Assistant > Settings > System > Storage > Network Storage)
  2. Go to add-on config of Advanced SSH & Web Terminal and start the add on
  3. ssh in: ssh -p THE_PORT_YOU_CHOSE -l THE_USER_YOU_CHOSE homeassistant.local
  4. Run sudo docker exec -it $(sudo docker ps -f name=supervisor -q) bash to escape the sandbox of the SSH terminal
  5. Run ls -lht /data/mounts/MOUNT_NAME_FROM_STEP_ONE/ to verify the situation. It should show a few recent tar files only.
  6. Run mkdir /data/mounts/lost_backups to keep the backups for later if you want
  7. Run mv /data/mounts/MOUNT_NAME_FROM_STEP_ONE/* /data/mounts/lost_backups to empty out the mount point or run rm /data/mounts/MOUNT_NAME_FROM_STEP_ONE/*
  8. Run ls /data/mounts/MOUNT_NAME_FROM_STEP_ONE/ to be sure it's empty
  9. exit to leave the docker container
  10. exit to leave the ssh connection
  11. STOP THE Advanced SSH add-on! Do not forget this! It’s a disaster waiting to happen. from the add-on config.

Step 3: Mount the NAS disk from home assistant:

  1. Remount from the UI (System > Storage > Network Storage)
  2. Check that the network-hosted backups are now visible to home assistant (System > Backups) NOTE: it takes several seconds before the list loads! It will say “no backups” while it loads.
  3. Click the meatball menu in the top right and ensure “Default Backup Location” is the NAS disk not Data Disk
  4. Force a full backup for good measure (click + Create Backup and name it “Full backup yyyy-mm-dd”)
  5. When finished, login to the NAS and look to be sure it's there. (For Synology that's in File Station)

If you get the following issue (check the logs > Supervisor for BAD_NETWORK_NAME), it's likely that the NAS "volume" is not mounted (decrypted) on NAS (which is a pre-requisite for homeassistant to mount it, obviously). Check Step 1 above.

Jan 11 18:28:10 homeassistant systemd[1]: Mounting Supervisor cifs mount: netdisk2_habackups_2...
Jan 11 18:28:10 homeassistant kernel: CIFS: Attempting to mount \\netdisk2.local.\habackups
Jan 11 18:28:11 homeassistant kernel: CIFS: VFS:  BAD_NETWORK_NAME: \\netdisk2.local.\habackups
Jan 11 18:28:11 homeassistant kernel: CIFS: VFS: cifs_mount failed w/return code = -2
Jan 11 18:28:11 homeassistant mount[1366353]: mount error(2): No such file or directory
Jan 11 18:28:11 homeassistant mount[1366353]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
Jan 11 18:28:11 homeassistant systemd[1]: mnt-data-supervisor-mounts-netdisk2_habackups_2.mount: Mount process exited, code=exited, status=32/n/a
Jan 11 18:28:11 homeassistant systemd[1]: mnt-data-supervisor-mounts-netdisk2_habackups_2.mount: Failed with result 'exit-code'.
Jan 11 18:28:11 homeassistant systemd[1]: Failed to mount Supervisor cifs mount: netdisk2_habackups_2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment