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

Snapper does not find config file after a lot of modifications #879

Closed
kryzar opened this issue Mar 4, 2024 · 13 comments
Closed

Snapper does not find config file after a lot of modifications #879

kryzar opened this issue Mar 4, 2024 · 13 comments

Comments

@kryzar
Copy link

kryzar commented Mar 4, 2024

Hi. I am using snapper 0.10.7 on Arch Linux:

/etc/snapper/configs🔒 ❯ snapper --version
snapper 0.10.7
libsnapper 7.4.0
flags btrfs,lvm,ext4,xattrs,rollback,btrfs-quota,no-selinux

I have an entry root in /etc/snapper/configs, but Snapper does not find it:

/etc/snapper/configs🔒 ❯ ls
 root
/etc/snapper/configs🔒 ❯ sudo snapper list-configs
Configuration | Sous-volume
--------------+------------
/etc/snapper/configs🔒 ❯ 

I believe the entry is correct, it was generated in the past by running sudo snapper -c root create-config /. Snapper used to work on my machine, until I began to edit this file a lot to suit my needs (now I am just trying to make the default config work, though). Then, Snapper failed to find the file. I reinstalled Snapper, rebooted my machine, but it is still broken.

(This may have something to do with DBus: I realized yesterday there was some kind of conflict (I did not take notes at the time so I cannot be more precise) with it. After a sudo systemctl restart dbus-broker.service, I could not re-start my session properly. I had to remove Snapper and the file /usr/share/dbus-1/system.d/org.opensuse.Snapper.conf to fix my issue.)

Please let me know if I can provide more information. Many thanks.

@aschnell
Copy link
Member

aschnell commented Mar 5, 2024

You can try without DBus by using snapper --no-dbus list-configs. Otherwise provide the content of /var/log/snapper and of the root config file.

@kryzar
Copy link
Author

kryzar commented Mar 5, 2024

Thanks; sudo snapper --no-dbus list-configs not showing configs. Here is the log (from /var/log/snapper.log, not /var/log/snapper) from when I try to list configs with DBus:

2024-03-05 09:35:29 MIL libsnapper(18943) snapperd.cc(main):283 - Requesting DBus name
2024-03-05 09:35:29 MIL libsnapper(18943) snapperd.cc(main):298 - Loading snapper configs
2024-03-05 09:35:29 MIL libsnapper(18943) Snapper.cc(getConfigs):355 - Snapper get-configs
2024-03-05 09:35:29 MIL libsnapper(18943) Snapper.cc(getConfigs):356 - libsnapper version 0.10.7
2024-03-05 09:35:29 MIL libsnapper(18943) AsciiFile.cc(reload):922 - loading file /etc/conf.d/snapper
2024-03-05 09:35:29 MIL libsnapper(18943) AsciiFile.cc(get_value):1078 - key:SNAPPER_CONFIGS value:
2024-03-05 09:35:29 MIL libsnapper(18943) snapperd.cc(main):311 - Listening for method calls and signals
2024-03-05 09:36:29 MIL libsnapper(18943) snapperd.cc(main):315 - Exiting

Here is the whole log file attached from when I started to change the config. And here is the config /etc/snapper/configs/root:


# subvolume to snapshot
SUBVOLUME="/"

# filesystem type
FSTYPE="btrfs"


# btrfs qgroup for space aware cleanup algorithms
QGROUP=""


# fraction or absolute size of the filesystems space the snapshots may use
SPACE_LIMIT="0.5"

# fraction or absolute size of the filesystems space that should be free
FREE_LIMIT="0.2"


# users and groups allowed to work with config
ALLOW_USERS=""
ALLOW_GROUPS=""

# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots
# directory
SYNC_ACL="no"


# start comparing pre- and post-snapshot in background after creating
# post-snapshot
BACKGROUND_COMPARISON="yes"


# run daily number cleanup
NUMBER_CLEANUP="yes"

# limit for number cleanup
NUMBER_MIN_AGE="1800"
NUMBER_LIMIT="50"
NUMBER_LIMIT_IMPORTANT="10"


# create hourly snapshots
TIMELINE_CREATE="yes"

# cleanup hourly snapshots after some time
TIMELINE_CLEANUP="yes"

# limits for timeline cleanup
TIMELINE_MIN_AGE="1800"
TIMELINE_LIMIT_HOURLY="10"
TIMELINE_LIMIT_DAILY="10"
TIMELINE_LIMIT_WEEKLY="0"
TIMELINE_LIMIT_MONTHLY="10"
TIMELINE_LIMIT_YEARLY="10"


# cleanup empty pre-post-pairs
EMPTY_PRE_POST_CLEANUP="yes"

# limits for empty pre-post-pair cleanup
EMPTY_PRE_POST_MIN_AGE="1800"

@aschnell
Copy link
Member

aschnell commented Mar 5, 2024

Does cat /etc/sysconfig/snapper include root? The file could maybe be at another location on Arch Linux.

Try strace -e trace=openat snapper --no-dbus list-configs.

@kryzar
Copy link
Author

kryzar commented Mar 5, 2024

Does cat /etc/sysconfig/snapper include root? The file could maybe be at another location on Arch Linux.

I don't actually have a file /etc/sysconfig/snapper. I looked for other files with sudo find / -name '*snapper*' (or the same with sysconfig) and nothing seems to be what we want.

I also looked for this file in a root snapshot, to see if I had removed it by mistake, but I don't find it there either!

Try strace -e trace=openat snapper --no-dbus list-configs.

There you go:

~ ❯ sudo strace -e trace=openat snapper --no-dbus list-configs
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libsnapper.so.7", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libdbus-1.so.3", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libjson-c.so.5", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libboost_thread.so.1.83.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libboost_system.so.1.83.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libxml2.so.2", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libmount.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libbtrfsutil.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libbtrfs.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libsystemd.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libicuuc.so.74", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libgcrypt.so.20", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/liblz4.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libzstd.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libicudata.so.74", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libgpg-error.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Aucun fichier ou dossier de ce nom)
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules.d", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules.d/gconv-modules-extra.conf", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/locale/fr_FR.UTF-8/LC_MESSAGES/snapper.mo", O_RDONLY) = -1 ENOENT (Aucun fichier ou dossier de ce nom)
openat(AT_FDCWD, "/usr/share/locale/fr_FR.utf8/LC_MESSAGES/snapper.mo", O_RDONLY) = -1 ENOENT (Aucun fichier ou dossier de ce nom)
openat(AT_FDCWD, "/usr/share/locale/fr_FR/LC_MESSAGES/snapper.mo", O_RDONLY) = -1 ENOENT (Aucun fichier ou dossier de ce nom)
openat(AT_FDCWD, "/usr/share/locale/fr.UTF-8/LC_MESSAGES/snapper.mo", O_RDONLY) = -1 ENOENT (Aucun fichier ou dossier de ce nom)
openat(AT_FDCWD, "/usr/share/locale/fr.utf8/LC_MESSAGES/snapper.mo", O_RDONLY) = -1 ENOENT (Aucun fichier ou dossier de ce nom)
openat(AT_FDCWD, "/usr/share/locale/fr/LC_MESSAGES/snapper.mo", O_RDONLY) = 3
openat(AT_FDCWD, "/etc/conf.d/snapper", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/terminfo/x/xterm-kitty", O_RDONLY) = 3
Configuration | Sous-volume
--------------+------------
+++ exited with 0 +++
~

@aschnell
Copy link
Member

aschnell commented Mar 5, 2024

The strace shows that /etc/conf.d/snapper is opened successfully. Make sure root is included there.

@kryzar kryzar closed this as completed Mar 5, 2024
@kryzar
Copy link
Author

kryzar commented Mar 5, 2024

Thank you. That helps.

I tried to reproduce the initial bug, but failed to do so multiple times: Snapper's behavior looks very erratic here. The rough process is that starting from the default config and incrementally modifying it, I ended up introducing a mistake. Reverting to the last correct config (or even the default config), Snapper may (but not always!) fail to recognize it again.

Generally though, this config seems problematic (more specifically with the permissions or QGROUP), even though it is sometimes accepted and sometimes rejected:

###########
# GENERAL #
###########

SUBVOLUME = "/"
FSTYPE    = "btrfs"

# Create hourly snapshots
TIMELINE_CREATE = "yes"

### # Permissions
### QGROUP = ""

# Size limites
SPACE_LIMIT = "0.2"  # Take at most
FREE_LIMIT  = "0.2"  # Leave free

# Permissions
ALLOW_USERS  = "MYUSERNAME"
ALLOW_GROUPS = ""
SYNC_ACL     = "yes"

# start comparing pre- and post-snapshot in background after creating
# post-snapshot
# BACKGROUND_COMPARISON="yes"


###########
# CLEANUP #
###########

# Timeline
TIMELINE_CLEANUP       = "yes"  # Cleanup hourly snapshots
TIMELINE_MIN_AGE       = "168"  # Keep all snapshots of last week (younger than 168 hours)
TIMELINE_LIMIT_HOURLY  = "168"
TIMELINE_LIMIT_DAILY   = "15"
TIMELINE_LIMIT_WEEKLY  = "4"
TIMELINE_LIMIT_MONTHLY = "1"
TIMELINE_LIMIT_YEARLY  = "0"

# Pre-post pairs
EMPTY_PRE_POST_CLEANUP = "no"    # Do not delete pre-post pairs that have empty diff
### EMPTY_PRE_POST_MIN_AGE = "2880"  # Keep all pre-post pairs of last month (that have empty diff)

# Number
NUMBER_CLEANUP="no"
### NUMBER_MIN_AGE="1800"
### NUMBER_LIMIT="50"
### NUMBER_LIMIT_IMPORTANT="10"

@kryzar kryzar reopened this Mar 5, 2024
@kryzar
Copy link
Author

kryzar commented Mar 5, 2024

(I had closed the issue by mistake, apologies! :))

@aschnell
Copy link
Member

aschnell commented Mar 5, 2024

snapper "failed" to recognize the config since it was not setup correctly. I do not understand what the problem with QGROUP, ALLOW_USERS or ALLOW_GROUPS should benow. Maybe you face problems when those values are incorrect but that seems obviously.

BTW QGROUP has nothing todo with permissions.

@kryzar
Copy link
Author

kryzar commented Mar 5, 2024

snapper "failed" to recognize the config since it was not setup correctly. I do not understand what the problem with QGROUP, ALLOW_USERS or ALLOW_GROUPS should benow. Maybe you face problems when those values are incorrect but that seems obviously.

As of now, the following config fails. Is there a mistake in it?

~ ❯ cat /etc/snapper/configs/root
###########
# GENERAL #
###########

SUBVOLUME = "/"
FSTYPE    = "btrfs"

# Create hourly snapshots
TIMELINE_CREATE = "yes"

QGROUP = ""

# Size limites
SPACE_LIMIT = "0.2"  # Take at most
FREE_LIMIT  = "0.2"  # Leave free

# Permissions
ALLOW_USERS  = ""
ALLOW_GROUPS = ""
SYNC_ACL     = "no"

# start comparing pre- and post-snapshot in background after creating
# post-snapshot
# BACKGROUND_COMPARISON="yes"


###########
# CLEANUP #
###########

# Timeline
TIMELINE_CLEANUP       = "yes"  # Cleanup hourly snapshots
TIMELINE_MIN_AGE       = "168"  # Keep all snapshots of last week (younger than 168 hours)
TIMELINE_LIMIT_HOURLY  = "168"
TIMELINE_LIMIT_DAILY   = "15"
TIMELINE_LIMIT_WEEKLY  = "4"
TIMELINE_LIMIT_MONTHLY = "1"
TIMELINE_LIMIT_YEARLY  = "0"

# Pre-post pairs
EMPTY_PRE_POST_CLEANUP = "no"    # Do not delete pre-post pairs that have empty diff
### EMPTY_PRE_POST_MIN_AGE = "2880"  # Keep all pre-post pairs of last month (that have empty diff)

# Number
NUMBER_CLEANUP="no"
### NUMBER_MIN_AGE="1800"
### NUMBER_LIMIT="50"
### NUMBER_LIMIT_IMPORTANT="10"
~ ❯ cat /etc/conf.d/snapper
## Path: System/Snapper

## Type:        string
## Default:     ""
# List of snapper configurations.
SNAPPER_CONFIGS="root"

~ ❯ sudo snapper list-configs
Configuration | Sous-volume
--------------+------------
~

BTW QGROUP has nothing todo with permissions.

Thanks.

@kryzar
Copy link
Author

kryzar commented Mar 5, 2024

snapper "failed" to recognize the config since it was not setup correctly. I do not understand what the problem with QGROUP, ALLOW_USERS or ALLOW_GROUPS should benow. Maybe you face problems when those values are incorrect but that seems obviously.

As of now, the following config fails. Is there a mistake in it?

The same happens with the default config, despite /etc/conf.d/snapper containing root:

~ ❯ cat /etc/snapper/configs/root

# subvolume to snapshot
SUBVOLUME="/"

# filesystem type
FSTYPE="btrfs"


# btrfs qgroup for space aware cleanup algorithms
QGROUP=""


# fraction or absolute size of the filesystems space the snapshots may use
SPACE_LIMIT="0.5"

# fraction or absolute size of the filesystems space that should be free
FREE_LIMIT="0.2"


# users and groups allowed to work with config
ALLOW_USERS=""
ALLOW_GROUPS=""

# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots
# directory
SYNC_ACL="no"


# start comparing pre- and post-snapshot in background after creating
# post-snapshot
BACKGROUND_COMPARISON="yes"


# run daily number cleanup
NUMBER_CLEANUP="yes"

# limit for number cleanup
NUMBER_MIN_AGE="1800"
NUMBER_LIMIT="50"
NUMBER_LIMIT_IMPORTANT="10"


# create hourly snapshots
TIMELINE_CREATE="yes"

# cleanup hourly snapshots after some time
TIMELINE_CLEANUP="yes"

# limits for timeline cleanup
TIMELINE_MIN_AGE="1800"
TIMELINE_LIMIT_HOURLY="10"
TIMELINE_LIMIT_DAILY="10"
TIMELINE_LIMIT_WEEKLY="0"
TIMELINE_LIMIT_MONTHLY="10"
TIMELINE_LIMIT_YEARLY="10"


# cleanup empty pre-post-pairs
EMPTY_PRE_POST_CLEANUP="yes"

# limits for empty pre-post-pair cleanup
EMPTY_PRE_POST_MIN_AGE="1800"

~ ❯ cat /etc/conf.d/snapper
## Path: System/Snapper

## Type:        string
## Default:     ""
# List of snapper configurations.
SNAPPER_CONFIGS="root"

~ ❯ sudo snapper list-configs
Configuration | Sous-volume
--------------+------------
~

@aschnell
Copy link
Member

aschnell commented Mar 5, 2024

The first example used spaces around the '=' sign. That is not allowed (the syntax is basically bash where that is also not allowed). In general you should use snapper set-config to avoid such mistakes.

The second one looks fine. But be aware that snapperd reads the file and modifying it with an external program can also cause trouble. Again, use snapper set-config.

@kryzar
Copy link
Author

kryzar commented Mar 5, 2024

Thank you very much for the help. I'd be happy to make a pull request for the manpages to advise the user to set-config.

@aschnell
Copy link
Member

Problem is solved now.

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

No branches or pull requests

2 participants