YunoHost-Apps / vaultwarden_ynh

Open source password management solutions for YunoHost
https://bitwarden.com/
GNU General Public License v3.0
54 stars 17 forks source link

No migration ? #137

Closed changemenemo closed 3 years ago

changemenemo commented 3 years ago

So since the thread on the forum is not giving any result... how is that so that a change have been done to the app without a migration package or at least a wiki page about how to transfer ?

https://forum.yunohost.org/t/migration-bitwarden-vers-vaultwarden/15594

yalh76 commented 3 years ago

The upgrade from bitwarden to vaultwarden can be tested from the command line doing yunohost app upgrade bitwarden -u https://github.com/YunoHost-Apps/vaultwarden_ynh/tree/testing --debug

changemenemo commented 3 years ago

Do you want that I try it?

yalh76 commented 3 years ago

You can ;) but better to do a backup first

changemenemo commented 3 years ago

Seems there is an error

https://paste.yunohost.org/raw/ogunowonef

paoesco commented 3 years ago

Hello here,

I tried two commands and both failed.

First one is on the main branch

yunohost app upgrade bitwarden -u https://github.com/YunoHost-Apps/vaultwarden_ynh --debug

and resulted in https://paste.yunohost.org/raw/imevugofot Extract below

2021-05-16 06:14:33,998: INFO - [###########+........] > Updating a config file...
2021-05-16 06:14:33,998: WARNING - Try 'mv --help' for more information.
2021-05-16 06:14:33,998: DEBUG - + echo '[###########+........] > Updating a config file...'
2021-05-16 06:14:33,999: DEBUG - + test -f /var/www/bitwarden/live/bitwarden_rs.env
2021-05-16 06:14:33,999: DEBUG - + mv -a /var/www/bitwarden/live/bitwarden_rs.env /var/www/bitwarden/live/vaultwarden.env
2021-05-16 06:14:33,999: DEBUG - + ynh_exit_properly
2021-05-16 06:14:33,999: DEBUG - + local exit_code=1
2021-05-16 06:14:34,000: DEBUG - + '[' 1 -eq 0 ']'
2021-05-16 06:14:34,000: DEBUG - + trap '' EXIT
2021-05-16 06:14:34,000: DEBUG - + set +o errexit
2021-05-16 06:14:34,000: DEBUG - + set +o nounset
2021-05-16 06:14:34,000: DEBUG - + sleep 0.5
2021-05-16 06:14:34,502: DEBUG - + type -t ynh_clean_setup
2021-05-16 06:14:34,502: WARNING - [Error] Upgrade failed.
2021-05-16 06:14:34,502: DEBUG - + ynh_clean_setup
2021-05-16 06:14:34,503: DEBUG - + ynh_clean_check_starting

Second one is on testing branch

yunohost app upgrade bitwarden -u https://github.com/YunoHost-Apps/vaultwarden_ynh/testing

and resulted in https://paste.yunohost.org/raw/abajedopev Extract below.

021-05-16 08:00:28,000: DEBUG - + cp -a /etc/yunohost/apps/bitwarden /etc/yunohost/apps/vaultwarden
2021-05-16 08:00:28,000: DEBUG - + cp -a ../scripts ../conf ../manifest.json /etc/yunohost/apps/vaultwarden
2021-05-16 08:00:28,000: DEBUG - + ynh_replace_string '--match_string=\(^id: .*\)bitwarden' '--replace_string=\1vaultwarden' --target_file=/etc/yunohost/apps/vaultwarden/settings.yml
2021-05-16 08:00:28,103: DEBUG - + local delimit=@
2021-05-16 08:00:28,103: DEBUG - + match_string='\(^id: .*\)bitwarden'
2021-05-16 08:00:28,103: DEBUG - + replace_string='\1vaultwarden'
2021-05-16 08:00:28,104: DEBUG - + sed --in-place 's@\(^id: .*\)bitwarden@\1vaultwarden@g' /etc/yunohost/apps/vaultwarden/settings.yml
2021-05-16 08:00:28,104: DEBUG - ++ ynh_app_setting_get --app=vaultwarden --key=label
2021-05-16 08:00:28,105: DEBUG - ++ [[ label =~ (unprotected|protected|skipped)_ ]]
2021-05-16 08:00:28,105: DEBUG - ++ ynh_app_setting get vaultwarden label
2021-05-16 08:00:28,206: DEBUG - + old_label=
2021-05-16 08:00:28,206: DEBUG - + '[' '' == bitwarden ']'
2021-05-16 08:00:28,207: DEBUG - ++ yunohost user permission list bitwarden --short --output-as plain
2021-05-16 08:00:28,307: DEBUG - + permissions_name=
2021-05-16 08:00:28,307: WARNING - usage: yunohost {user} ...
2021-05-16 08:00:28,308: DEBUG - + ynh_exit_properly
2021-05-16 08:00:28,308: WARNING -                 [-h] [--output-as {json,plain,none}] [--debug] [--quiet]
2021-05-16 08:00:28,308: DEBUG - + local exit_code=2
2021-05-16 08:00:28,308: WARNING -                 [--timeout ==SUPPRESS==] [-v]
2021-05-16 08:00:28,309: DEBUG - + '[' 2 -eq 0 ']'
2021-05-16 08:00:28,309: WARNING - yunohost: error: unrecognized arguments: bitwarden
2021-05-16 08:00:28,309: DEBUG - + trap '' EXIT
2021-05-16 08:00:28,309: DEBUG - + set +o errexit
2021-05-16 08:00:28,309: DEBUG - + set +o nounset
2021-05-16 08:00:28,310: DEBUG - + sleep 0.5
2021-05-16 08:00:28,811: DEBUG - + type -t ynh_clean_setup
2021-05-16 08:00:28,811: WARNING - [Error] Upgrade failed.
2021-05-16 08:00:28,811: DEBUG - + ynh_clean_setup
2021-05-16 08:00:28,812: DEBUG - + ynh_clean_check_starting

I'm not sure where it fails, I guess at the yunohost user permission list bitwarden --short --output-as plain. (edit typo)

changemenemo commented 3 years ago

Yeah so more or less the same result as me then

csolisr commented 3 years ago

I'm currently trying to migrate myself too - not only from BitWarden-RS to VaultWarden, but also from ARM64 on a Raspberry Pi 4 to x86-64 on an Intel board. The app restoration worked, but of course the service fails because it was compiled for ARM64, not for x86-64. I'm currently having a similar error when attempting to upgrade manually with yunohost app upgrade bitwarden -u https://github.com/YunoHost-Apps/vaultwarden_ynh. Relevant lines:

Info: '/var/www/bitwarden/live/.fingerprint' wasn't deleted because it doesn't exist.
Info: '/var/www/bitwarden/live/build' wasn't deleted because it doesn't exist.
Info: '/var/www/bitwarden/live/deps' wasn't deleted because it doesn't exist.
Info: '/var/www/bitwarden/live/examples' wasn't deleted because it doesn't exist.
Info: '/var/www/bitwarden/live/incremental' wasn't deleted because it doesn't exist.
Info: '/var/www/bitwarden/live/.cargo-lock' wasn't deleted because it doesn't exist.
Info: '/var/www/bitwarden/live/vaultwarden.d' wasn't deleted because it doesn't exist.
Info: [###########+........] Updating a config file...
Warning: mv: invalid option -- 'a'
Warning: Try 'mv --help' for more information.
Warning: [Error] Upgrade failed.

Is there a way of clean-installing VaultWarden, then import the database from the backup manually?

changemenemo commented 3 years ago

Any news about the migration problem?

csolisr commented 3 years ago

As a workaround, you can do the following:

Since all the passwords reside in a SQLite database by default, there's no data loss.

yalh76 commented 3 years ago

Any news about the migration problem?

I was working on other apps, I will !!

changemenemo commented 3 years ago

As a workaround, you can do the following:

  • As root, copy the folder /var/www/bitwarden/live/data to a safe location

  • Uninstall Bitwarden, install Vaultwarden

  • Stop Vaultwarden temporarily: sudo systemctl stop vaultwarden

  • Copy the data folder to /var/www/vaultwarden/live/

  • Fix permissions: sudo chown vaultwarden -R /var/www/vaultwarden/live/data

  • Restart Vaultwarden: sudo systemctl start vaultwarden

Since all the passwords reside in a SQLite database by default, there's no data loss.

Yeah that's indeed what I did on some of my equipment yeah

yalh76 commented 3 years ago

Other thread : https://forum.yunohost.org/t/plus-aucune-app-installees-en-partie-admin/15895/5

paoesco commented 3 years ago

As a workaround, you can do the following:

* As root, copy the folder `/var/www/bitwarden/live/data` to a safe location

* Uninstall Bitwarden, install Vaultwarden

* Stop Vaultwarden temporarily: `sudo systemctl stop vaultwarden`

* Copy the `data` folder to `/var/www/vaultwarden/live/`

* Fix permissions: `sudo chown vaultwarden -R /var/www/vaultwarden/live/data`

* Restart Vaultwarden: `sudo systemctl start vaultwarden`

Since all the passwords reside in a SQLite database by default, there's no data loss.

Those steps worked for me.

All good know. Thanks.

croulibri commented 3 years ago

Hello,

I am now without password manager for more than 2 weels :-(

Bitwarden was removed during the failed migration process and I can neither restore my old Bitwarden nor install a fresh Vaultwarden.

If I try to restore backup I get

admin@nos:~$ sudo yunohost backup restore 20210603-204831 --debug
1548 DEBUG initializing base actions map parser for cli
1570 DEBUG loading actions map namespace 'yunohost'
1624 DEBUG building parser...
1645 DEBUG building parser took 0.020s
1648 DEBUG acquiring lock...
1739 DEBUG lock has been acquired
2198 DEBUG loading python module yunohost.backup took 0.459s
2199 DEBUG processing action [19477.1]: yunohost.backup.restore with args={'name': '20210603-204831', 'system': None, 'apps': None, 'force': False}
2240 WARNING YunoHost is already installed
Do you really want to restore an already installed system? [y/N]: y
26601 INFO Preparing archive for restoration...
26629 DEBUG Extracting needed files from the archive…
27593 DEBUG restoring from backup '20210603-204831' created on 2021-06-03 20:48:31
27750 INFO Restoring bitwarden...
28671 DEBUG initialize authenticator 'as-root' with: uri='ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi', base_dn='dc=yunohost,dc=org', user_rdn='gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth'
28800 ERROR Could not restore bitwarden: Something unexpected went wrong: 
Traceback (most recent call last):
  File "/usr/lib/moulinette/yunohost/backup.py", line 1451, in _restore_app
    sync_perm=False,
  File "/usr/lib/moulinette/yunohost/log.py", line 380, in func_wrapper
    result = func(*args, **kwargs)
  File "/usr/lib/moulinette/yunohost/permission.py", line 412, in permission_create
    raise YunohostValidationError("permission_already_exist", permission=permission)
yunohost.utils.error.YunohostValidationError: Permission 'bitwarden.admin' already exists

28811 INFO The operation 'Restore 'bitwarden' from a backup archive' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20210607-200442-backup_restore_app-bitwarden' to get help
29615 DEBUG Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
29616 DEBUG The permission database has been resynchronized
30325 DEBUG Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
30624 DEBUG SSOwat configuration regenerated
30736 DEBUG action [19477.1] executed in 28.536s
30737 DEBUG lock has been released
30737 ERROR Nothing was restored

And if I want to install a completely new app Vaultwarden I get an error too at :

2021-06-07 19:46:24,525: DEBUG -    Compiling try-lock v0.2.3
2021-06-07 19:46:25,045: DEBUG -    Compiling fake-simd v0.1.2
2021-06-07 19:46:25,601: DEBUG -    Compiling gimli v0.23.0
2021-06-07 19:46:28,222: DEBUG -    Compiling utf-8 v0.7.5
2021-06-07 19:46:31,356: DEBUG -    Compiling byte-tools v0.3.1
2021-06-07 19:46:31,697: DEBUG -    Compiling state v0.4.2
2021-06-07 19:46:34,496: DEBUG -    Compiling byte-tools v0.1.3
2021-06-07 19:46:37,153: DEBUG -    Compiling encoding_rs v0.8.28
2021-06-07 19:46:38,938: DEBUG -    Compiling tower-service v0.3.1
2021-06-07 19:46:39,642: DEBUG -    Compiling cfg-if v0.1.10
2021-06-07 19:46:39,930: DEBUG -    Compiling rustc-demangle v0.1.18
2021-06-07 19:46:40,297: DEBUG -    Compiling object v0.23.0
2021-06-07 19:46:44,216: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,217: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:162:41
2021-06-07 19:46:44,218: DEBUG -     |
2021-06-07 19:46:44,219: DEBUG - 162 |             [0x7f, b'E', b'L', b'F', 1, ..] => FileKind::Elf32,
2021-06-07 19:46:44,221: DEBUG -     |                                         ^^
2021-06-07 19:46:44,222: DEBUG -     |
2021-06-07 19:46:44,223: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,225: DEBUG - 
2021-06-07 19:46:44,229: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,234: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:164:41
2021-06-07 19:46:44,242: DEBUG -     |
2021-06-07 19:46:44,243: DEBUG - 164 |             [0x7f, b'E', b'L', b'F', 2, ..] => FileKind::Elf64,
2021-06-07 19:46:44,245: DEBUG -     |                                         ^^
2021-06-07 19:46:44,251: DEBUG -     |
2021-06-07 19:46:44,261: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,262: DEBUG - 
2021-06-07 19:46:44,264: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,265: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:166:38
2021-06-07 19:46:44,272: DEBUG -     |
2021-06-07 19:46:44,273: DEBUG - 166 |             [0xfe, 0xed, 0xfa, 0xce, ..]
2021-06-07 19:46:44,275: DEBUG -     |                                      ^^
2021-06-07 19:46:44,276: DEBUG -     |
2021-06-07 19:46:44,280: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,284: DEBUG - 
2021-06-07 19:46:44,287: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,289: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:167:40
2021-06-07 19:46:44,293: DEBUG -     |
2021-06-07 19:46:44,295: DEBUG - 167 |             | [0xce, 0xfa, 0xed, 0xfe, ..] => FileKind::MachO32,
2021-06-07 19:46:44,308: DEBUG -     |                                        ^^
2021-06-07 19:46:44,309: DEBUG -     |
2021-06-07 19:46:44,310: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,312: DEBUG - 
2021-06-07 19:46:44,313: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,314: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:169:40
2021-06-07 19:46:44,316: DEBUG -     |
2021-06-07 19:46:44,317: DEBUG - 169 |             | [0xfe, 0xed, 0xfa, 0xcf, ..]
2021-06-07 19:46:44,318: DEBUG -     |                                        ^^
2021-06-07 19:46:44,332: DEBUG -     |
2021-06-07 19:46:44,333: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,335: DEBUG - 
2021-06-07 19:46:44,336: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,337: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:170:40
2021-06-07 19:46:44,339: DEBUG -     |
2021-06-07 19:46:44,340: DEBUG - 170 |             | [0xcf, 0xfa, 0xed, 0xfe, ..] => FileKind::MachO64,
2021-06-07 19:46:44,342: DEBUG -     |                                        ^^
2021-06-07 19:46:44,356: DEBUG -     |
2021-06-07 19:46:44,357: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,359: DEBUG - 
2021-06-07 19:46:44,360: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,362: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:172:38
2021-06-07 19:46:44,364: DEBUG -     |
2021-06-07 19:46:44,366: DEBUG - 172 |             [0xca, 0xfe, 0xba, 0xbe, ..] => FileKind::MachOFat32,
2021-06-07 19:46:44,367: DEBUG -     |                                      ^^
2021-06-07 19:46:44,369: DEBUG -     |
2021-06-07 19:46:44,371: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,380: DEBUG - 
2021-06-07 19:46:44,382: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,383: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:174:38
2021-06-07 19:46:44,385: DEBUG -     |
2021-06-07 19:46:44,387: DEBUG - 174 |             [0xca, 0xfe, 0xba, 0xbf, ..] => FileKind::MachOFat64,
2021-06-07 19:46:44,392: DEBUG -     |                                      ^^
2021-06-07 19:46:44,394: DEBUG -     |
2021-06-07 19:46:44,404: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,406: DEBUG - 
2021-06-07 19:46:44,408: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,410: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:178:26
2021-06-07 19:46:44,411: DEBUG -     |
2021-06-07 19:46:44,416: DEBUG - 178 |             [b'M', b'Z', ..] => {
2021-06-07 19:46:44,418: DEBUG -     |                          ^^
2021-06-07 19:46:44,428: DEBUG -     |
2021-06-07 19:46:44,430: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,431: DEBUG - 
2021-06-07 19:46:44,433: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,434: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:194:26
2021-06-07 19:46:44,436: DEBUG -     |
2021-06-07 19:46:44,438: DEBUG - 194 |             [0x4c, 0x01, ..]
2021-06-07 19:46:44,452: DEBUG -     |                          ^^
2021-06-07 19:46:44,454: DEBUG -     |
2021-06-07 19:46:44,455: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,457: DEBUG - 
2021-06-07 19:46:44,459: DEBUG - error[E0658]: subslice patterns are unstable
2021-06-07 19:46:44,460: DEBUG -    --> /var/www/vaultwarden/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:196:28
2021-06-07 19:46:44,462: DEBUG -     |
2021-06-07 19:46:44,464: DEBUG - 196 |             | [0x64, 0x86, ..] => FileKind::Coff,
2021-06-07 19:46:44,465: DEBUG -     |                            ^^
2021-06-07 19:46:44,476: DEBUG -     |
2021-06-07 19:46:44,478: DEBUG -     = note: for more information, see https://github.com/rust-lang/rust/issues/62254
2021-06-07 19:46:44,479: DEBUG - 
2021-06-07 19:47:00,485: DEBUG -    Compiling maplit v1.0.2
2021-06-07 19:47:00,880: DEBUG -    Compiling glob v0.3.0
2021-06-07 19:47:27,029: DEBUG -    Compiling hyperx v1.3.0
2021-06-07 19:47:35,444: DEBUG -    Compiling wyz v0.2.0
2021-06-07 19:47:37,609: DEBUG -    Compiling stable_deref_trait v1.2.0
2021-06-07 19:47:38,051: DEBUG -    Compiling subtle v2.4.0
2021-06-07 19:47:40,166: DEBUG -    Compiling tap v1.0.1
2021-06-07 19:47:41,254: DEBUG -    Compiling funty v1.1.0
2021-06-07 19:47:44,354: DEBUG - error: aborting due to 11 previous errors
2021-06-07 19:47:44,356: DEBUG - 
2021-06-07 19:47:44,357: DEBUG - For more information about this error, try `rustc --explain E0658`.
2021-06-07 19:47:44,401: DEBUG - error: could not compile `object`.
2021-06-07 19:47:44,403: DEBUG - warning: build failed, waiting for other jobs to finish...
2021-06-07 19:48:05,579: DEBUG - error: build failed
2021-06-07 19:48:05,622: DEBUG - + ynh_exit_properly
2021-06-07 19:48:05,632: DEBUG - + local exit_code=101
2021-06-07 19:48:05,633: DEBUG - + rm -rf /var/cache/yunohost/download/
2021-06-07 19:48:05,684: DEBUG - + '[' 101 -eq 0 ']'
2021-06-07 19:48:05,685: DEBUG - + trap '' EXIT
2021-06-07 19:48:05,686: DEBUG - + set +o errexit
2021-06-07 19:48:05,695: DEBUG - + set +o nounset
2021-06-07 19:48:05,696: DEBUG - + sleep 0.5
2021-06-07 19:48:06,223: DEBUG - + type -t ynh_clean_setup
2021-06-07 19:48:06,226: DEBUG - + ynh_clean_setup
2021-06-07 19:48:06,228: DEBUG - + ynh_clean_check_starting

My server is a Kimsufi KS-1 with RAM: Total: 1,9 GB - Current use: 1,1 GB SWAP: Total: 4,5 GB - Current use: 265 MB Disk Space on / : 7.95 GB Disk Space on /home : 301.09 GB

Do you have any idea how to get back either the old Bitwarden or a fresh Vaultwarden. I have a backup of my vault anyway.

Thanks in advance :bowing_man:

jsonoctopus commented 3 years ago

@croulibri Good idea to share more info with the paste suggestion ?

28811 INFO The operation 'Restore 'bitwarden' from a backup archive' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20210607-200442-backup_restore_app-bitwarden' to get help

croulibri commented 3 years ago

Thanks @jsonoctopus for looking at my situation...

This log is :

ended_at: 2021-06-07 20:04:44.019943
error: "Could not restore bitwarden: Something unexpected went wrong: \nTraceback\
  \ (most recent call last):\n  File \"/usr/lib/moulinette/yunohost/backup.py\", line\
  \ 1451, in _restore_app\n    sync_perm=False,\n  File \"/usr/lib/moulinette/yunohost/log.py\"\
  , line 380, in func_wrapper\n    result = func(*args, **kwargs)\n  File \"/usr/lib/moulinette/yunohost/permission.py\"\
  , line 412, in permission_create\n    raise YunohostValidationError(\"permission_already_exist\"\
  , permission=permission)\nyunohost.utils.error.YunohostValidationError: Permission\
  \ 'bitwarden.admin' already exists\n"
interface: cli
operation: backup_restore_app
parent: null
related_to:
- - app
  - bitwarden
started_at: 2021-06-07 20:04:42.896278
success: false
yunohost_version: 4.2.5.3

============

2021-06-07 20:04:42,968: INFO - Restoring bitwarden...
2021-06-07 20:04:44,018: ERROR - Could not restore bitwarden: Something unexpected went wrong: 
Traceback (most recent call last):
  File "/usr/lib/moulinette/yunohost/backup.py", line 1451, in _restore_app
    sync_perm=False,
  File "/usr/lib/moulinette/yunohost/log.py", line 380, in func_wrapper
    result = func(*args, **kwargs)
  File "/usr/lib/moulinette/yunohost/permission.py", line 412, in permission_create
    raise YunohostValidationError("permission_already_exist", permission=permission)
yunohost.utils.error.YunohostValidationError: Permission 'bitwarden.admin' already exists
jsonoctopus commented 3 years ago

@croulibri

yunohost.utils.error.YunohostValidationError: Permission 'bitwarden.admin' already exists

Can you remove the bitwarden app first, and then try a restore ? And maybe search or ask in the forum ? https://forum.yunohost.org/search?q=bitwarden

Good luck!

croulibri commented 3 years ago

Hello @jsonoctopus ,

As I said in my first message, I can neither restore my old Bitwarden nor install a fresh Vaultwarden. I don't have any more Bitwarden app, but I guess the failed migration from Bitwarden to Vaultwarden did not remove properly Bitwarden app as I see 'bitwarden.admin' already exists

Do you know how can I really remove all remaining components and traces of old Bitwarden, including bitwarden.admin ? The classic yunohost app remove bitwarden only tells me there is no bitwarden app...

csolisr commented 3 years ago

You could attempt reinstalling Bitwarden, then uninstalling it so all the settings are clean, and finally install Vaultwarden. Finally, you can extract the /var/www/bitwarden/live/data folder from the Bitwarden backup and overwrite the corresponding folder for Vaultwarden as explained above.

croulibri commented 3 years ago

Yes, this could be a solution, but how can I install Bitwarden, the Yunohost app doesn't exists any more and my bitwarden backup failed to be restored?

jsonoctopus commented 3 years ago

I still have an old Bitwarden install that needs updating or a fresh install. On that one I searched for bitwarden.admin in /etc /opt and /var and found nothing :( Maybe rent a VPS, and on that one try a restore app the bw app, and then compare the two servers to learn by comparing what needs removing from your current install to make a restore of the bw app work. Or test restoring backups of all your other applications on a fresh VPS install and if that goes well, do a fresh install on your current server, restore all the other apps and then install a fresh Vaultwarden as well.

croulibri commented 3 years ago

I might be confused but I though bitwarden.admin is more a permission than a file. I guess this is part of the configuration of the administration of Yunohost, each app may have a system of permission in place. So I was rather looking for a Yunohost "tool" or "command" in order to run again the removal process and check and completely remove any old configuration of Bitwarden in the Yunohost management system.

But I may be mistaken...

jsonoctopus commented 3 years ago

Yes, maybe you are right. Now I did a test with my old install. Made a backup of BW app, then removed it and tried to restore which failed. It complained about a dpkg problem caused by different openssl libssl versions caused by the extra php apt sources. When I solved this problem the restore worked fine and BW worked. Which are you using, Buster or Stretch ? And is apt showing any errors ?

croulibri commented 3 years ago

I am with Debian Buster, with a Yunohost install up to date.

In my case, the restore error are listed at https://github.com/YunoHost-Apps/vaultwarden_ynh/issues/137?_pjax=%23js-repo-pjax-container#issuecomment-856258633 I think (but I'm not sure) the problem is not about dpkg but rather the permission bitwarden.admin . Do you know how to remove such permission?

croulibri commented 3 years ago

When I make

admin@XXX:~$ sudo yunohost user permission list
permissions:
  bitwarden.admin:
    allowed:

So `bitwarden.admin' permission still exist while Bitwarden app has been removed (not totally it seems) during the failed migration.

I tried to remove by doing:

admin@nos:~$ sudo yunohost user permission info bitwarden.admin
additional_urls:
allowed:
auth_header: True
corresponding_users:
label: admin
protected: False
show_tile: False
url: None
admin@nos:~$ sudo yunohost user permission remove bitwarden.admin --debug
455  DEBUG initializing base actions map parser for cli
461  DEBUG loading actions map namespace 'yunohost'
468  DEBUG building parser...
535  DEBUG building parser took 0.067s
540  DEBUG acquiring lock...
584  DEBUG lock has been acquired
653  DEBUG loading python module yunohost.user took 0.068s
653  DEBUG processing action [7105.1]: yunohost.user.permission.remove with args={'permission': 'bitwarden.admin', 'names': []}
891  DEBUG initialize authenticator 'as-root' with: uri='ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi', base_dn='dc=yunohost,dc=org', user_rdn='gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth'
1628 DEBUG Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
2398 DEBUG Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
2402 DEBUG Nothing to update in LDAP
3093 DEBUG Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
3094 DEBUG The permission database has been resynchronized
3851 DEBUG Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
4095 DEBUG SSOwat configuration regenerated
4828 DEBUG Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
4829 DEBUG Permission 'bitwarden.admin' updated
4839 DEBUG To view the log of the operation 'Update accesses for permission 'bitwarden'', use the command 'yunohost log show 20210610-082807-user_permission_update-bitwarden20210610-082807-user_permission_update-bitwarden'
4865 DEBUG action [7105.1] executed in 4.211s
4866 DEBUG lock has been released
additional_urls:
allowed:
auth_header: True
corresponding_users:
label: admin
protected: False
show_tile: False
url: None
admin@nos:~$ sudo yunohost user permission list
permissions:
  bitwarden.admin:
    allowed:

So it is still there :-(

May I kindly ask to @yalh76 how can I remove `bitwarden.admin' permission in order to be able to restore my old BitWarden following a failed migration try (I suspect this is the main problem) ?

yalh76 commented 3 years ago

Seems there is an error

https://paste.yunohost.org/raw/ogunowonef

Your error is: 2021-05-14 00:33:48,691: WARNING - warning: it looks like you have an existing installation of Rust at: 2021-05-14 00:33:48,691: WARNING - warning: /usr/bin 2021-05-14 00:33:48,691: WARNING - warning: rustup should not be installed alongside Rust. Please uninstall your existing Rust first.

yalh76 commented 3 years ago

May I kindly ask to @yalh76 how can I remove `bitwarden.admin' permission in order to be able to restore my old BitWarden following a failed migration try (I suspect this is the main problem) ?

You can use: yunohost user permission remove bitwarden.admin

croulibri commented 3 years ago

Thanks @yalh76 for your answer!

I ran the command you proposed me and the log of this operation is:

admin@nos:~$ sudo yunohost log show 20210702-072731-user_permission_update-bitwarden
description: Update accesses for permission 'bitwarden'
log_path: /var/log/yunohost/categories/operation/20210702-072731-user_permission_update-bitwarden.log
logs:
  - 2021-07-02 07:27:32,737: DEBUG - Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
  - 2021-07-02 07:27:33,441: DEBUG - Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
  - 2021-07-02 07:27:33,442: DEBUG - The permission database has been resynchronized
  - 2021-07-02 07:27:34,201: DEBUG - Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
  - 2021-07-02 07:27:34,429: DEBUG - SSOwat configuration regenerated
  - 2021-07-02 07:27:35,149: DEBUG - Uhoh, unknown permission bitwarden.main ? (Maybe we're in the process or deleting the perm for this app...)
  - 2021-07-02 07:27:35,150: DEBUG - Permission 'bitwarden.admin' updated
metadata:
  args:
    force: False
    permission: bitwarden.admin
    protected: None
    remove:
    sync_perm: True
  ended_at: 2021-07-02 07:27:35
  error: None
  interface: cli
  operation: user_permission_update
  parent: None
  related_to:
    - app
    - bitwarden
  started_at: 2021-07-02 07:27:31
  success: True
  yunohost_version: 4.2.6.1
metadata_path: /var/log/yunohost/categories/operation/20210702-072731-user_permission_update-bitwarden.yml
name: 20210702-072731-user_permission_update-bitwarden

and then I do

admin@nos:~$ sudo yunohost user permission list
permissions:
  bitwarden.admin:
    allowed:

😢 bitwarden.admin is still there...

I there another way to remove this permission ?

yalh76 commented 3 years ago

I there another way to remove this permission ?

I don't know enough YunoHost to manage that, can you ask in the YunoHost Matrix channel ?

croulibri commented 3 years ago

For the record, the solution to remove bitwarden.admin permission was: run yunohost tools shell then in the shell: from yunohost.permission import permission_delete then permission_delete("bitwarden.admin") then Ctrl+D to close the shell

Thanks @Alekswag:matrix.org for your advices!