Skip to content

Does not open last used database automatically #4911

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

Closed
mase76 opened this issue Jun 28, 2020 · 25 comments
Closed

Does not open last used database automatically #4911

mase76 opened this issue Jun 28, 2020 · 25 comments

Comments

@mase76
Copy link

mase76 commented Jun 28, 2020

Hi!
I often have the issue, that when using the global autotype shortcut, nothing happens, because KeepassXC does not open the last used database. I have to open the main window and select the last (and only) database from the recents list. Then it works for a while. Maybe there should be an option to set the default database.

@droidmonkey
Copy link
Member

droidmonkey commented Jun 28, 2020

I'm confused by the problem. Do you even have the database open in keepassxc? We don't open a database file when you auto-type, you need to do that first. It doesn't have to be unlocked, but it does have to be "open".

@mase76
Copy link
Author

mase76 commented Jun 28, 2020

Sorry, I did not mean opened and unlocked, but selected with its keyfile, so that you only have to type the passphrase.

@droidmonkey
Copy link
Member

Do you have "remember last databases and key files" setting set?

image

@mase76
Copy link
Author

mase76 commented Jun 29, 2020

Yes, I have. But it seems, that it sometimes does not know, what the last db was. I have this issue on multiple machines.

@droidmonkey
Copy link
Member

I am going to need screenshots or a demo video to understand what your problem is, sorry.

@mase76
Copy link
Author

mase76 commented Jun 29, 2020

Ok, I attached a screencast. I am trying to log into Github via autotype, but nothing happens, because the last used database was not remembered after a reboot. I have to open the KeepassXC window and select my database from the list of the last opened (I have only one database).This does not happen every time, but very often. The expected behabiour is, that my last used database it opened every time, and I am only prompted to unlock it.
keepassxc.tar.gz

@droidmonkey
Copy link
Member

When you close keepassxc do not close the database (don't press Ctrl+W). That will require you to open it again on launching keepassxc.

@mase76
Copy link
Author

mase76 commented Jun 29, 2020

I do not close the db. The issue is mostly after reboots or resumes.

@droidmonkey
Copy link
Member

Is your db hosted on a network shares that might not be connected or available?

@mase76
Copy link
Author

mase76 commented Jun 29, 2020

No, the db file is always present in the locsl filesystem.
I suggest, when using the autotype shortcut, and only one recent db file is in the list, always to use this one. Or opening the application to let me choose the db, instead of doing nothing.
My wife also has this issue. Maybe it is related to resuming from hibernation. I did not have this somewhere in the past. But I cannot say, when it appeared for the first time, or with the move from KeepassX to KeepassXC.
But when you or anybody else never had this issue, it seems to be my fault.

@rplCloud
Copy link

rplCloud commented Jul 12, 2020

I was facing the same problem.

In the settings GUI the option "Load previously used database" was set but in the ~/Library/Application Support/keepassxc/keepassxc.ini file the option OpenPreviousDatabasesOnStartup was set to false.

I changed the value to true and chose a file from "Recent databases". It works fine ever since...

UPDATE: That only worked until I cleaned up ~/.cache!

@SaraSmiseth
Copy link

SaraSmiseth commented Jul 17, 2020

I have the same problem. After a reboot keepass forgets what my last database was. As long as I don't reboot it works fine. I have the GUI Settings enabled and OpenPreviousDatabasesOnStartup is also set to true.

EDIT:

OK I found the problem.

The last database is now saved in ~/.cache/keepassxc/keepassxc.ini. This was saved somewhere else before? I use a tmpfs for ~/.cache/, which explains what is happening.

@droidmonkey
Copy link
Member

This is a common theme and unfortunate finding

@ycaille
Copy link

ycaille commented Jul 17, 2020

I have the same issue.

Despite "Remember previously used databases", "Load previously open databases on startup" and "Remember database key files and security dongles" being checked in "Application Settings > Basic Settings", whenever I quit the application to reboot the system, I have to provide explicitly the name of both DB and key when I open KeePassXC. Also, the settings are correctly saved in the keepassxc.ini file

I've never had the problem before v2.6.0, and I've been using KeePassXC for years.

It does not happen when I just quit the application (Cmd+Q).

Both files (DB & key) are located on a USB drive, but they are both available when I start KeePassXC.

OS: macOS Mojave 10.14.6
Screen Shot 2020-07-17 at 1 48 15 PM
Screen Shot 2020-07-17 at 2 53 45 PM

@droidmonkey
Copy link
Member

Sounds like a completely different issue. Please open a new ticket for that

@z3ntu
Copy link
Contributor

z3ntu commented Jul 20, 2020

Same for me, ~/.cache is on tmpfs and therefore wiped after a reboot. This is new behavior since v2.8.0, it was always working fine before that.

@droidmonkey
Copy link
Member

Technically we are not doing anything wrong, mounting .cache to a tempfs is not a best practice that we are aware of. Cache is meant to survive reboots, but not be synced with other machines. We are using standard Qt directories for "local config" storage, so your actions to mount to a tempfs may impact other applications function.

@SaraSmiseth
Copy link

Technically we are not doing anything wrong, mounting .cache to a tempfs is not a best practice that we are aware of. Cache is meant to survive reboots, but not be synced with other machines. We are using standard Qt directories for "local config" storage, so your actions to mount to a tempfs may impact other applications function.

Yes you are right. This is not a problem of keepassxc. I have other applications that save configs in .cache. I save them somewhere else and just symlink them to .cache after each start.

For example I use this for keepassxc:

mkdir -p ~/.cache/keepassxc && ln -s ~/keepassxc.ini ~/.cache/keepassxc/keepassxc.ini

@z3ntu
Copy link
Contributor

z3ntu commented Jul 21, 2020

There is a single base directory relative to which user-specific non-essential (cached) data should be written. This directory is defined by the environment variable $XDG_CACHE_HOME.

$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored.

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Imo the "last opened" list is not non-essential data and should go into XDG_DATA_HOME instead.

Also I've had this set up for multiple years already and have never seen any issues with other applications.

edit: after some searching around I believe pre-2.8.0 the file location was ~/.config/keepassxc/keepassxc.ini and now it's ~/.cache/keepassxc/keepassxc.ini

The source change seems to be 596d2cf#diff-461928dbf0b7b4c50bab629bfe990c75L141-L170

@droidmonkey
Copy link
Member

Yes the change is deliberate and the directory choice is correct

@z3ntu
Copy link
Contributor

z3ntu commented Aug 9, 2020

@droidmonkey I don't really understand why the change was done though. Were there problems with ~/.config/keepassxc ?

@droidmonkey
Copy link
Member

droidmonkey commented Aug 9, 2020

We store settings in both places. Ephemeral, system specific settings are stored in the "local" storage, which on Linux corresponds to the .cache directory. All other settings remain in .config. This allows users to sync their settings across devices, or add to their dot-file git repo without exposing somewhat personal data or information that changes often.

@z3ntu
Copy link
Contributor

z3ntu commented Aug 20, 2020

Okay. I do understand that saving a "recently used" list in ~/.config is "wrong". I don't understand why ~/.cache instead of ~/.local/share was chosen though as the latter would make much more sense (to me at least - it's definitely not "non-essential data" in my eyes).
So replacing QStandardPaths::GenericCacheLocation with QStandardPaths::AppDataLocation at

localConfigPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/keepassxc";

should make everyone happy?

@droidmonkey
Copy link
Member

Ping @phoerious

@droidmonkey
Copy link
Member

#5313 better captures the issue, workaround, and discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants