Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh install crash #17

Closed
sinux-l5d opened this issue Oct 29, 2022 · 9 comments
Closed

Fresh install crash #17

sinux-l5d opened this issue Oct 29, 2022 · 9 comments

Comments

@sinux-l5d
Copy link

Hi,
Wanted to test that using docker-compose, but it crash at first run.
Here is my docker-compose:

version: '3'

services:
  remarkable-pocket:
    image: ghcr.io/nov1n/remarkable-pocket:0.3.0
    restart: always
    environment:
      - TZ=Europe/Paris
    ports:
      - "65112:65112"
    volumes:
      - ./data/remarkable-pocket:/root/.remarkable-pocket
      - ./data/rmapi:/root/.rmapi
      - ./data/rmapi-cache:/root/.cache/rmapi

Docker version: 20.10.21, build baeda1f82a
Docker compose: installed as a plugin (v2)

I couldn't guess much from the standard error. The debug logs says it's not connected to the internet, but it is.

But I cannot debug further, as I haven't found the Dockerfile. Where is it?

Standard error output

[2022-10-29 12:18:19] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nl.carosi.remarkablepocket.MetadataProvider': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pocket' defined in nl.carosi.remarkablepocket.SyncApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [pl.codeset.pocket.Pocket]: Factory method 'pocket' threw exception; nested exception is java.lang.RuntimeException: Could not authenticate with Pocket
[2022-10-29 12:18:19] 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[2022-10-29 12:18:19] Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nl.carosi.remarkablepocket.MetadataProvider': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pocket' defined in nl.carosi.remarkablepocket.SyncApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [pl.codeset.pocket.Pocket]: Factory method 'pocket' threw exception; nested exception is java.lang.RuntimeException: Could not authenticate with Pocket
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:143)
        at nl.carosi.remarkablepocket.SyncCommand.call(SyncCommand.java:125)
        at nl.carosi.remarkablepocket.SyncCommand.call(SyncCommand.java:16)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at nl.carosi.remarkablepocket.SyncCommand.main(SyncCommand.java:93)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pocket' defined in nl.carosi.remarkablepocket.SyncApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [pl.codeset.pocket.Pocket]: Factory method 'pocket' threw exception; nested exception is java.lang.RuntimeException: Could not authenticate with Pocket
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        ... 26 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [pl.codeset.pocket.Pocket]: Factory method 'pocket' threw exception; nested exception is java.lang.RuntimeException: Could not authenticate with Pocket
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 42 common frames omitted
Caused by: java.lang.RuntimeException: Could not authenticate with Pocket
        at nl.carosi.remarkablepocket.SyncApplication.pocket(SyncApplication.java:44)
        at nl.carosi.remarkablepocket.SyncApplication$$EnhancerBySpringCGLIB$$9da5f0aa.CGLIB$pocket$1(<generated>)
        at nl.carosi.remarkablepocket.SyncApplication$$EnhancerBySpringCGLIB$$9da5f0aa$$FastClassBySpringCGLIB$$2d43d3de.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at nl.carosi.remarkablepocket.SyncApplication$$EnhancerBySpringCGLIB$$9da5f0aa.pocket(<generated>)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 43 common frames omitted
Caused by: java.nio.file.FileSystemException: /root/.remarkable-pocket: Device or resource busy
        at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
        at java.base/sun.nio.fs.UnixFileSystemProvider.implDelete(Unknown Source)
        at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
        at java.base/java.nio.file.Files.delete(Unknown Source)
        at nl.carosi.remarkablepocket.PocketAuthenticator.getAuth(PocketAuthenticator.java:46)
        at nl.carosi.remarkablepocket.SyncApplication.pocket(SyncApplication.java:42)
        ... 53 common frames omitted
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nl.carosi.remarkablepocket.MetadataProvider': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pocket' defined in nl.carosi.remarkablepocket.SyncApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [pl.codeset.pocket.Pocket]: Factory method 'pocket' threw exception; nested exception is java.lang.RuntimeException: Could not authenticate with Pocket
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:143)
        at nl.carosi.remarkablepocket.SyncCommand.call(SyncCommand.java:125)
        at nl.carosi.remarkablepocket.SyncCommand.call(SyncCommand.java:16)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at nl.carosi.remarkablepocket.SyncCommand.main(SyncCommand.java:93)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pocket' defined in nl.carosi.remarkablepocket.SyncApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [pl.codeset.pocket.Pocket]: Factory method 'pocket' threw exception; nested exception is java.lang.RuntimeException: Could not authenticate with Pocket
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        ... 26 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [pl.codeset.pocket.Pocket]: Factory method 'pocket' threw exception; nested exception is java.lang.RuntimeException: Could not authenticate with Pocket
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 42 more
Caused by: java.lang.RuntimeException: Could not authenticate with Pocket
        at nl.carosi.remarkablepocket.SyncApplication.pocket(SyncApplication.java:44)
        at nl.carosi.remarkablepocket.SyncApplication$$EnhancerBySpringCGLIB$$9da5f0aa.CGLIB$pocket$1(<generated>)
        at nl.carosi.remarkablepocket.SyncApplication$$EnhancerBySpringCGLIB$$9da5f0aa$$FastClassBySpringCGLIB$$2d43d3de.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at nl.carosi.remarkablepocket.SyncApplication$$EnhancerBySpringCGLIB$$9da5f0aa.pocket(<generated>)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 43 more
Caused by: java.nio.file.FileSystemException: /root/.remarkable-pocket: Device or resource busy
        at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
        at java.base/sun.nio.fs.UnixFileSystemProvider.implDelete(Unknown Source)
        at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
        at java.base/java.nio.file.Files.delete(Unknown Source)
        at nl.carosi.remarkablepocket.PocketAuthenticator.getAuth(PocketAuthenticator.java:46)
        at nl.carosi.remarkablepocket.SyncApplication.pocket(SyncApplication.java:42)
        ... 53 more

Debug error output: https://pastebin.com/ZXGwrW0n

@nov1n
Copy link
Owner

nov1n commented Oct 29, 2022

Hi, I suspect this is due to a problem with the mounted config files. Please make sure the files ./data/remarkable-pocket and the two others exist on the host before running docker compose.

I added a section to the readme to clarify this.

@sinux-l5d
Copy link
Author

Hi, thanks for the tip. I figured out that I was missing an importent point: remarkable-pocket and rmapi are files, whereas rmapi-cache is a directory (I thought it was all dir).
That said, I have another issue that make it crash right avec authorization:

Exception encountered during context initialization - cancelling refresh attempt: 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nl.carosi.remarkablepocket.MetadataProvider': 
Unsatisfied dependency expressed through constructor parameter 0; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'pocket' defined in nl.carosi.remarkablepocket.SyncApplication: 
Bean instantiation via factory method failed; 
nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [pl.codeset.pocket.Pocket]: 
Factory method 'pocket' threw exception; 
nested exception is java.lang.NullPointerException: 
Cannot invoke "java.io.InputStream.read(byte[], int, int)" because "is" is null

@nov1n
Copy link
Owner

nov1n commented Nov 1, 2022

I will need a bit more info to help you. Can you rerun with verbose enabled and paste the output?

@sinux-l5d
Copy link
Author

sinux-l5d commented Nov 4, 2022

Sorry for the delay. I just get this error with verbose on, a lot of times per seconds:

[2022-11-05 00:45:18] Created temporary storage directory: /tmp/16381811871600645528.
[2022-11-05 00:45:18] Created temporary working directory: /tmp/6750401861237256101.
[2022-11-05 00:45:18] ERROR
[2022-11-05 00:45:18] 2022/11/05 00:45:18 auth.go:73
[2022-11-05 00:45:18] Code has the wrong length, it should be 8
[2022-11-05 00:45:18] Enter one-time code (go to https://my.remarkable.com/device/desktop/connect)

The remarkable-pocket file looks kind of like this:

pocket.access.token=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx

@sinux-l5d
Copy link
Author

sinux-l5d commented Nov 4, 2022

I have found the problem: the program waits to stdin, which docker compose doesn't set up by default. It works with docker CLI because in your example, you use the -it options

Because you use a webserver to handle the pocket connection, would it be possible to do the same for the reMarkable one-time password?

@nov1n
Copy link
Owner

nov1n commented Nov 5, 2022

Thanks for debugging this one. I didn't consider the auth flow for docker-compose.

It seems something like dc up -d && docker attach $(docker-compose ps -q remarkable-pocket) if you set stdin_open: true in the docker-compose.yml could work, but when exiting the process with Ctrl-C the container will actually stop so that's not ideal.

Wrt to your suggestion: the Pocket auth flow uses oath, making a browser a necessity. I'd rather not change the Remarkable auth flow to accommodate the docker-compose usecase.

I think the easiest solution is to use the docker run command the first time in order to complete authentication. As this only needs to happen once, it shouldn't be too much effort, and I can explain this in the readme. Would that work for you?

@sinux-l5d
Copy link
Author

Your solution should work for docker compose.

However, the constraint of having to copy and paste the code is breaking every tentative to automate the start-up.

If not with the webserver, maybe provide an alternative way with a environment variable? If it's set, no need to ask it via stdin :)

@nov1n
Copy link
Owner

nov1n commented Nov 5, 2022

It's not possible to automate the Pocket oauth flow, regardless of how the Remarkable cloud code is provided. I don't see how providing the code through an env var would solve this.

What would you like to automate? The way I see it you authenticate once manually to create the config files, and then you can automate the start-up any way you like.

@nov1n
Copy link
Owner

nov1n commented Nov 16, 2022

I'll close this as a solution now exists.

@nov1n nov1n closed this as completed Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants