Back in time doesn’t restore root and delete files from later

Asked by Chris

I reinstalled a package on my Arch machine causing some issues with shutdown. So, I went ahead and tried rolling back to an earlier date. Initially, I did a normal restore, which kept the more recent files. Afterwards, I realized I needed to explicitly select "restore and delete" to delete those files. So, I tried that option and got duplicate pacman entries for the newest and most recent version of packages.

I then tried Ubuntu Kylin live cd, added the back in time ppa, and tried restore and delete. I ended up getting a bunch of errors about not being able to delete directories. The system still boots, and runs like it did at the time step, but pacman has a bunch of duplicate entries now. I reran back in time once more from arch moving back to an even earlier date, but still have the issue with more recent files being kept.

I think when I tried restoring from the Ubuntu live cd the files aren't deleted / copied to the correct location. So, what's the proper means of restoring root to an earlier date from a live cd?

Question information

Language:
English Edit question
Status:
Answered
For:
Back In Time Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Germar (germar) said :
#1

Did you run backintime as root from the LiveCD? Otherwise it might not be able to delete those files.

If you run backintime directly in Arch it could be that those files are in use.

Revision history for this message
Chris (nowisnever) said :
#2

I launched the root version. I don't know if it's how Ubuntu handles root that might be messing with restoring everything correctly. I'm guessing that all I need to do is mount the partitions those files belong to, and click restore and delete.

Would something like grml be better for this? Is their a rescue distribution that works well with BiT out of the box? I managed to install backintime on a grml live usb, but can't get it to run. I keep getting this call back when I try to run it.

Traceback (most recent call last):
  File "/usr/share/backintime/common/backintime.py", line 26, in <module>
    import config
  File "/usr/share/backintime/common/config.py", line 30, in <module>
    import tools
  File "/usr/share/backintime/common/tools.py", line 27, in <module>
    import dbus
ImportError: No module named dbus

Revision history for this message
Germar (germar) said :
#3

I'd have done it the same way and it should (TM) work. Can you run it again from LiveCD and post the restore log (/root/local/share/restore_.log)?

There is a bug #1495295 preventing to restore file owner and group. I'll add an option in over next version to parse different /etc/passwd and /etc/group files and adjust the uid/gid to name table manually. But I don't think this is a problem here.

Using grml or Ubuntu doesn't change anything. They both do the same. The ImportError is caused by missing python3-dbus package

Revision history for this message
Chris (nowisnever) said :
#4

Thanks, all of that should help me out down the line.

I just figured out what's happening. When running from a live cd BiT is restoring to the cd's root, and not Arch's. Are there any commands I should add to make sure the restore reaches the correct directories?

Revision history for this message
Germar (germar) said :
#5

Oh, sure. Just manually mount your drive to /mnt and... ehmmm... I was about to write >>use 'Restore to ...'<<. But now I see your problem. There is no 'Restore to ... and delete'

Okay here's the deal: install backintime from testing PPA and run restore from command line:
sudo add-apt-repository ppa:bit-team/testing
sudo apt-get update
sudo apt-get install backintime-common
sudo -i backintime restore "/" "/mnt" 0 --delete

But keep in mind that this will delete all files/folders which are not in the snapshot. Everything that was excluded! You may want to run it with --local-backup so rsync will not delete those files but rename them with a suffix. If you're sure you don't need them anymore you can remove them with 'find ./ -name "*.backup.20150923" -delete'

I'll add the 'Restore to ... and delete' option next week.

Revision history for this message
Chris (nowisnever) said :
#6

Thanks. I'm guessing auto generated files, like tmp will just come back the next time I reboot? So, all I do is mount every partition used to /mnt, and then run restore. Hopefully, this works and I don't have to do a complete reinstall.

Revision history for this message
Chris (nowisnever) said :
#7

Ok, I got to run. I got some errors. Give me a sec to see if I can get into the error log. (I don't know how to gain permission for looking at the root account of another install through Ubuntu)

Revision history for this message
Chris (nowisnever) said :
#8

This is the command I ran. sudo -i backintime restore "/" "/mnt" "20150921-000002-243" --delete --local-backup

There were a few errors listed in the terminal while the restore command was running. The restore log backintime created doesn't seem to have the errors. Here's the log in case it helps anyways. https://www.dropbox.com/s/it5jar5rrb1jqy0/restore_.log?dl=0

Revision history for this message
Chris (nowisnever) said :
#9

Alright, I printed the log out with errors to a separate log file for the command used above. After restoring I can't login through lightdm using webkit to my desktop, and going to TTY prompt 1 causes the display to turn red. (I might still be able to enter commands) The other TTY prompts don't cause a red screen.

I get a number of cannot delete non-empty directory output, and a few errors. (I don't know if these would matter for restoring the system)

The error outputs are:

deleting var/lib/NetworkManager/dhclient-9f5d1beb-83df-4c97-9cb9-5036bc86cf24-eno1.leasersync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.0]

ERROR: Failed to get UID for b'zerophase': 'getpwnam(): name not found: zerophase'
ERROR: Failed to get GID for b'wireshark': 'getgrnam(): name not found: wireshark'
ERROR: Failed to get GID for b'locate': 'getgrnam(): name not found: locate'
ERROR: Failed to get GID for b'dbus': 'getgrnam(): name not found: dbus'
ERROR: Failed to get GID for b'systemd-journal': 'getgrnam(): name not found: systemd-journal'
ERROR: Failed to get UID for b'-': 'getpwnam(): name not found: -'
ERROR: Failed to get GID for b'-': 'getgrnam(): name not found: -'
ERROR: Failed to get GID for b'gdm': 'getgrnam(): name not found: gdm'
ERROR: Failed to get UID for b'ntp': 'getpwnam(): name not found: ntp'
ERROR: Failed to get GID for b'ntp': 'getgrnam(): name not found: ntp'
ERROR: Failed to get GID for b'mdm': 'getgrnam(): name not found: mdm'
ERROR: Failed to get GID for b'nobody': 'getgrnam(): name not found: nobody'
ERROR: Failed to get UID for b'privoxy': 'getpwnam(): name not found: privoxy'
ERROR: Failed to get GID for b'privoxy': 'getgrnam(): name not found: privoxy'
ERROR: Failed to get UID for b'polkitd': 'getpwnam(): name not found: polkitd'
ERROR: Failed to get GID for b'systemd-journal-remote': 'getgrnam(): name not found: systemd-journal-remote'
ERROR: Failed to get UID for b'http': 'getpwnam(): name not found: http'
ERROR: Failed to get GID for b'http': 'getgrnam(): name not found: http'
ERROR: Failed to get UID for b'deluge': 'getpwnam(): name not found: deluge'
ERROR: Failed to get GID for b'deluge': 'getgrnam(): name not found: deluge'
ERROR: Failed to get GID for b'ftp': 'getgrnam(): name not found: ftp'

Here's the full log file: https://www.dropbox.com/s/qtsv4feuxim0n3q/backintimeError.log?dl=0

Any suggestions for work arounds? For fixing the passwd and group file permisions I should just be able to run BiT, by chrooting in to the system? What about the files I couldn't delte?

Revision history for this message
Germar (germar) said :
#10

This is the bug #1495295 that I already told. These groups and users doesn't exist on the LiveCD. And this is also why you can't login through lightdm. Running BIT in chroot or after booting your normal system in text mode will fix the permissions.

Run this command:
backintime restore "/" "" "20150921-000002-243"

I think, you can ignore the file that couldn't be deleted. That's just a dhcp lease file. You'll get a new lease from your router anyways.

Revision history for this message
Chris (nowisnever) said :
#11

Hey, know if for Arch if I need to install backintime-cli. The normal install of it is giving me errors when I try to run it on the command-line. I saw a fix that involved installing Python 3,but I had it all setup and running fine with Python2 before. I just don't want to break the rest of the install by doing a partial upgrade.

Revision history for this message
Chris (nowisnever) said :
#12

Considering BiT isn't functional after the restore, could running rsync, or a bash script providing the same functionality work?

Revision history for this message
Chris (nowisnever) said :
#13

These are the specific errors I'm getting when trying to run BackInTime:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/usr/lib/python3.4/site-packages/dbus/bus.py", line 361, in get_name_owner
    's', (bus_name,), **keywords)
  File "/usr/lib/python3.4/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'net.launchpad.backintime.serviceHelper': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/backintime/common/backintime.py", line 437, in <module>
    start_app()
  File "/usr/share/backintime/common/backintime.py", line 156, in start_app
    cfg = config.Config(config_path)
  File "/usr/share/backintime/common/config.py", line 268, in __init__
    self.setupUdev = tools.SetupUdev()
  File "/usr/share/backintime/common/tools.py", line 1036, in __init__
    conn = bus.get_object(SetupUdev.CONNECTION, SetupUdev.OBJECT)
  File "/usr/lib/python3.4/site-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python3.4/site-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python3.4/site-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python3.4/site-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python3.4/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: Failed to execute program net.launchpad.backintime.serviceHelper: Permission denied

Revision history for this message
Germar (germar) said :
#14

Hmm. BIT doesn't start because of wrong permissions. The dog bitting its own tail...

You could also try to copy all reported users/groups in your comment #9 from the passwd/groups in the snapshot to /etc/passwd and /etc/groups in LiveCD and restore again.

Can you help with this problem?

Provide an answer of your own, or ask Chris for more information if necessary.

To post a message you must log in.