Config files not updated

None of my snaps ’ s config files are copied with a new refresh: they are all reseted.

lxd,remmina, libreoffice… when snap config files are updated, they are cleaned (reseted) and i loose every configurations. I have to manually copy ~/snap/snapX/oldconf/files to current/** to have my configuration files back.

snap 2.35.5
snapd 2.35.5
series 16
ubuntu 18.04
kernel 4.15.0-38-generic

fs: btrfs
/dev/mapper/vg_os-root on / type btrfs (rw,noatime,compress=zstd,ssd,space_cache,subvolid=579,subvol=/@)
/dev/mapper/vg_os-root on /cache type btrfs (rw,noatime,compress=zstd,ssd,space_cache,subvolid=582,subvol=/@cache)
/dev/mapper/vg_os-root on /mnt/ROOT type btrfs (rw,noatime,compress=zstd,ssd,space_cache,subvolid=5,subvol=/)
/dev/mapper/vg_os-root on /appli type btrfs (rw,noatime,compress=zstd,ssd,space_cache,subvolid=586,subvol=/@appli)
/dev/mapper/vg_os-root on /data type btrfs (rw,noatime,compress=zstd,ssd,space_cache,subvolid=583,subvol=/@data)
/dev/mapper/vg_os-root on /opt type btrfs (rw,noatime,compress=zstd,ssd,space_cache,subvolid=584,subvol=/@opt)
/dev/mapper/vg_os-root on /var type btrfs (rw,noatime,compress=zstd,ssd,space_cache,subvolid=585,subvol=/@var)
/dev/mapper/vg_os-root on /home type btrfs (rw,noatime,compress=zstd,ssd,space_cache,subvolid=581,subvol=/@home2)

I believe that is a packaging bug as snapd does provide an area that doesn’t being replaced during snap refreshing.

1 Like

it would be strange: several snaps have this problem, even lxd.

It it user’s config files, not snap common config files.

what happens to user’s config files if you do not use your snap for a long time, and remove old revisions frequently, to clean space?

Since user’s config files are created when you launch a snap app command the first time (for example, for lxd it is created when i launch a “lxc list” command the first time after refreshed), if several revisions are installed, but not used, there should be a few revisions config files directories? And then, how snap choose config files to copy from?

example with remmina:
ls -la /snap/remmina/
drwxr-xr-x 11 root root 265 févr. 14 10:03 2648
drwxr-xr-x 11 root root 265 févr. 17 21:29 2660
lrwxrwxrwx 1 root root 4 févr. 18 09:00 current -> 2660

-> only 2 versions
-> i have never used 2648 revision, so user’s config files are not created

in ~/snap/remmina: 1782 1833 1893 2055 2066 2070 2660 common current
there is no 2648
The last conf files are in 2070, which are “good config files”, since i have copied them manually from another revision directory, days before (i do that from the beginning …)

But “current” follows 2660, which are fresh reseted config files …
So what config files have been copied?

The copying is done at refresh time; what’s updated when you use the snap is the current symlink.

hum that 's not what i have seen: when it refreshes snaps, symlink current is still on the previous revision config files directory.

only when the snap is called the first time the new config files directory is created and the symlink is updated.

tested with lxd and remmina.

as I said, running the snap updates the current symlink. The copying will have happened before though.

Here’s a worked-out example:

~$ # initially the directory is empty
~$ ls -l ~/snap/http/
ls: cannot access '/home/john/snap/http/': No such file or directory
~$ # we install one revision of the snap
~$ snap install http --revision=22
http 0.9.9-1.1 from John Lenton (chipaca) installed
~$ # installation didn't create the directory
~$ ls -l ~/snap/http/
ls: cannot access '/home/john/snap/http/': No such file or directory
~$ # we run an app from the snap
~$ http
http: error: the following arguments are required: URL
~$ # the directories got created
~$ ls -l ~/snap/http/
total 8
drwxr-xr-x 2 john john 4096 Feb 18 12:06 22
drwxr-xr-x 2 john john 4096 Feb 18 12:06 common
lrwxrwxrwx 1 john john    2 Feb 18 12:06 current -> 22
~$ # we create a canary to test things
~$ echo 22 > ~/snap/http/current/canary
~$ # we refresh the snap to a new revision
~$ snap refresh http
http 1.0.0-1 from John Lenton (chipaca) refreshed
~$ # the user's data directories got created, but not the symlink 
~$ ls -l ~/snap/http/
total 12
drwxr-xr-x 2 john john 4096 Feb 18 12:06 22
drwxr-xr-x 2 john john 4096 Feb 18 12:06 24
drwxr-xr-x 2 john john 4096 Feb 18 12:06 common
lrwxrwxrwx 1 john john    2 Feb 18 12:06 current -> 22
~$ # the new directories got their contents from the old revision
~$ cat ~/snap/http/24/canary 
22
~$ # now we run the snap again
~$ http
http: error: the following arguments are required: URL
~$ # the symlink got updated
~$ ls -l ~/snap/http/
total 12
drwxr-xr-x 2 john john 4096 Feb 18 12:06 22
drwxr-xr-x 2 john john 4096 Feb 18 12:06 24
drwxr-xr-x 2 john john 4096 Feb 18 12:06 common
lrwxrwxrwx 1 john john    2 Feb 18 12:06 current -> 24
~$ 

Just did it with remmina: i just have 2 last versions:

ls -la /snap/remmina/
total 4
drwxr-xr-x 1 root root 30 févr. 18 09:00 .
drwxr-xr-x 1 root root 392 févr. 15 10:34 …
drwxr-xr-x 11 root root 265 févr. 14 10:03 2648
drwxr-xr-x 11 root root 265 févr. 17 21:29 2660
lrwxrwxrwx 1 root root 4 févr. 18 09:00 current -> 2660

~/snap/remmina$ ls -la
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 oct. 17 10:58 1782
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 oct. 30 09:06 1833
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 nov. 16 14:18 1893
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2055
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2066
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2070
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 févr. 18 10:56 2660
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 168 oct. 11 14:20 common
lrwxrwxrwx 1 gaetanquentin-sfr gaetanquentin-sfr 4 févr. 18 10:56 current -> 2660

-> there is no 2648 directory because i never used this remmina version …

  • i do a revert to 2648:
    sudo snap revert --revision 2648 remmina
    [sudo] Mot de passe de gaetanquentin-sfr :
    remmina revenu à 1.3.2

gaetanquentin-sfr@gquentin-ssd-t3:~/snap/remmina$ ls -la
total 0
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 1512 févr. 18 10:56 .
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 2520 déc. 13 10:23 …
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 oct. 17 10:58 1782
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 oct. 30 09:06 1833
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 nov. 16 14:18 1893
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2055
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2066
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2070
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 févr. 18 10:56 2660
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 168 oct. 11 14:20 common
lrwxrwxrwx 1 gaetanquentin-sfr gaetanquentin-sfr 4 févr. 18 10:56 current -> 2660

thereis is still no 2648 directory
current is still on 2660

  • i launch remmina:
    gaetanquentin-sfr@gquentin-ssd-t3:~/snap/remmina$ ls -la
    total 0
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 1680 févr. 18 13:16 .
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 2520 déc. 13 10:23 …
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 oct. 17 10:58 1782
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 oct. 30 09:06 1833
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 nov. 16 14:18 1893
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2055
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2066
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 déc. 19 15:44 2070
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 févr. 18 13:16 2648
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 672 févr. 18 10:56 2660
    drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 168 oct. 11 14:20 common
    lrwxrwxrwx 1 gaetanquentin-sfr gaetanquentin-sfr 4 févr. 18 13:16 current -> 2648

-> directory created and symlink updated, in the same time

Right, revert doesn’t touch user data, so that’s expected. What’s unexpected is that you didn’t have the 2648 initially, but I don’t know how you got into that situation.

because i have never launched remmina in its 2648 version. And 2648 user config directory is only created if you launched it a first time, as shown in my remmina example.

But in your remmina example you didn’t refresh, so no data would be copied.
The user data directory is not copied when you run the app; it is copied on refresh. Not on revert. Not on install. On refresh.

ok.
so user data are copied when refreshing only.

And in the case no user data exists for the current snap revision when we launch the snap the first time (for any reasons .) , user data are copied too or created from scratch?

Is it possible that your home directory might not have been available during a snap refresh for some reason?

if snapd make refreshes at boot time, sure , since homes are ecryptfs ones, only readable if users are loggued in.

1 Like

this morning remmina has been refreshed automatically, after boot, and the configuration is ok.
snap changes:
601 Done today at 08:58 CET today at 08:58 CET Actualiser automatiquement le paquet Snap “remmina”

well, let’s see if the problem come back in the future…

@chipaca: does that sound like it would be a likely cause? Consider the following sequence of events:

  1. log in as a user whose entire home directory is encrypted with ecryptfs.
  2. install a snap and run it so ~/snap/$pkg/$rev is created and populated with the app’s data.
  3. log out as the user and have snapd refresh the snap to a new revision. No ~/snap/$pkg hierarchy will be visible at this time.
  4. log in again and run the application again.
  5. refresh to a third revision.

I’m not sure whether step 4 is required or would make a difference.

1 Like

aha! yes, that would make it happen.

1 Like

ok il will do that in a few hours, i can’t do that now.

this morning, at boot time, 3 snaps have been updated:
602 Done today at 08:48 CET today at 08:48 CET Actualiser automatiquement les paquets Snap “powershell”, “atom”, “remmina”

snap list --all | grep -i -e remmina -e atom -e powershell
atom 1.34.0 212 stable snapcrafters désactivé,classic
atom 1.34.0 214 stable snapcrafters classic
powershell 6.1.2 17 stable microsoft-powershell* désactivé,classic
powershell 6.1.3 19 stable microsoft-powershell* classic
remmina 1.3.2 2723 edge remmina* -
remmina 1.3.2 2695 edge remmina* désactivé

as you can see, directories are not created in my user account:
ls -la snap/atom/
total 0
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 336 nov. 9 16:40 .
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 2520 déc. 13 10:23 …
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 0 oct. 25 13:23 common
lrwxrwxrwx 1 gaetanquentin-sfr gaetanquentin-sfr 3 oct. 25 13:23 current -> 204

ls -la snap/powershell/
total 0
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 504 janv. 28 15:32 .
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 2520 déc. 13 10:23 …
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 0 juil. 18 2018 17
drwxr-xr-x 1 gaetanquentin-sfr gaetanquentin-sfr 0 juil. 18 2018 common
lrwxrwxrwx 1 gaetanquentin-sfr gaetanquentin-sfr 2 sept. 24 15:11 current -> 11