Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes windows is always empty #31

Closed
aney1 opened this issue Jan 29, 2018 · 11 comments
Closed

changes windows is always empty #31

aney1 opened this issue Jan 29, 2018 · 11 comments

Comments

@aney1
Copy link

aney1 commented Jan 29, 2018

When trying to show the changes between two snapshots the window is empty:
index

Console is showing the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/snappergui/changesWindow.py", line 145, in on_idle_init_paths_tree
    self.add_path_to_tree(str(entry[0]), int(entry[1]), files_tree)
  File "/usr/local/lib/python3.5/dist-packages/snappergui/changesWindow.py", line 70, in add_path_to_tree
    node.children[parts[-1]] = changesWindow.TreeNode(path, None, status, False)
TypeError: 'NoneType' object does not support item assignment

In the Snapper logfile (/var/log/snapper.log), everything looks like its working:

2018-01-29 16:46:14 MIL libsnapper(4138) Comparison.cc(Comparison):56 - num1:8 num2:32
2018-01-29 16:46:14 MIL libsnapper(4138) Comparison.cc(load):167 - num1:8 num2:32
2018-01-29 16:46:14 MIL libsnapper(4138) Comparison.cc(load):216 - read 97075 lines

Ubuntu 16.04.03

@ricardomv
Copy link
Owner

Hi thanks for the report, i think this has something to do with permissions, can you start the application as root?

@rickysarraf
Copy link

I've run into the same problem while packaging it for Debian. It would make more sense to ship a policykit file if you want to run the app as root because on modern systems, which run Wayland, running a GUI application with root privileges is not going to be easy.

rrs@priyasi:/var/tmp/Debian-Build/temp/snapper-gui (master)$ snapper-gui 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/snappergui/changesWindow.py", line 145, in on_idle_init_paths_tree
    self.add_path_to_tree(str(entry[0]), int(entry[1]), files_tree)
  File "/usr/lib/python3/dist-packages/snappergui/changesWindow.py", line 70, in add_path_to_tree
    node.children[parts[-1]] = changesWindow.TreeNode(path, None, status, False)
TypeError: 'NoneType' object does not support item assignment

@rickysarraf
Copy link

So I did some brute force to run it as root and indeed it works then. Part of the reason may be the following:

rrs@priyasi:~$ sudo snapper -c homedir list
Type   | # | Pre # | Date                              | User | Cleanup  | Description | Userdata
-------+---+-------+-----------------------------------+------+----------+-------------+---------
single | 0 |       |                                   | root |          | current     |         
single | 1 |       | Tue 24 Jul 2018 02:58:00 PM +0545 | root |          |             |         
single | 2 |       | Tue 24 Jul 2018 03:00:18 PM +0545 | root | timeline | timeline    |         
single | 3 |       | Tue 24 Jul 2018 03:55:22 PM +0545 | rrs  |          |             |         
single | 4 |       | Tue 24 Jul 2018 04:00:23 PM +0545 | root | timeline | timeline    |         
single | 5 |       | Tue 24 Jul 2018 05:00:23 PM +0545 | root | timeline | timeline    |         
single | 6 |       | Tue 24 Jul 2018 06:00:23 PM +0545 | root | timeline | timeline    |         
single | 7 |       | Tue 24 Jul 2018 07:00:19 PM +0545 | root | timeline | timeline    |         
19:22 ♒♒♒   ☺ 😄   

Since most snapshots are created by user root, accessing them isn't allowed to the normal user.

@rickysarraf
Copy link

Okay. the problem is with snapper rather than with the GUI itself. Since the .snapshots folder is marked root only, it does not allow the user to access the data. It does make me wonder then why is the snapper utility, as a normal user, allowed to create snapshots. Hmmm.

-rw-r--r-- 1 rrs  rrs        97 May 17  2011  .signature
drwxr-x--- 1 root root       16 Jul 24 19:25  .snapshots/
...snipped....
19:26 ♒♒♒   ☺ 😄    
rrs@priyasi:~$ cd .snapshots/
-bash: cd: .snapshots/: Permission denied
19:26 ♒♒♒    ☹ 😟=> 1  
rrs@priyasi

@rickysarraf
Copy link

Okay. So this is the crux of the problem:
https://wiki.archlinux.org/index.php/Snapper#Access_for_non-root_users

This is more a snapper problem that this GUI. And I must also thank you for creating the GUI application. I hadn't thanked you in the beginning of the report. Thank You.

@rickysarraf
Copy link

I filed a bug report here: openSUSE/snapper#416

@rickysarraf
Copy link

It indeed is a permission problem. After the permissions set proper with snapper, I can successfully see the diff for the subvolume.

Citing the manpage

PERMISSIONS
       Non-root users can be allowed to use a configuration by setting ALLOW_USERS
       or ALLOW_GROUPS in the config file. For all operations to work, the user
       must also be able to read and access the .snapshots directory inside the
       subvolume. The .snapshots directory must be owned by root and must not be
       writable by anybody else.

       Here are some methods how to achieve that:

       ·   Make the directory accessible for everyone:

           chmod a+rx .snapshots

       ·   Make the directory accessible for a group the user belongs to, e.g.:

           chown :users .snapshots

       ·   Make the directory accessible for the user using ACLs, e.g.:

           setfacl -m u:tux:rx .snapshots

       The last method can be performed by snapper, see the SYNC_ACL setting in
       snapper-configs(5).

image

@rickysarraf
Copy link

Just one additional glitch. After I exit the application, it throws the following exception:

rrs@priyasi:/var/tmp$ man snapper
10:36 ♒♒♒   ☺ 😄    
rrs@priyasi:/var/tmp$ snapper-gui 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/snappergui/mainWindow.py", line 203, in on_main_destroy
    for snapshot in snapper.ListSnapshots(config[0]):
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: error.no_permissions: org.freedesktop.DBus.Error.Failed
10:39 ♒♒♒   ☺ 😄    
rrs@priyasi:/var/tmp$ 

@rickysarraf
Copy link

Just FYI. I pushed it into Debian and will be your point of contact for the package for Debian and its derivatives. Expect some more traction on this tool now

@developer91234
Copy link

How can this application do anything if pretty much all snapper operations require root access? I just opened it up on arch and naturally it shows nothing because even viewing snapshots requires root, never mind actually doing anything with them. The problem doesn't go away even after making the snapshot directory available to world because apparently snapper just requires root for everything even if it doesn't need it. @ricardomv

@developer91234
Copy link

Ofc running snapper-gui as root everything is fine but guis shouldn't be run as root.

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

No branches or pull requests

4 participants