Restore backups without post-install

,

:uk:/:us:

Hello,

I tried to restore Yunohost from backups on my Raspberry.

  1. download latest version 🗸
  2. flash the disk 🗸
  3. boot 🗸
  4. skip post-installation and restore backups ???

How I’m supposed to do? I think this was explained on the previous web site but I cannot find it again. I guess I need the default root password and then restore system backup ?


:fr:

Bonjour,

J’ai essayé de restaurer Yunohost à partir des backups sur mon Raspberry.

  1. télécharger la dernière image 🗸
  2. flasher le disque 🗸
  3. booter 🗸
  4. sauter la post-installation pour restaurer les backups ???

Comment faire ? Je pense que j’avais lu ça sur l’ancien site mais je ne retrouve plus l’info. Je suppose que j’ai besoin du mot de passe de root pour pouvoir restaurer les sauvegardes ?

Hi,

I did it with a log in as admin via SSH. To simplify matters, I connected to the old Yunohost and the new Yunohost via SSHFS. The old one is mounted at /home/wbk/sshfs, the new one is mounted at /home/wbk/sshfs2:

$ cp /home/wbk/sshfs/home/yunohost.backup/archives/20210923-210543.* /home/wbk/sshfs2/home/yunohost.backup/archives/ & sync

If your backup is on your laptop/workstation, and you can copy it directly, it would be :

$ scp /home/wbk/yunobackup/20210923-210543.*  admin@yuno-IP:/home/yunohost.backup/archives/ 
$ ssh admin@yuno-IP 
# enter password, you're in your Yunohost now
$ yunohost backup restore 20210923-210543

Does that help, or, at least, look helpful?

Thanks for your answer. It’s what I wanted to do. Anyway I’m on a headless machine, so I need to ssh. My problem is : when the post-install is not done, which account do I use for ssh? The admin account is not created, so I guess I have to use the root account. Is there a default password for it ?

I realize you got a ready-to-go image for Raspberry, is that correct? I have no experience with that image. In my case it was always Debian/Armbian + Yunohost, so the server was already installed when I needed to restore an image.

I think admin is already available before post install, but without a password. I imagine adding your SSH key to Yunohost should do the trick:

  • Check if you got, on your regular computer, an SSH-keypair:
    $ ls ~/.ssh/id_rsa*
  • There should be a private key (id_rsa) and a public key (id_rsa.pub). Give the public key to everyone. Never share your private key!
  • No keyfile? Generate it with $ ssh-keygen and follow the steps. It is generally considered safe (and convenient) to generate a key without passphrase.
  • connect your storage from the Raspberry (uSD card or USB drive) to your regular computer
  • Check to see if there is an authorized-keys-file, $ cat /media/'yunostorage'/home/admin/.ssh/authorized_keys.
  • I think there is no file yet. In that case, copy your ~/.ssh/id_rsa.pub to the Yunohost storage and rename it to authorized_keys, in admin’s home directory: cp ~/.ssh/id_rsa.pub /media/'yunostorage'/home/admin/.ssh/authorized_keys
  • Sync/safely disconnect the Yunostorage, and reconnect it to your Raspberry.
  • Now you should be able to log in to yunohost from your computer, as your regular user account with ssh admin@yunohost-ip.

All of this is on your laptop/workstation, not on your Yunohost. It seems a bit convoluted, but once you got your key in the authorized_keys file on your Yunohost, logging in is more convenient.

The authorized_keys file, by the way, looks something like this:

$ cat /home/admin/.ssh/authorized_keys 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDU7Q16k3lUNPz9SsgyS/ENTinYyV0zDXL+raRzBBoYgwFq+9XpK+ZZ/wId8j+xUhvhATU7rN0tcEh16QZvRhui1NEClDMTY2dSC67e+j0Ll4dC9WOkdQl5kGhyFuOGxnaNqSnahOAYgq8fBb2brLkjoEqRYrjSl2EuAhQvqe46gKB2qBc/VNTHvJSIhm3W7R7k/xO8VH6mQkbHnW/vusBtFTU4R1wcuDm46k3sCdR856Fw/czt089zvuQDKgHHXUR5R58aEEUCTQ78M0sFajyYR0X1VUzP35y9p+qtA8Esi9QktidrD5KdHFwbqbNq73pCUpdAdAbaM5HBPKVpv8Fz wbk@tp

So, it starts with the encryption scheme (ssh-rsa → rsa), then lists the public key (the letters and numbers), and finally the remote username @ remote computer (wbk@tp).

Don’t use my example in your Yunohost: then I can log in to your system :stuck_out_tongue:

Good luck!

OK thanks.

Next time I start from a brand new image, I’ll check is root has ssh access without password before post-install. I was expecting some default password so I didn’t even tried.

Yes, root / yunohost, just like for regular install

1 Like

Thanks @Aleks . That used to be somewhere in the documentation but noway to find it again. Is it still documented?

Yes for example in SSH and command line | Yunohost Documentation

2 Likes