#1070 Issue closed: Arch recover failure from cifs share

Labels: support / question, fixed / solved / done

danboid opened issue at 2016-11-17 11:52:

  • rear version (/usr/sbin/rear -V): 1.19 git
  • OS version (cat /etc/rear/os.conf or lsb_release -a): Arch x86_64
  • rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf):

OUTPUT=USB
USB_DEVICE=/dev/sdb1
BACKUP=NETFS
BACKUP_URL=cifs://192.168.1.4/sys
BACKUP_OPTIONS="username=dan,pass=xxxxxxxxxxxx"

  • Brief description of the issue

I have Arch x86_64 installed onto a single XFS partition on sda1. I installed rear git from the AUR:

https://aur.archlinux.org/packages/relax-and-recover-git/

Installation went fine but I noticed the rear PKGBUILD doesn't have samba as a dep so I also installed samba as I want to backup and restore to/from a cifs share so I presumed samba would be required. The rear format, mkrescue and mkbackuponly commands all seemed to work fine under Arch so after backing up I formatted my HD.

My recovery USB stick booted OK but when it came to recovery, rear failed using both the manual and auto recovery modes as it seemed to be unable to mount the samba share. Note that this is exactly the same samba share that I managed to recover (mostly) Ubuntu MATE from last week. I have attached screenshots of the errors.

Although I've not properly investigated this yet nor do I really have anything to back up my hypothesis, I suspect this mount error will be caused because either samba isn't being installed onto the recovery USB drive or it isn't getting started successfully in time for the mount command but I'm just guessing.
arch-smb-auto-rec-err
arch-smb-auto-rec-log
arch-smb-manual-rec-err

gozora commented at 2016-11-17 14:13:

@danboid
First, I really love your screenshots :-)
In screenshot you have mount error (101): network is unreachable.
So my best guess is that ReaR recovery system failed to setup network (it can happen now and then).
So executing ifconfig <network_device_name> inet <ip_address> netmask <netmak> and rear recover should help.

danboid commented at 2016-11-17 14:26:

Hi Vlad!

Glad you like the screenshots! :)

I'll try that ifconfig command when I get home. I only tried booting the recovery USB and restoring twice but bringing up the network must've failed on both attempts because both auto and manual recovery failed.

If the ifconfig command fixes recover, could some code be added to rear somewhere to make bringing up NICs more reliable under Arch? Activating interfaces seems to work OK for Ubuntu.

gozora commented at 2016-11-17 14:32:

Hello @danboid,
If manual bring up devices helps, check #951 especially comment about NETWORKING_SETUP_COMMANDS option ...
It might help you to setup network manually when automatic setup fails.

jsmeix commented at 2016-11-17 16:56:

Note that during development I had renamed
NETWORKING_SETUP_COMMANDS into
NETWORKING_PREPARATION_COMMANDS

In general see
usr/share/rear/conf/default.conf
for what can be set in a particular ReaR version.

danboid commented at 2016-11-17 18:46:

Woohoo!

I just did my first successful rear recovery and it was Arch on XFS via Samba using the above config.

All I had to do was boot the recovery USB in manual recovery mode then run:

dhcpcd eth0
rear -v recover

I'd like to change this bug report into a feature request / suggestion. There should be no need for me to have to add dhcpcd eth0 into the local.conf options because I expected rear to assign itself an address on eth0 via DHCP when I chose automatic recovery. Instead, DHCP should be used, just on eth0, by default in the auto recovery mode and a new option should be added to prevent DHCP via eth0 if thats not what you want but I imagine most users will be using DHCP and would appreciate this.

gozora commented at 2016-11-17 20:38:

Congrats @danboid to your successful restore!
I wish you least number of OS restores in life as possible.
I'm not using dhcp much, but reading default.conf

# Say "y", "Yes" (or any not empty string) to enable the DHCP client protocol
# which lets the rescue/recovery system run dhclient to get an IP address
# instead of using the same IP address as the original system:
USE_DHCLIENT=

So maybe try to set USE_DHCLIENT=yes in your /etc/rear/local.conf

gozora commented at 2016-11-17 20:41:

Or NETWORKING_PREPARATION_COMMANDS="dhcpcd eth0" should work fine as well.

danboid commented at 2016-11-17 23:44:

Hi Vlad

I knew there was at least one way to activate DHCP in local.conf but why is it that Ubuntu MATE's auto-restore worked (I was assigned an address) whilst with Arch I had to run dhcp manually? With both OSs I was using DHCP before running rear mkbackup and I used the same config file, same router/DHCP server and same samba server for both. Hence its only logical I should expect rear to act the same with both distros.

I can be certain its not a case of missing software from the recovery disk now. Maybe Ubuntu defaults to USE_DHCLIENT=yes whilst Arch defaults to USE_DHCLIENT=no?

danboid commented at 2016-11-18 01:55:

Might as well close this now.

I may open another ticket if there is irregular DHCP behaviour going on when recovering different distros.

jsmeix commented at 2016-11-18 09:03:

@danboid
in general do not expect too much automated magic from ReaR,
cf. the section "Disaster recovery with Relax-and-Recover" in
https://en.opensuse.org/SDB:Disaster_Recovery

What I use on my SUSE systems is (in local.conf)

SSH_ROOT_PASSWORD="rear"
USE_DHCLIENT="yes"

which makes network setup via DHCP plus
remote access via ssh "just work" for me, cf.
https://github.com/rear/rear/tree/master/usr/share/rear/conf/examples
and the sub-section "First steps with Relax-and-Recover" in
https://en.opensuse.org/SDB:Disaster_Recovery

When things in ReaR do not work o.k. for you with
your particular system in your particular environment,
see the sub-sections
"Debugging issues with Relax-and-Recover",
"How to adapt and enhance Relax-and-Recover", and
"How to contribute to Relax-and-Recover" in
https://en.opensuse.org/SDB:Disaster_Recovery

If you like to adapt and enhance Relax-and-Recover
in particular for Ubuntu and Arch Linux, have a look at
https://github.com/rear/rear/wiki/Developers-Guide and
https://github.com/rear/rear/wiki/Coding-Style

danboid commented at 2016-11-22 12:10:

I thought I should give a quick update to say that I gave rear another go with Arch last night using the following local.conf:

# Create a USB recovery drive
OUTPUT=USB
# Be sure to set the device correctly!
USB_DEVICE=/dev/sdb1
BACKUP=NETFS
# Path to the samba share
BACKUP_URL=cifs://192.168.1.4/sys
# Username and password of a samba/AD user with access to the share
BACKUP_OPTIONS="username=dan,pass=xxxxxxxxxxxx"
# Use DHCP to get an address before recovery
USE_DHCLIENT=yes

Thanks to using USE_DHCLIENT=yes this time, auto recovery mode 'just worked' - yay!

I'd like to see my commented config added as an example that comes included with the rear sources because none of the included examples use USB for the recovery device or a samba share as the backup target. I would call the file USB-and-samba-example.conf

I should've mentioned it before but the rear man page recommends using a credentials file for using samba shares but I failed to get that to work, hence why I had to give the username and password in the backup options.

gozora commented at 2016-11-22 15:56:

@danboid if you want to add your config to ReaR upstream, easiest way (IMHO) is to create pull request ...

danboid commented at 2016-11-22 17:01:

I tidied up my config a bit, made it more generic, improved the comments and submitted a pull request.

ProBackup-nl commented at 2017-04-16 10:03:

@danboid Where is the related pull request? (which issue number?)

jsmeix commented at 2017-04-26 10:43:

@ProBackup-nl
only a guess: Perhaps that pull request is
https://github.com/rear/rear/pull/1079


[Export of Github issue for rear/rear.]