Failed migration / Impossible to restore Bitwarden or install a fresh Vaultwarden

Hello,

I have tried the migration tool from Bitwarden to Vaultwarden and it failed. :thinking:

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

If I try to restore my last 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

I seems a problem with Permission 'bitwarden.admin' already exists :worried:

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

So it seems a compilation issue :sob:

For your information, 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 (I have increased swap recently to try to solve compilation issue, without success)
Disk Space on / : 7.95 GB
Disk Space on /home : 301.09 GB
YunoHost 4.2.5.3

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:

PS : discussion on github without solution so far at No migration ? · Issue #137 · YunoHost-Apps/vaultwarden_ynh · GitHub

So solve my problem an restore my old Bitwarden, I tried:

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 process.

I tried to remove `bitwarden.admin’ 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 :frowning:

May I kindly :bowing_man: ask to some dev of Yunohost how can I remove `bitwarden.admin’ permission in order to be able to restore my old BitWarden following this failed migration?
:hugs: