usememos / memos

An open source, lightweight note-taking service. Easily capture and share your great thoughts.
https://usememos.com
MIT License
30.3k stars 2.27k forks source link

Unable to restore memos instance #3915

Closed quaintdev closed 1 week ago

quaintdev commented 1 week ago

Describe the bug

I have been running memos on Raspberry Pi 4 from a pen drive. I decided to add SSD to my self hosting setup. As a part of this change I decided to move from raspbian to fedora as it has better podman support. Anyway I took a copy of data folder of memos after the system was shutdown and was trying to restore the same on the new system.

I keep getting below error no matter which version I try. I tried latest, stable and the same version as my old setup but in all cases I keep getting same error.

2024/09/11 18:36:38 WARN failed to find migration history in pre-migrate error="unable to open database file: out of memory (14)"
2024/09/11 18:36:38 ERROR failed to migrate error="unable to open database file: out of memory (14)\nfailed to start transaction\ngithub.com/usememos/memos/store.(*Store).preMigrate\n\tgithub.com/usememos/memos/store/migrator.go:134\ngithub.com/usememos/memos/store.(*Store).Migrate\n\tgithub.com/usememos/memos/store/migrator.go:37\nmain.init.func1\n\t./main.go:61\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:989\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1041\nmain.main\n\t./main.go:171\nruntime.main\n\truntime/proc.go:271\nruntime.goexit\n\truntime/asm_arm64.s:1222\nfailed to pre-migrate\ngithub.com/usememos/memos/store.(*Store).Migrate\n\tgithub.com/usememos/memos/store/migrator.go:38\nmain.init.func1\n\t./main.go:61\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:989\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1041\nmain.main\n\t./main.go:171\nruntime.main\n\truntime/proc.go:271\nruntime.goexit\n\truntime/asm_arm64.s:1222"

Any suggestions?

Steps to reproduce

  1. Take backup of the data directory
  2. On new system try to bring up memos with the old database
  3. The container exits with the error shared

The version of Memos you're using.

stable, latest

Screenshots or additional context

No response

RoccoSmit commented 1 week ago

The error says you are out of memory out of memory (14) Have you been able to identify if this is the case?

quaintdev commented 1 week ago

I have no idea why it's saying out of memory (14) when there's plenty of memory available

               total        used        free      shared  buff/cache   available
Mem:           3.7Gi       700Mi       1.3Gi       9.3Mi       1.8Gi       3.0Gi
Swap:          3.7Gi          0B       3.7Gi
quaintdev commented 1 week ago

Turns out it has nothing to do with my old database. Even if I try to create a new memos instance without a database it gives the same error. I am not sure if there's some issue with fedora aarch64 or the aarch64 image.

quaintdev commented 1 week ago

My bad. Fedora is SELinux enabled so it needs that :z at the end of volume mapping. I had to modify my startup script as follows

podman run -d \
  --init \
  --name memos \
  --publish 5230:5230 \
  --volume /home/user/apps/memos/data/:/var/opt/memos:z \
  docker.io/neosmemo/memos:latest

Closing this issue. Thanks.