hassio-addons / addon-unifi

UniFi Network Application - Home Assistant Community Add-ons
https://addons.community
MIT License
278 stars 138 forks source link

unable to restore from backup #68

Closed 26tajeen closed 3 years ago

26tajeen commented 4 years ago

Problem/Motivation This issue seems related to #11 and #30 I'm unable to restore a backup. This results in a broken addon. Stopping/starting or Uninstalling/Installing don't work. Not sure what to do. Could I take a very selective snapshot of my Unifi controller from my old Hass instance and restore JUST that and it would leave the rest of my new setup untouched?

Also get this in the logs

OpenJDK Client VM warning: You have loaded library /usr/lib/unifi/lib/native/Linux/armv7/libubnt_webrtc_jni.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
Exception in thread "Thread-14" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Initialization of bean failed; nested exception is java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:584)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1310)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
    at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:802)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1310)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
    at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:802)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.context.support.DefaultLifecycleProcessor.getLifecycleBeans(DefaultLifecycleProcessor.java:289)
    at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:195)
    at org.springframework.context.support.DefaultLifecycleProcessor.stop(DefaultLifecycleProcessor.java:116)
    at org.springframework.context.support.AbstractApplicationContext.stop(AbstractApplicationContext.java:1331)
    at com.ubnt.service.B.oÓ0000(Unknown Source)
    at com.ubnt.ace.Launcher$2.run(Unknown Source)
Caused by: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:177)
    at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1212)
    at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:340)
    at org.springframework.web.servlet.handler.AbstractHandlerMapping.detectMappedInterceptors(AbstractHandlerMapping.java:318)
    at org.springframework.web.servlet.handler.AbstractHandlerMapping.initApplicationContext(AbstractHandlerMapping.java:293)
    at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:124)
    at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:77)
    at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:78)
    at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:120)
    at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:96)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1737)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
    ... 45 more
Reply

Expected behaviour Start addon Restore backup Restart addon Business as usual.

Actual behaviour Start addon Restore backup Restarting addon -Stuck-

Steps to reproduce Run Hassio on RPI3 Install Unifi addon Start Unifi addon Choose to restore backup And you get - Stuck -

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: UniFi Controller
 Manage your UniFi network using a web browser
-----------------------------------------------------------
 Add-on version: 0.13.4
 You are running the latest version of this add-on.
 System: HassOS 3.8  (armv7 / raspberrypi2)
 Home Assistant version: 0.104.1
 Supervisor version: 195
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] unifi.sh: executing... 
[cont-init.d] unifi.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[07:25:18] INFO: Starting the UniFi Controller...
addons-assistant[bot] commented 4 years ago

:wave: Thanks for opening your first issue here! If you're reporting a :bug: bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be useful.

bartsmykla commented 4 years ago

The same problem here :-(

26tajeen commented 4 years ago

Interesting @bartsmykla - do you think restoring from a selected snapshot would also restore settings?

stocker85 commented 4 years ago

@bartsmykla @lancelon Please share the following: HA version Host system hass.io supervisor version addon version System health(dev tools)

like this HA: 0.104.3 Host: HassOS 3.8 hass.io: 195 addon: 0.13.4 System Health arch x86_64 dev false docker true hassio true os_name Linux python_version 3.7.6 timezone Europe/Copenhagen version 0.104.3 virtualenv false

DaKiGbg commented 4 years ago

The same problem here :-(

My brother to 😭.

26tajeen commented 4 years ago

I'm crying here too @DaKiGbg as selectively restoring from a snapshot isn't working either!

20-01-24 15:35:35 INFO (SyncWorker_4) [hassio.docker.interface] Pull image hassioaddons/unifi-armv7 tag 0.13.4.
20-01-24 15:51:19 INFO (MainThread) [hassio.addons.addon] Restore data for addon a0d7b954_unifi
20-01-24 15:54:09 ERROR (MainThread) [hassio.addons.addon] Can't restore origin data: [('/data/tmp/tmpuutp85j0/data/unifi/data/backup', '/data/addons/data/a0d7b954_unifi/unifi/data/backup', "[Errno 2] No such file or directory: '/data/tmp/tmpuutp85j0/data/unifi/data/backup'")]
20-01-24 15:54:11 ERROR (MainThread) [hassio.snapshots.snapshot] Can't restore snapshot for a0d7b954_unifi
20-01-24 15:54:13 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
20-01-24 15:54:13 INFO (MainThread) [hassio.snapshots] Partial-Restore bb15f886 done
20-01-24 16:08:14 INFO (MainThread) [hassio.snapshots] Found 4 snapshot files
20-01-24 16:08:14 INFO (MainThread) [hassio.updater] Fetch update data from https://version.home-assistant.io/stable.json
20-01-24 16:14:12 INFO (MainThread) [hassio.snapshots] Partial-Restore bb15f886 start
20-01-24 16:14:46 INFO (MainThread) [hassio.snapshots] Restore bb15f886 old add-ons
20-01-24 16:19:47 INFO (MainThread) [hassio.addons.addon] Restore config for addon a0d7b954_unifi
20-01-24 16:19:47 INFO (MainThread) [hassio.addons.addon] Restore/Install image for addon a0d7b954_unifi
20-01-24 16:19:47 INFO (SyncWorker_6) [hassio.docker.interface] Pull image hassioaddons/unifi-armv7 tag 0.13.4.
20-01-24 16:19:55 INFO (MainThread) [hassio.addons.addon] Restore data for addon a0d7b954_unifi
20-01-24 16:21:45 ERROR (MainThread) [hassio.addons.addon] Can't restore origin data: [('/data/tmp/tmpaobfjpe_/data/unifi/data/backup', '/data/addons/data/a0d7b954_unifi/unifi/data/backup', "[Errno 2] No such file or directory: '/data/tmp/tmpaobfjpe_/data/unifi/data/backup'")]
20-01-24 16:21:46 ERROR (MainThread) [hassio.snapshots.snapshot] Can't restore snapshot for a0d7b954_unifi
20-01-24 16:21:46 INFO (MainThread) [hassio.snapshots] Partial-Restore bb15f886 done
sinclairpaul commented 4 years ago

If the snapshot restore fails, do you have the unf files that are created by the auto backup function?

https://github.com/hassio-addons/addon-unifi#automated-backups

GitHub
hassio-addons/addon-unifi
UniFi Controller - Community Hass.io Add-on for Home Assistant - hassio-addons/addon-unifi
26tajeen commented 4 years ago

Yep - what do you suggest? Screenshot 2020-01-28 at 22 11 07

sinclairpaul commented 4 years ago

Install the addon, restore the backup from the file.

image

Edit - Looking back at the original issue, it appears this was the original problem, my apologies the mentions of snapshots distracted me.

26tajeen commented 4 years ago

No problem, Paul. You are right, it is not possible. I think @frenck said in a similar thread this is out of his hands.

sinclairpaul commented 4 years ago

Whats odd is that recently I replaced my HA server, and moved my Unifi addon across. I would have either restored from a snapshot or the backup file (as I don't remember having to reconfigure it). So unless it is an issue with the version changing (maybe database schema changes) I don't see why it wouldn't work.

sinclairpaul commented 4 years ago

I will also add from testing I can:

The addon continues to work (with my changes reverted), I do see the Java errors which are likely caused by a conflict between the restart and S6.

26tajeen commented 4 years ago

Thanks sinclairpaul. I've just tried to start the addon in order to again try a restore of the unf file and got:

[cont-init.d] unifi.sh: executing... 
    ignoring unknown attr section !eabi
Error: dl failure on line 893
Error: failed /usr/lib/jvm/java-8-openjdk-armhf/jre/lib/arm/client/libjvm.so, because /usr/lib/jvm/java-8-openjdk-armhf/jre/lib/arm/client/libjvm.so: cannot open shared object file: No such file or directory
[cont-init.d] unifi.sh: exited 6.

so the very fact that the backup/restore fails also breaks/corrupts the entire addon.

Currently trying an uninstall/reinstall of the addon.

stocker85 commented 4 years ago

I'm not using a RPi but I have tested on x86_64 this public version and also these two private versions:

Updated openJDK to 8u242-b08-0ubuntu3~18.04 https://github.com/stocker85/unifijava

Updated openJDK to 8u242-b08-0ubuntu3~18.04, mongoDB to 3.4.17(will not work on RPi) and unifi 5.13.9 https://github.com/stocker85/UnifiBionic

On all three versions I get the beans error when trying to restore from backup but it has no effect on the restore, it will still restore and come up fine. I have tested with 3 different backups from last year till today and the only issue is that it wont let me restore the updated unifi version backup on the older versions, so that is not a real issue.

I dont know if it would make sense to try the updated openJDK version i made but feel free to try at your own risk.

GitHub
stocker85/unifijava
Contribute to stocker85/unifijava development by creating an account on GitHub.
GitHub
stocker85/UnifiBionic
Contribute to stocker85/UnifiBionic development by creating an account on GitHub.
26tajeen commented 4 years ago

Just tried uploading the unf file instead of browsing for it as a local backup. Results in a broken addon.

org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
Exception in thread "Thread-14" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Initialization of bean failed; nested exception is java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:584)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1310)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
    at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:802)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1310)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
    at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:802)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1143)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.context.support.DefaultLifecycleProcessor.getLifecycleBeans(DefaultLifecycleProcessor.java:289)
    at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:195)
    at org.springframework.context.support.DefaultLifecycleProcessor.stop(DefaultLifecycleProcessor.java:116)
    at org.springframework.context.support.AbstractApplicationContext.stop(AbstractApplicationContext.java:1331)
    at com.ubnt.service.B.oÓ0000(Unknown Source)
    at com.ubnt.ace.Launcher$2.run(Unknown Source)
Caused by: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:177)
    at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1212)
    at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:340)
    at org.springframework.web.servlet.handler.AbstractHandlerMapping.detectMappedInterceptors(AbstractHandlerMapping.java:318)
    at org.springframework.web.servlet.handler.AbstractHandlerMapping.initApplicationContext(AbstractHandlerMapping.java:293)
    at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:124)
    at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:77)
    at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:78)
    at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:120)
    at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:96)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1737)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
    ... 45 more
[18:30:08] INFO: Starting the UniFi Controller...
stocker85 commented 4 years ago

could this be a RPi2 specific issue since it only has 1GB ram?

26tajeen commented 4 years ago

it could be, I guess, but it's only the restore process which fails. RUNNING the addon works well, did it for months! Backing up also works well. Also found this

26tajeen commented 4 years ago

Someone else with this issue

mvoort1337 commented 4 years ago

Same issue for me. RPI 3 Model B+ Hassos 3.11 Supervisor 201 HA Core 0.105.5 Unifi plugin 0.13.5

iZac85 commented 4 years ago

Same issue for me as well!

RPI 4 4GB Host Raspbian GNU/Linux 10 (buster) Supervisor 201 HA Core 0.105.3 Unifi plugin 0.14.0 System health arch | armv7l dev | false docker | true hassio | true os_name | Linux python_version | 3.7.6 timezone | Europe/Stockholm version | 0.105.3 virtualenv | false

fribse commented 4 years ago

I just hit the same problem today. RPi4 4 GB Raspbian buster HA 0.107.1

But it seems that I can get a working controller by doing a partial restore from HA? So now I have a working system again, that's really weird, but thank god for HA automated backups.

BlackH137 commented 4 years ago

Same here If I uninstall addon then it works but I then have a blank Controller As soon as I restore my backup it dies.

26tajeen commented 4 years ago

I don't think we're going to get a fix for this - it seems there's a 'blame' pass along going on for why it doesn't work! :-D Blame's not exactly the right word because this is, after all, (mostly) fantastic free software, but I couldn't think of a better one

BlackH137 commented 4 years ago

im going to do a clean install and see and re-setup my WIFI/unifi

chrisfraser commented 4 years ago

Could this be helpful: https://github.com/jacobalberty/unifi-docker/issues/2

FreakyKiwi commented 4 years ago

I have just upgraded to Home Assistant 108.3 and my Unifi controller installation with a restored autobackup is now starting successfully again.

If someone else can confirm this issue may be able to be closed.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 00-banner.sh: executing...

Hass.io Add-on: UniFi Controller Manage your UniFi network using a web browser

Add-on version: 0.14.1 There is an update available for this add-on! Latest add-on version: null Please consider upgrading as soon as possible. System: HassOS 3.12 (armv7 / raspberrypi3) Home Assistant Core: 0.108.3 Home Assistant Supervisor: 216

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] unifi.sh: executing... Importing keystore /tmp/tmp.jAg9niVsbJ to /usr/lib/unifi/data/keystore... Warning: The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore /usr/lib/unifi/data/keystore -destkeystore /usr/lib/unifi/data/keystore -deststoretype pkcs12". [cont-init.d] unifi.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [09:19:48] INFO: Starting the UniFi Controller... OpenJDK Client VM warning: You have loaded library /usr/lib/unifi/lib/native/Linux/armv7/libubnt_webrtc_jni.so which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecstack'.

26tajeen commented 4 years ago

Agreed, I did a restore of the add-on and it must have auto updated because when I went to access the web GUI I popped in my old password and boom, I was in. Well done and thanks @frenck for resolving! (I'm still on 0.109.5)

michalk-k commented 4 years ago

I'm on RPi4 and HA 0.109.6. And stuck with the same issue: after restoring the backup. The backup file has been created from another Controller instance running on my Win10 base computer. It has been uploaded during initial start of the controller in HA env.

xawill commented 4 years ago

I also have this issue, running all the latest versions. I tried to restore the backup from the Unifi controller iOS app as well and the UI prevents me from doing so, since my backup is made on the latest version and the version in the unifi-addon is not. (Note that in the web app of the controller I can initiate the backup restore.) Maybe this is related. Any updates on how to solve the issue ?

FreakyKiwi commented 4 years ago

I don’t believe that this is the same issue at all. The iOS app is not a full controller but rather a simple app to configure devices with basic settings.

The issue being discussed here is the add-on failing to start after restoring a backup and nothing to do with controller version compatibilities.

From: Xavier Willemin notifications@github.com Sent: Saturday, 16 May 2020 7:49 pm To: hassio-addons/addon-unifi addon-unifi@noreply.github.com Cc: Matt Hamilton matt@thehamiltons.nz; Comment comment@noreply.github.com Subject: Re: [hassio-addons/addon-unifi] unable to restore from backup (#68)

I also have this issue, running all the latest versions. I tried to restore the backup from the Unifi controller iOS app as well and the UI prevents me from doing so, since my backup is made on the latest version and the version in the unifi-addon is not. (Note that in the web app of the controller I can initiate the backup restore.) Maybe this is related. Any updates on how to solve the issue ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/hassio-addons/addon-unifi/issues/68#issuecomment-629604400, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMNO6HJTMGHULXJ6G7HKYDDRRZANHANCNFSM4KLCF22Q.

xawill commented 4 years ago

Sure. I meant that maybe the add-on fails to start after restoring because the version of the backup doesn't match the version currently contained in the add-on.

michalk-k commented 4 years ago

Today I gave it 2nd try. Installed, started trying to see if it's working with defaults at all. Yes it does. Then in order to take control over my APs, I backed up the settings from Controller v5.12.72 which was occasionaly running on Windows and loaded into this Controller HA integration running on RPi4. Please note the version of the Controller available as HA integration has been upped on 30th May to 5.12.72. There are other changes though.

Anyway importing settings went without problems.

I had other problems with adopting APs, but it's not related to this integration. At the end I succeed.

many thanks to @frenck

habitoti commented 4 years ago

Has this been addressed by now at all? This seems to be an issue for quite some time (also for me now, just switching to HA...) and doesn't seem to have any solution (though it seems to affect many people). I have a backup from a 5.12.35, and that doesn't seem to go well with the current 5.12.72. Same symptoms as described above, controller doesn't start afterwards w/o even complaining. Would it be possible to explicitly install the old 0.14 version (with the 5.12.35 controller)?

xawill commented 4 years ago

Note that I have been successful by using a docker install on HA instead of the addon. This is just a workaround, though...

habitoti commented 4 years ago

So what worked for me now is setting up a 5.12.35 controller from the Unify site archives on a PC, launch it with backup (which works on this setup w/o issues) and then just export the site data. Importing just that site image on the HA Unify version 5.12.72 works like a charme (you should do such an export in addition to a full backup before you kill your old controller instance — which I didn‘t do... then you don‘t need such a workaround)

xawill commented 4 years ago

Oh ok, good to know. Thanks

oli-f commented 4 years ago

I had similar errors while restoring a backup. For me the problem was that port 8080 was already in use (even after restarting the container). After uploading the restore file, the container became unreachable. I had to change the port to e.g. 8081 and restart the container. The restore then continued and finished successfully. The adoption of the AP failed, but after setting the port back to 8080 everything worked with no problem. Maybe someone can try and verify my solution (or it it was just luck).

I assume there is an systemd unit which restarts the controller automatically and prevents it from starting the restore process.

ReadySteadyFlow commented 4 years ago

I'm facing the same issue on 0.17.0 (RPi4 native installation with HassOS 4.10 and Supervisor 228). I also noticed "port already in use" errors in the logs, as described by @oli-f. Tried his workaround multiple times but failed.

Eventually I managed to move controllers via the site migration feature instead of importing a back-up: https://help.ui.com/hc/en-us/articles/115002869188-UniFi-Migrating-Sites-with-Site-Export-Wizard

Ubiquiti Networks Support and Help Center
Ubiquiti Help Center
Find help and support for Ubiquiti products, view online documentation and get the latest downloads.
thoompje commented 4 years ago

Same issue here after restoring my backup from my Synology docker to Home Assistant Unifi add-on

org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called Exception in thread "Thread-15" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in com.ubnt.net.v2.config.WebMvcV2Configuration: Initialization of bean failed; nested exception is java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)

tdn131 commented 4 years ago

I am also unable to restore backups. I use a backup from the near latest version of the docker image linuxserver/unifi-controller. After uploading the file I get a non functioning container. Same error messages as above (BeanFactory not initialized or already closed). I tried other ports but that doesn't work either. It would be nice if this problem would be solved. :)

cray- commented 4 years ago

Same issue as OP, restoring backup corrupted container. Was attempting to restore 6.8MB .unf to a Controller on Addon version 0.18.1

Had to use same work around as others mentioned in #106 : install a temporary windows UniFi Controller (matching "past" version 5.14.23), restored backup (you can ignore "Your Setup Needs Attention", no need to adopt devices etc.), saved a new "Settings Only" .unf (592KB) and used that to restore Home Assistant UniFi Controller.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!