Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

Support systems with Docker #189

Open
ilya40umov opened this issue May 7, 2018 · 38 comments
Open

Support systems with Docker #189

ilya40umov opened this issue May 7, 2018 · 38 comments

Comments

@ilya40umov
Copy link

Hey, thanks for creating this amazing software! (It has saved my day a few times already).

I know it's currently unsupported, but since Docker is being used by lots of the developers nowadays, it would be really nice to have support systems that are running Docker daemon (no need to support timeshift inside of Docker).

E.g. right now if docker daemon is running, Timeshift shows Path being /var/lib/docker/plugins.
It's probably due to Docker mounting plugins directory

/dev/mapper/ubuntu--vg-root on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/mapper/ubuntu--vg-root on /var/lib/docker/plugins type ext4 (rw,relatime,errors=remount-ro,data=ordered)

As a workaround right now I manually stop docker service before taking a snapshot / doing restore, but as a result I can't do scheduled backups.

@divanvisagie
Copy link

divanvisagie commented May 8, 2018

Hi there, I'm pretty much a passer by looking for projects I use that I can contribute to. Anyway this looks like an interesting one to look into so I am just going to butt in here.

First since you can see the path I am assuming you are doing backups in the command line via timeshift --create

I installed docker and while pulling a container ran the same thing with the following output occuring:

------------------------------------------------------------------------------
Creating new snapshot...(RSYNC)
Saving to device: /dev/sdb2, mounted at path: /
Linking from snapshot: 2018-05-08_19-34-05
Synching files with rsync...
Created control file: /timeshift/snapshots/2018-05-08_19-38-01/info.json        
RSYNC Snapshot saved successfully (8s)
Tagged snapshot '2018-05-08_19-38-01': ondemand
------------------------------------------------------------------------------

Would you be able to provide a more detailed output as well?

@ilya40umov
Copy link
Author

ilya40umov commented May 10, 2018

@divanvisagie
I'm currently on my Linux Mint laptop, with a slightly different version of docker and different drive names, but essentially when the docker daemon is running I'm getting the following output when running sudo timeshift --list:

(process:20868): Gtk-CRITICAL **: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
(process:20868): Gtk-CRITICAL **: gtk_icon_theme_append_search_path: assertion 'GTK_IS_ICON_THEME (icon_theme)' failed
Device : /dev/dm-1
UUID   : ac093bd8-0b0d-441a-960d-561ffb0c660a
Path   : /var/lib/docker/aufs
Mode   : RSYNC
Device is OK
6 snapshots, 377.8 GB free

Num     Name                 Tags  Description  
------------------------------------------------------------------------------
0    >  2018-04-02_14-53-08  O                  
1    >  2018-04-28_20-00-02  M                  
2    >  2018-05-02_11-00-01  W                  
3    >  2018-05-08_00-00-02  D                  
4    >  2018-05-09_21-00-01  W                  
5    >  2018-05-09_22-00-01  D 

However, when I stop docker manually with sudo service docker stop, then the output changes to

(process:19515): Gtk-CRITICAL **: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
(process:19515): Gtk-CRITICAL **: gtk_icon_theme_append_search_path: assertion 'GTK_IS_ICON_THEME (icon_theme)' failed
Device : /dev/dm-1
UUID   : ac093bd8-0b0d-441a-960d-561ffb0c660a
Path   : /
Mode   : RSYNC(process:19515): Gtk-CRITICAL **: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
(process:19515): Gtk-CRITICAL **: gtk_icon_theme_append_search_path: assertion 'GTK_IS_ICON_THEME (icon_theme)' failed

No snapshots on this device
First snapshot requires: 14.3 GB

No snapshots found

On my work laptop that has Ubuntu 18.04, the directory that timeshift chooses for updates, when the docker is running, is actually different: /var/lib/docker/plugins, but still incorrect.

@divanvisagie
Copy link

divanvisagie commented May 10, 2018

That's rather interesting, from poking around in the code it looks like the path is determined from an lsblk:

https://github.com/teejee2008/timeshift/blob/master/src/Utility/Device.vala#L236

Would you be able to run the command with the debug flag on and post the output both with docker running and not running? So thats sudo timeshift --list --debug

That should spit out a lot of detail like this:

D: Main()
D: 
D: Running Timeshift v18.4
D: 
D: Session log file: /var/log/timeshift/2018-05-10_19-25-54_list-snapshots.log
D: Distribution: ManjaroLinux 17.1.10 (Hakoila)
D: DIST_ID: ManjaroLinux
D: Main: check_dependencies()
D: Main: add_default_exclude_entries()
D: Main: add_default_exclude_entries(): exit
D: update_partitions()
D: df -T -B1
D: Device: get_disk_space_using_df(): 4
D: Device: get_mounted_filesystems_using_mtab(): 4
D: Device: get_filesystems(): 11
D: partition list updated
D: detect_system_devices()
D: /boot/efi is mapped to device: /dev/sdb1, UUID=5922-523D
D: / is mapped to device: /dev/sdb2, UUID=9c2b7cc3-cb09-40c6-babb-20ed0ccfda75
D: Searching subvolume for system at path: /
D: Users: root divan
D: Encrypted home users: 
D: Encrypted home dirs:

D: Encrypted private dirs:

D: Main: load_app_config()
App config loaded: /etc/timeshift.json
D: IconManager: init()
D: bin_path: /usr/bin/timeshift
D: found images directory: /usr/share/timeshift/images
D: Main(): ok
D: AppConsole: parse_arguments()
D: Main: initialize_repo()
D: backup_uuid=9c2b7cc3-cb09-40c6-babb-20ed0ccfda75
D: backup_parent_uuid=
D: Setting snapshot device from config file
D: repo: creating from uuid
D: SnapshotRepo: from_uuid(): RSYNC
D: uuid=9c2b7cc3-cb09-40c6-babb-20ed0ccfda75
D: SnapshotRepo: init_from_device()
D: 
D: SnapshotRepo: unlock_and_mount_devices()
D: device=/dev/sdb2
D: SnapshotRepo: unlock_and_mount_device()
D: device=/dev/sdb2
D: Device: get_mounted_filesystems_using_mtab(): 4
D: SnapshotRepo: load_snapshots()
D: loading snapshots from '/timeshift/snapshots': 14 found
D: SnapshotRepo: unlock_and_mount_device(): exit
D: Selected snapshot device: /dev/sdb2
D: Free space: 156.3 GB
D: SnapshotRepo: check_status()
D: SnapshotRepo: available()
D: is_available: ok
D: SnapshotRepo: has_snapshots()
D: SnapshotRepo: has_space()
D: df -T -B1 '/dev/sdb2'
D: Device: get_disk_space_using_df(): 1
D: SnapshotRepo: check_status(): exit
D: SnapshotRepo: init_from_device(): exit
D: SnapshotRepo: from_uuid(): exit
D: Main: initialize_repo(): exit
D: AppConsole: start_application()
D: SnapshotRepo: check_status()
D: SnapshotRepo: available()
D: is_available: ok
D: SnapshotRepo: has_snapshots()
D: SnapshotRepo: has_space()
D: df -T -B1 '/dev/sdb2'
D: Device: get_disk_space_using_df(): 1
D: SnapshotRepo: check_status(): exit
Device : /dev/sdb2
UUID   : 9c2b7cc3-cb09-40c6-babb-20ed0ccfda75
Path   : /
Mode   : RSYNC
Device is OK
14 snapshots, 156.3 GB free

D: SnapshotRepo: has_snapshots()
Num     Name                 Tags  Description                                                      
------------------------------------------------------------------------------
# I deleted this to make it anonymous, you should to  if you have comments                         

D: exit_app()
D: crontab -l
D: Failed to read cron tab
D: crontab -l
D: Failed to read cron tab
D: Cron task exists: /etc/cron.d/timeshift-hourly
D: unmount_target_device()
D: clean_logs()
``

@ilya40umov
Copy link
Author

With docker running:

D: Main()
D: 
D: Running Timeshift v17.11
D: 
D: Session log file: /var/log/timeshift/2018-05-11_17-44-51_list-snapshots.log
D: Distribution: LinuxMint 18.3 (sylvia)
D: DIST_ID: LinuxMint
D: Main: check_dependencies()
D: Main: add_default_exclude_entries()
D: Main: add_default_exclude_entries(): exit
D: update_partitions()
D: 
D: lsblk --bytes --pairs --output NAME,KNAME,LABEL,UUID,TYPE,FSTYPE,SIZE,MOUNTPOINT,MODEL,RO,HOTPLUG,PKNAME,VENDOR,SERIAL,REV
D: found link: /dev/mapper/sda5_crypt -> /dev/dm-0
D: found link: /dev/mapper/mint--vg-root -> /dev/dm-1
D: found link: /dev/mapper/mint--vg-swap_1 -> /dev/dm-2
D: 
D: device       ,pkname ,kname ,uuid                                 ,mapped_name
D: ----------------------------------------------------------------------------------------------------
D: /dev/loop1   ,      ,loop1 ,                                     ,
D: /dev/loop13  ,      ,loop13 ,                                     ,
D: /dev/loop11  ,      ,loop11 ,                                     ,
D: /dev/loop8   ,      ,loop8 ,                                     ,
D: /dev/loop6   ,      ,loop6 ,                                     ,
D: /dev/loop4   ,      ,loop4 ,                                     ,
D: /dev/loop2   ,      ,loop2 ,                                     ,
D: /dev/loop14  ,      ,loop14 ,                                     ,
D: /dev/loop0   ,      ,loop0 ,                                     ,
D: /dev/loop12  ,      ,loop12 ,                                     ,
D: /dev/loop9   ,      ,loop9 ,                                     ,
D: /dev/loop10  ,      ,loop10 ,                                     ,
D: /dev/sda     ,      ,sda   ,                                     ,
D: /dev/sda2    ,sda   ,sda2  ,                                     ,
D: /dev/sda5    ,sda   ,sda5  ,c05577a6-ed2c-4f60-8fc1-d1a3b11831d5 ,
D: /dev/dm-0    ,sda5  ,dm-0  ,QCnqNT-jLk1-wYxG-DcAY-79aQ-NGaK-NOIwBC ,sda5_crypt
D: /dev/dm-1    ,dm-0  ,dm-1  ,ac093bd8-0b0d-441a-960d-561ffb0c660a ,mint--vg-root
D: /dev/dm-2    ,dm-0  ,dm-2  ,608bb0ca-544e-43d7-8add-0170f6d19283 ,mint--vg-swap_1
D: /dev/sda1    ,sda   ,sda1  ,7ad7a02c-0763-46a2-b7f8-9d0129724027 ,
D: /dev/loop7   ,      ,loop7 ,                                     ,
D: /dev/loop5   ,      ,loop5 ,                                     ,
D: /dev/loop3   ,      ,loop3 ,                                     ,
D: 
D: Device: get_block_devices_using_lsblk(): 22
D: df -T -B1
D: Device: get_disk_space_using_df(): 2
D: Device: get_mounted_filesystems_using_mtab(): 2
D: Device: get_filesystems(): 22
D: partition list updated
D: detect_system_devices()
D: / is mapped to device: /dev/dm-1, UUID=ac093bd8-0b0d-441a-960d-561ffb0c660a
D: /boot is mapped to device: /dev/sda1, UUID=7ad7a02c-0763-46a2-b7f8-9d0129724027
D: Searching subvolume for system at path: /
D: Users: root isorokoumov arronax
D: Encrypted home users: 
D: Encrypted home dirs:

D: Encrypted private dirs:

D: Main: load_app_config()
App config loaded: /etc/timeshift.json
D: IconManager: init()
D: bin_path: /usr/bin/timeshift
D: found images directory: /usr/share/timeshift/images
D: Main(): ok
D: AppConsole: parse_arguments()
D: Main: initialize_repo()
D: backup_uuid=ac093bd8-0b0d-441a-960d-561ffb0c660a
D: backup_parent_uuid=QCnqNT-jLk1-wYxG-DcAY-79aQ-NGaK-NOIwBC
D: Setting snapshot device from config file
D: repo: creating from uuid
D: SnapshotRepo: from_uuid(): RSYNC
D: uuid=ac093bd8-0b0d-441a-960d-561ffb0c660a
D: SnapshotRepo: init_from_device()
D: 
D: SnapshotRepo: unlock_and_mount_devices()
D: device=/dev/dm-1
D: SnapshotRepo: unlock_and_mount_device()
D: device=/dev/dm-1
D: Device: get_mounted_filesystems_using_mtab(): 2
D: SnapshotRepo: load_snapshots()
D: loading snapshots from '/var/lib/docker/aufs/timeshift/snapshots': 6 found
D: SnapshotRepo: unlock_and_mount_device(): exit
D: Selected snapshot device: /dev/dm-1
D: Free space: 378.9 GB
D: SnapshotRepo: check_status()
D: SnapshotRepo: available()
D: is_available: ok
D: SnapshotRepo: has_snapshots()
D: SnapshotRepo: has_space()
D: df -T -B1 '/dev/dm-1'
D: Device: get_disk_space_using_df(): 1
D: SnapshotRepo: check_status(): exit
D: SnapshotRepo: init_from_device(): exit
D: SnapshotRepo: from_uuid(): exit
D: Main: initialize_repo(): exit
D: AppConsole: start_application()
D: SnapshotRepo: check_status()
D: SnapshotRepo: available()
D: is_available: ok
D: SnapshotRepo: has_snapshots()
D: SnapshotRepo: has_space()
D: df -T -B1 '/dev/dm-1'
D: Device: get_disk_space_using_df(): 1
D: SnapshotRepo: check_status(): exit
Device : /dev/dm-1
UUID   : ac093bd8-0b0d-441a-960d-561ffb0c660a
Path   : /var/lib/docker/aufs
Mode   : RSYNC
Device is OK
6 snapshots, 378.9 GB free

D: SnapshotRepo: has_snapshots()
Num     Name                 Tags  Description  
------------------------------------------------------------------------------
0    >  2018-04-02_14-53-08  O                  
1    >  2018-04-28_20-00-02  M                  
2    >  2018-05-02_11-00-01  W                  
3    >  2018-05-09_21-00-01  W                  
4    >  2018-05-09_22-00-01  D                  
5    >  2018-05-10_22-00-01  D                  

D: exit_app()
D: crontab -l
D: Failed to read cron tab
D: crontab -l
D: Failed to read cron tab
D: Cron task exists: /etc/cron.d/timeshift-hourly
D: unmount_target_device()
D: clean_logs()

After having stopped docker, it looks like this:

D: Main()
D: 
D: Running Timeshift v17.11
D: 
D: Session log file: /var/log/timeshift/2018-05-11_17-47-26_list-snapshots.log
D: Distribution: LinuxMint 18.3 (sylvia)
D: DIST_ID: LinuxMint
D: Main: check_dependencies()
D: Main: add_default_exclude_entries()
D: Main: add_default_exclude_entries(): exit
D: update_partitions()
D: 
D: lsblk --bytes --pairs --output NAME,KNAME,LABEL,UUID,TYPE,FSTYPE,SIZE,MOUNTPOINT,MODEL,RO,HOTPLUG,PKNAME,VENDOR,SERIAL,REV
D: found link: /dev/mapper/sda5_crypt -> /dev/dm-0
D: found link: /dev/mapper/mint--vg-root -> /dev/dm-1
D: found link: /dev/mapper/mint--vg-swap_1 -> /dev/dm-2
D: 
D: device       ,pkname ,kname ,uuid                                 ,mapped_name
D: ----------------------------------------------------------------------------------------------------
D: /dev/loop1   ,      ,loop1 ,                                     ,
D: /dev/loop13  ,      ,loop13 ,                                     ,
D: /dev/loop11  ,      ,loop11 ,                                     ,
D: /dev/loop8   ,      ,loop8 ,                                     ,
D: /dev/loop6   ,      ,loop6 ,                                     ,
D: /dev/loop4   ,      ,loop4 ,                                     ,
D: /dev/loop2   ,      ,loop2 ,                                     ,
D: /dev/loop14  ,      ,loop14 ,                                     ,
D: /dev/loop0   ,      ,loop0 ,                                     ,
D: /dev/loop12  ,      ,loop12 ,                                     ,
D: /dev/loop9   ,      ,loop9 ,                                     ,
D: /dev/loop10  ,      ,loop10 ,                                     ,
D: /dev/sda     ,      ,sda   ,                                     ,
D: /dev/sda2    ,sda   ,sda2  ,                                     ,
D: /dev/sda5    ,sda   ,sda5  ,c05577a6-ed2c-4f60-8fc1-d1a3b11831d5 ,
D: /dev/dm-0    ,sda5  ,dm-0  ,QCnqNT-jLk1-wYxG-DcAY-79aQ-NGaK-NOIwBC ,sda5_crypt
D: /dev/dm-1    ,dm-0  ,dm-1  ,ac093bd8-0b0d-441a-960d-561ffb0c660a ,mint--vg-root
D: /dev/dm-2    ,dm-0  ,dm-2  ,608bb0ca-544e-43d7-8add-0170f6d19283 ,mint--vg-swap_1
D: /dev/sda1    ,sda   ,sda1  ,7ad7a02c-0763-46a2-b7f8-9d0129724027 ,
D: /dev/loop7   ,      ,loop7 ,                                     ,
D: /dev/loop5   ,      ,loop5 ,                                     ,
D: /dev/loop3   ,      ,loop3 ,                                     ,
D: 
D: Device: get_block_devices_using_lsblk(): 22
D: df -T -B1
D: Device: get_disk_space_using_df(): 2
D: Device: get_mounted_filesystems_using_mtab(): 2
D: Device: get_filesystems(): 22
D: partition list updated
D: detect_system_devices()
D: / is mapped to device: /dev/dm-1, UUID=ac093bd8-0b0d-441a-960d-561ffb0c660a
D: /boot is mapped to device: /dev/sda1, UUID=7ad7a02c-0763-46a2-b7f8-9d0129724027
D: Searching subvolume for system at path: /
D: Users: root isorokoumov arronax
D: Encrypted home users: 
D: Encrypted home dirs:

D: Encrypted private dirs:

D: Main: load_app_config()
App config loaded: /etc/timeshift.json
D: IconManager: init()
D: bin_path: /usr/bin/timeshift
D: found images directory: /usr/share/timeshift/images
D: Main(): ok
D: AppConsole: parse_arguments()
D: Main: initialize_repo()
D: backup_uuid=ac093bd8-0b0d-441a-960d-561ffb0c660a
D: backup_parent_uuid=QCnqNT-jLk1-wYxG-DcAY-79aQ-NGaK-NOIwBC
D: Setting snapshot device from config file
D: repo: creating from uuid
D: SnapshotRepo: from_uuid(): RSYNC
D: uuid=ac093bd8-0b0d-441a-960d-561ffb0c660a
D: SnapshotRepo: init_from_device()
D: 
D: SnapshotRepo: unlock_and_mount_devices()
D: device=/dev/dm-1
D: SnapshotRepo: unlock_and_mount_device()
D: device=/dev/dm-1
D: Device: get_mounted_filesystems_using_mtab(): 2
D: SnapshotRepo: load_snapshots()
D: SnapshotRepo: unlock_and_mount_device(): exit
D: Selected snapshot device: /dev/dm-1
D: Free space: 378.9 GB
D: SnapshotRepo: check_status()
D: SnapshotRepo: available()
D: is_available: ok
D: SnapshotRepo: has_snapshots()
D: SnapshotRepo: has_space()
D: df -T -B1 '/dev/dm-1'
D: Device: get_disk_space_using_df(): 1
D: no snapshots
D: SnapshotRepo: check_status(): exit
D: SnapshotRepo: init_from_device(): exit
D: SnapshotRepo: from_uuid(): exit
D: Main: initialize_repo(): exit
D: AppConsole: start_application()
D: SnapshotRepo: check_status()
D: SnapshotRepo: available()
D: is_available: ok
D: SnapshotRepo: has_snapshots()
D: SnapshotRepo: has_space()
D: df -T -B1 '/dev/dm-1'
D: Device: get_disk_space_using_df(): 1
D: no snapshots
D: SnapshotRepo: check_status(): exit
Device : /dev/dm-1
UUID   : ac093bd8-0b0d-441a-960d-561ffb0c660a
Path   : /
Mode   : RSYNC
No snapshots on this device
First snapshot requires: 14.3 GB

D: SnapshotRepo: has_snapshots()
No snapshots found
D: exit_app()
D: crontab -l
D: Failed to read cron tab
D: crontab -l
D: Failed to read cron tab
D: Cron task exists: /etc/cron.d/timeshift-hourly
D: unmount_target_device()
D: clean_logs()

@ilya40umov
Copy link
Author

Also, here is a bit more information about my system.
While docker daemon is running findmnt | grep root, returns the following:

/                                     /dev/mapper/mint--vg-root                       ext4            rw,relatime,errors=remount-ro,data=ordered
└─/var/lib/docker/aufs                /dev/mapper/mint--vg-root[/var/lib/docker/aufs] ext4            rw,relatime,errors=remount-ro,data=ordered

If I stop the docker service, the second mount point is gone.
And when daemon is running, docker info outputs the following:

Containers: 20
 Running: 0
 Paused: 0
 Stopped: 20
Images: 933
Server Version: 17.05.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 638
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-41-generic
Operating System: Linux Mint 18.3
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.09GiB
Name: illia-thinkpad
ID: DSQP:S3JO:3HWT:NFG2:IWMX:AMSN:SRLA:GKA7:DFPQ:VMG5:JDXZ:MI6Z
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

@rafaelsoaresbr
Copy link

rafaelsoaresbr commented May 26, 2018

There are two situations when running docker daemon:

1 - Docker using AUFS storage driver

From Docker's documentation: "...AUFS cannot use the following backing filesystems: aufs, btrfs, or ecryptfs. This means that the filesystem which contains /var/lib/docker/aufs cannot be one of these filesystem types..."

2 - Docker using Btrfs storage driver

From Docker's documentation: "...btrfs requires a dedicated block storage device such as a physical disk. This block device must be formatted for Btrfs and mounted into /var/lib/docker/..."

It should explain the different behaviors on Ubuntu X Linux Mint. When doing backups, TimeShift should recursively snapshot the subvolumes in /var/lib/docker, (if Docker is using Btrfs).

@ilya40umov
Q1 - Can you confirm what storage's driver that docker is using?

Q2 - Can you confirm if there are Btrfs subvolumes in /var/lib/docker with sudo btrfs subvolume list /var/lib/docker (need btrfs-tools for that)?

Edit: Similar issues: #72 #133 #47 and related to #116

@ilya40umov
Copy link
Author

@rafaelsoaresbr
On both machines I have full disk encryption, but I'm not sure if it somehow hiddenly implies that ecryptfs is being used.

On LM machine that I have with me right now:

  • If I look at results of df -Th or findmnt, both are showing my root device as being of type ext4.
  • Running sudo btrfs subvolume list /var/lib/docker gives me: ERROR: not a btrfs filesystem: /var/lib/docker and ERROR: can't access '/var/lib/docker'
  • Also running docker system info tells me that the backing system is extfs
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 636
 Dirperm1 Supported: true

P.S. I'll try comparing these results with the Ubuntu installation later this week.

@ilya40umov
Copy link
Author

ilya40umov commented Jul 1, 2018

BTW I've installed Linux Mint 19 on btrfs partition (instead of ext4 that I would normally use) and can confirm that this issue can't be reproduced there. (i.e. I installed docker and timeshift is still working correctly)

@rafaelsoaresbr
Copy link

@ilya40umov
Can you post the output sudo btrfs subvolume list / and compare the contents of /timeshift-btrfs/snapshots/{snapshot-date}/@/var/lib/docker and /var/lib/docker?

@Redsandro
Copy link

As a workaround right now I manually stop docker service before taking a snapshot / doing restore, but as a result I can't do scheduled backups.

Wish I knew that before I started upgrading Mint 18 to Mint 19. :)

But is it a problem? I don't mind timeshift using my docker directory.

@Redsandro
Copy link

But is it a problem? I don't mind timeshift using my docker directory.

I retract my previous opinion. The snapshots are not available when using the live USB installer to run TimeShift.

Since this is a part of Linux Mint now, and docker is indispensible for webdevelopers, perhaps @clefebvre can take a look at this.

@jzombie
Copy link

jzombie commented Aug 1, 2018

Used to have this problem as well w/ Docker & Timeshift, where snapshots were not available.

I am now able to run Docker, Timeshift, and Ubuntu together, cohesively, and successfully restored multiple snapshots, using LVM (can check LVM option during OS install).

Note, without LVM option checked, the snapshots are not available. (haven't installed btrfs)

Snapshots are available directly in /timeshift/snapshots directory, and no need to run a live USB installer.

Works normal, and have reproduced this multiple times now on various installs.

This has been confirmed to work on Ubuntu / Xubuntu 16.04, and I would imagine other versions should work as well.

@jakewarren
Copy link

I posted a bounty for this issue if anyone wants to take it on.

Bounty

@jzombie
Copy link

jzombie commented Aug 17, 2018

Just use LVM option when you install.

@jakewarren
Copy link

jakewarren commented Aug 17, 2018

@Darkladder That's a handy workaround to know, but it would not help the users who already have installations in place.

There's also #227 which seems related.

@bazoocaze
Copy link
Contributor

Hi, folks

I submitted the pull request #289 . It solved the issue with Timeshift+Docker on my station (Linux Mint 19 + Docker + Timeshift). Timeshift was putting snapshots on the /var/lib/docker/plugins.

If this does not work for you, I think I can help you narrow down the Timeshift issue. Fell free to fork my changes in https://github.com/bazoocaze/timeshift, compile, test, and then submit the output of the timeshift command (using the new built version):

./timeshift --debug --list

@DariusQuintus
Copy link

Is it possible to let the user select the backup-folder in "Settings"?

@Redsandro
Copy link

@DariusQuintus that's not really optimal, as the static location makes restoring a snapshot from the Live USB installation media a breeze.

@DariusQuintus
Copy link

@Redsandro Hm. Okay. I don't know about the underlying concept of timeshift. But regarding usability it would be nice to specify a destination folder during backups and a source folder during recovery. That could possibly prevent further mtab-related issues.

@Redsandro
Copy link

@DariusQuintus I disagree, it is actually nice that it just works. During early stages of Linux Mint 19 I had to recover an image from the Live USB dozens of times. I'm very glad I didn't have to 'pick' the snapshot folder every time, find out I changed the snapshot folder half way through making snapshots, etc.

We don't write issue reports to Debian to ask if we can customize the location of /media during installation so we can choose to set it to /mnt/media either. Different locations on different machines for system utilities is just not practical.

That said, I do think that the snapshot directory should have been FSH compliant by using /var/timeshift or /opt/timeshift.

However, this kind of changes should not be done during a release cycle. Linux Mint is LTS.

@bazoocaze
Copy link
Contributor

@Redsandro Unfortunately, because of the timeshift bug on binding mounts #227, the snapshot folder is dangling between folders, so it's not static nor fixed for the affected users. On my station, the snapshot folder is dangling between /timeshift and /var/lib/docker/plugins/timeshift, so it's not "just works".

In fact, the users asking for "a way to select the backup-folder" are searching for a solution for this bug, that is, the snapshot folder is not static/fixed in the correct location on systems using bind mount for some use case.

I submitted #289 for a workaround for timeshift incorrectly selecting the Docker folder for snapshots.

@Redsandro
Copy link

Redsandro commented Aug 24, 2018

@bazoocaze I detect some passive aggression in your response. There is no need for that.

Because the above was a response and not just a statement, there is some implicit context:

"I disagree (that it's nice for UX to choose snapshot location.) It's is actually nice (for UX to have zero configuration so) that it just works (without having to search for the snapshots)."

So far my response to UX. I also outlined two further important rules concerning directories and bugfixes.

If you're just looking for a solution and are not interested in a discussion about UX, FHS or LTS, then here's the workaround I'm using:

sudo service docker stop && sudo timeshift && sudo docker start

@DariusQuintus
Copy link

@Redsandro Sadly, stopping the docker deamon does not work. Because docker already altered mtab, at least on my machine:
/dev/sdb2 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
/dev/sdb2 /var/lib/docker ext4 rw,relatime,errors=remount-ro,data=ordered 0 0

The problem seems to be that timeshift reads mtab, finds the device (in my case "sdb2"), uses "/", finds another entry and finally uses "/var/lib/docker".

The only temporary solution I came around is, to install docker on a separate filesystem (which could be wise anyway).

Considering your anwser, I would suggest integrating an option into the UI of timeshift (and of course a corresponding command for CLI) where the user can use the "standard location" or a "custom location".
I am very confident that this is the only way to handle future problems with virtualization- and other filesystem-interrogating software.

@Redsandro
Copy link

Redsandro commented Aug 24, 2018

@DariusQuintus this is interesting. The docker stop method works for me, even when docker is installed to the default location. It changes the mtab back to normal. Actually I don't know that, but I am observing that it works. I'm making and restoring snapshots this way. When I don't stop docker, the snapshot directory changes and I have no snapshots there.

@jakewarren
Copy link

I get the same result as @DariusQuintus, stopping docker doesn't work for me. Although stopping docker does remove some mtab entries, /var/lib/docker/aufs remains and gets selected by Timeshift.

@bazoocaze
Copy link
Contributor

@Redsandro

I detect some passive aggression in your response. There is no need for that.

I'm sorry for that. It was not my intention to sound aggressive and mean. Sorry!

@bazoocaze
Copy link
Contributor

#289 merged

@bazoocaze
Copy link
Contributor

@jakewarren how's about the bounty?

@jakewarren
Copy link

@bazoocaze I'll be honest with you, I haven't been through the entire process on BountySource so I am not entirely sure how it works.. I believe this issue will have to be closed and then you can submit a claim.

I tested v18.8 and the fix seems to be working for me. 👍 Thank you!

@ilya40umov
Copy link
Author

BTW I can confirm that the latest Timeshift is behaving correctly on my Ubuntu laptop and I no longer need to stop docker daemon as a workaround.
Thanks a lot for the fix!

@rafaelsoaresbr
Copy link

rafaelsoaresbr commented Sep 6, 2018

I'm running Timeshift 18.4 on Linux Mint 19 and is working as expected on a btrfs volume.
I'm able to create/restore without stopping docker's service, all pulled docker images are restored back and forth. What is this fix going to fix exactly? Will Timeshift ignore /var/lib/docker ?
Edit: I think this fix is only necessary when using ext4 fs

@bazoocaze
Copy link
Contributor

Hi, @rafaelsoaresbr

There is a bug in timeshift (#227) that makes timeshift selects (and prioritize) bind mount points to determine the snapshots directory. So if you select a file system as the destination snapshot device, and if you have a bind mount point on that file system, then timeshift will incorrectly select the bind mount point as the path for the snapshots directory.

Docker create such bind mounts in /var/lib/docker, so if this path resides on the root filesystem and one selectes the root filesystem for snapshot device then it will trigger the #227 bug.

There is a workaround for Docker since #289 .

@bazoocaze
Copy link
Contributor

bazoocaze commented Sep 6, 2018

What is this fix going to fix exactly? Will Timeshift ignore /var/lib/docker ?

The #289 workaround makes timeshift ignores mount points containing '/docker' substring when determining the path for the snapshots directory.

@rafaelsoaresbr
Copy link

rafaelsoaresbr commented Sep 6, 2018

Gotcha, thank you.
I'm testing it now, if I run sudo docker run hello-world (after restoring from backup) it will show an error:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/hello\": stat /hello: no such file or directory": unknown.

sudo docker images still shows:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              2cb0d9787c4d        8 weeks ago         1.85kB
alpine              latest              11cd0b38bc3c        2 months ago        4.41MB

Edit: alpine image works, hello-world don't.

@bazoocaze
Copy link
Contributor

@rafaelsoaresbr Docker images/overlays are not supported by the Timeshift snapshot engine as per the readme. I guess you must rebuild hello-world container.

@jzombie
Copy link

jzombie commented Sep 21, 2018

Works as expected on EXT4 w/ LVM. LVM or BTRFS should work as intended with Docker installed. If you're not using LVM or BTRFS, you should expect issues.

The reason why it works with these two format types, apparently, is due to abstracted volume handling provided via LVM or BTRFS. It's a wild guess, but it works.

@rafaelsoaresbr
Copy link

@Darkladder As I said in my previous comment, Btrfs isn't working as expected, but it's ok, you just need to pull and/or rebuild your docker images.

@gavr123456789
Copy link

There are docker image now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants