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

Error during migration (Espanso v2.1.4-beta running on Ubuntu 20.04) #1051

Closed
mattnolan001 opened this issue Mar 29, 2022 · 13 comments
Closed
Labels
bug something isn't working Linux related to the Linux operating system

Comments

@mattnolan001
Copy link

When I start the new Espanso (v2.1.4-beta running on Ubuntu 20.04) and then choose 'Backup and migrate' I receive an error. The log reads: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181'. When I continue running v2.1.4 in compatibiltiy mode it seems to run fine.

@federico-terzi
Copy link
Collaborator

Hey @mattnolan001,

I'm sorry you experienced this problem! Could you please post the output of espanso log here?

Also, it would be super helpful if you could run espanso migrate in a terminal and post the output of the process here.

Cheers :)

@mattnolan001
Copy link
Author

Log:

16:07:21 [service(22084)] [INFO] reading configs from: "/home/matt/.config/espanso"
16:07:21 [service(22084)] [INFO] reading packages from: "/home/matt/.local/share/espanso/packages"
16:07:21 [service(22084)] [INFO] using runtime dir: "/home/matt/.local/share/espanso"
16:07:26 [service(22084)] [ERROR] unable to start service: timed out
16:07:43 [migrate(22153)] [INFO] reading configs from: "/home/matt/.config/espanso"
16:07:43 [migrate(22153)] [INFO] reading packages from: "/home/matt/.local/share/espanso/packages"
16:07:43 [migrate(22153)] [INFO] using runtime dir: "/home/matt/.local/share/espanso"
16:07:43 [migrate(22153)] [WARN] espanso is reading the configuration using compatibility mode, thus some features might not be available
16:07:43 [migrate(22153)] [WARN] you can migrate to the new configuration format by running 'espanso migrate' in a terminal
16:07:43 [migrate(22153)] [INFO] --- MIGRATION STARTED ---
16:07:43 [migrate(22153)] [ERROR] thread 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
16:07:43 [migrate(22153)] [ERROR] ERROR: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181

I saw the same thing running from the command line. I've since manually recreated the folder structure for v2.1.4beta and everything runs fine.

Fantastic program by the way!

Matt

@federico-terzi
Copy link
Collaborator

@mattnolan001 Thanks! It seems espanso is unable to find your document directory. Could you please run the following in a terminal and post the output here? :)

echo $XDG_CONFIG_HOME
echo $XDG_DOCUMENTS_DIR

Related code: https://github.com/federico-terzi/espanso/blob/master/espanso/src/cli/migrate.rs#L181

@mattnolan001
Copy link
Author

Neither returns anything.

@federico-terzi
Copy link
Collaborator

@mattnolan001 I see! thanks

Could you please try running the following command (make sure to double-check the Documents directory I've inserted below):

XDG_DOCUMENTS_DIR=/home/matt/Documents espanso migrate

@nocibambi
Copy link

@federico-terzi Thanks for the tip!

Could you please try running the following command (make sure to double-check the Documents directory I've inserted below):

XDG_DOCUMENTS_DIR=/home/matt/Documents espanso migrate

I am having the same issue, so I tried this, but it gave the same error message.

I did not have a Documents folder under the user one. After creating the folder manually, I tried the command again, but the results were still the same.

@federico-terzi federico-terzi added the Linux related to the Linux operating system label Apr 9, 2022
@n8henrie
Copy link
Contributor

Same error on Arch

$ ls -ld ~/Documents
drwxr-xr-x 1 n8henrie n8henrie 16 May 19  2021 /home/n8henrie/Documents
$ espanso migrate
ERROR: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
$ espanso log
20:04:46 [ INFO] espanso version 0.7.3
20:04:46 [ INFO] using config path: /home/n8henrie/.config/espanso
20:04:46 [ INFO] using package path: /home/n8henrie/.local/share/espanso/packages
20:04:46 [ INFO] spawning worker process...
20:04:46 [ INFO] Binded to IPC unix socket: /home/n8henrie/.local/share/espanso/espanso.sock
20:04:46 [ INFO] initializing worker process...
20:04:46 [ INFO] Binded to IPC unix socket: /home/n8henrie/.local/share/espanso/worker.sock
20:04:46 [ INFO] worker is running!
20:04:46 [ INFO] watching for changes in path: /home/n8henrie/.config/espanso
07:51:31 [migrate(25796)] [INFO] reading configs from: "/home/n8henrie/.config/espanso"
07:51:31 [migrate(25796)] [INFO] reading packages from: "/home/n8henrie/.local/share/espanso/packages"
07:51:31 [migrate(25796)] [INFO] using runtime dir: "/home/n8henrie/.local/share/espanso"
07:51:31 [migrate(25796)] [WARN] espanso is reading the configuration using compatibility mode, thus some features might not be available
07:51:31 [migrate(25796)] [WARN] you can migrate to the new configuration format by running 'espanso migrate' in a terminal
07:51:31 [migrate(25796)] [INFO] --- MIGRATION STARTED ---
07:51:31 [migrate(25796)] [ERROR] thread 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:51:31 [migrate(25796)] [ERROR] ERROR: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:51:52 [migrate(25880)] [INFO] reading configs from: "/home/n8henrie/.config/espanso"
07:51:52 [migrate(25880)] [INFO] reading packages from: "/home/n8henrie/.local/share/espanso/packages"
07:51:52 [migrate(25880)] [INFO] using runtime dir: "/home/n8henrie/.local/share/espanso"
07:51:52 [migrate(25880)] [WARN] espanso is reading the configuration using compatibility mode, thus some features might not be available
07:51:52 [migrate(25880)] [WARN] you can migrate to the new configuration format by running 'espanso migrate' in a terminal
07:51:52 [migrate(25880)] [INFO] --- MIGRATION STARTED ---
07:51:52 [migrate(25880)] [ERROR] thread 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:51:52 [migrate(25880)] [ERROR] ERROR: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:55:15 [migrate(27459)] [INFO] reading configs from: "/home/n8henrie/.config/espanso"
07:55:15 [migrate(27459)] [INFO] reading packages from: "/home/n8henrie/.local/share/espanso/packages"
07:55:15 [migrate(27459)] [INFO] using runtime dir: "/home/n8henrie/.local/share/espanso"
07:55:15 [migrate(27459)] [WARN] espanso is reading the configuration using compatibility mode, thus some features might not be available
07:55:15 [migrate(27459)] [WARN] you can migrate to the new configuration format by running 'espanso migrate' in a terminal
07:55:15 [migrate(27459)] [INFO] --- MIGRATION STARTED ---
07:55:15 [migrate(27459)] [ERROR] thread 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:55:15 [migrate(27459)] [ERROR] ERROR: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:55:50 [migrate(27701)] [INFO] reading configs from: "/home/n8henrie/.config/espanso"
07:55:50 [migrate(27701)] [INFO] reading packages from: "/home/n8henrie/.local/share/espanso/packages"
07:55:50 [migrate(27701)] [INFO] using runtime dir: "/home/n8henrie/.local/share/espanso"
07:55:50 [migrate(27701)] [WARN] espanso is reading the configuration using compatibility mode, thus some features might not be available
07:55:50 [migrate(27701)] [WARN] you can migrate to the new configuration format by running 'espanso migrate' in a terminal
07:55:50 [migrate(27701)] [INFO] --- MIGRATION STARTED ---
07:55:50 [migrate(27701)] [ERROR] thread 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:55:50 [migrate(27701)] [ERROR] ERROR: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:57:09 [migrate(28497)] [INFO] reading configs from: "/home/n8henrie/.config/espanso"
07:57:09 [migrate(28497)] [INFO] reading packages from: "/home/n8henrie/.local/share/espanso/packages"
07:57:09 [migrate(28497)] [INFO] using runtime dir: "/home/n8henrie/.local/share/espanso"
07:57:09 [migrate(28497)] [WARN] espanso is reading the configuration using compatibility mode, thus some features might not be available
07:57:09 [migrate(28497)] [WARN] you can migrate to the new configuration format by running 'espanso migrate' in a terminal
07:57:09 [migrate(28497)] [INFO] --- MIGRATION STARTED ---
07:57:09 [migrate(28497)] [ERROR] thread 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
07:57:09 [migrate(28497)] [ERROR] ERROR: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
$ XDG_DOCUMENTS_DIR=/home/n8henrie/Documents espanso migrate
ERROR: 'main' panicked at 'unable to generate backup directory': espanso/src/cli/migrate.rs:181
$ uname -a
Linux machine 5.17.1-arch1-1 #1 SMP PREEMPT Mon, 28 Mar 2022 20:55:33 +0000 x86_64 GNU/Linux

@n8henrie
Copy link
Contributor

After going down a bit of a rabbit hole with the dirs and dirs_sys crates, I figured out that I needed to sudo pacman -S xdg-user-dirs and then xdg-user-dirs-update, which creates ~/.config/user-dirs.dirs. Once that was created, dirs::document_dir() stopped returning None1, and espanso migrate was able to succeed.

Footnotes

  1. https://github.com/federico-terzi/espanso/blob/5df94b5031d5b2ec0cb13424be600f418cbc0e07/espanso/src/cli/migrate.rs#L180

@federico-terzi
Copy link
Collaborator

@n8henrie Thank you for the investigation! I'd say we should try falling back to another directory if that one is not available, I'll add it to the roadmap

@n8henrie
Copy link
Contributor

To be clear, that directory was available the whole time, but the crate you're depending on didn't know how to find it without those additional steps.

@skilleter
Copy link

skilleter commented Apr 27, 2022

I'm also seeing this on Ubuntu 18.04 and none of the suggestions above seem to help.
I updated my system (including Espanso) and rebooted and it looked like Espanso tried to migrate the configuration before the GUI started, resulting in the system going into maintenance mode.
On the second reboot it got as far as the desktop, but Espanso still wanted to migrate the configuration and failed.
In the end, I move the old yaml config out of the way, ran Espanso and manually updated the v2.x config from the old config.

@smeech
Copy link
Collaborator

smeech commented Feb 15, 2024

Given this Issue is now quite old, and I hope most people have migrated to v2, can it be closed as we're unlikely to do further work on it?

@n8henrie
Copy link
Contributor

Probably reasonable. Can always point people to this issue for the workaround (at least for arch).

@smeech smeech closed this as completed Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working Linux related to the Linux operating system
Projects
Status: Done
Development

No branches or pull requests

6 participants