1profile-sync-daemon(1)                                  profile-sync-daemon(1)
2
3
4

NAME

6       profile-sync-daemon  -  Symlinks  and  syncs  browser  profiles  to RAM
7       (tmpfs) thus reducing HDD/SSD calls and speeding up browsers.
8

DESCRIPTION

10       Profile-sync-daemon (psd) is a tiny pseudo-daemon  designed  to  manage
11       browser  profile/profiles in tmpfs and to periodically sync back to the
12       physical disc (HDD/SSD). This is accomplished by an innovative  use  of
13       rsync  to maintain synchronization between a tmpfs copy and media-bound
14       backup of the browser profile/profiles. Additionally, psd features sev‐
15       eral crash-recovery features.
16
17       Design goals of psd:
18
19              •  Completely transparent user experience.
20
21              •  Reduced wear to physical discs (particularly SSDs).
22
23              •  Speed.
24
25       Since  the  profile/profiles,  browser  cache*, etc. are relocated into
26       tmpfs (RAM disk), the  corresponding  I/O  associated  with  using  the
27       browser  is also redirected from the physical disc to the RAM, thus re‐
28       ducing wear to the physical disc and improving browser responsiveness.
29
30       *Note that some browsers such as Chrome/Chromium, Firefox (since  v21),
31       Midori,  and Rekonq actually keep their cache directories separate from
32       their browser profile directory. It is not within the scope of profile-
33       sync-daemon to modify this behavior; users wishing to relocate this di‐
34       rectory, may refer to  the  following  url  for  several  work-arounds:
35       https://wiki.archlinux.org/in
36       dex.php/Chromium_Tips_and_Tweaks#Cache_in_tmpfs
37

SETUP

39       $XDG_CONFIG_HOME/psd/psd.conf (referred to  hereafter  as  "the  config
40       file") contains all user managed settings.
41
42       NOTE: edits made to the config file while psd is active will be applied
43       only after the service has been restarted.
44
45              •  Optionally enable the use of overlayfs to improve sync  speed
46                 and  to  use  a  smaller  memory  footprint.  Do  this in the
47                 USE_OVERLAYFS variable. The user  will  require  no  password
48                 sudo rights to /usr/bin/psd-overlay-helper to use this option
49                 and the kernel must support overlayfs version 22  or  higher.
50                 See the FAQ below for additional details.
51
52              •  Optionally have psd resync to the filesystem prior to a sleep
53                 call. This can help in the event that  the  system  does  not
54                 properly wake up. Do this in the USE_SUSPSYNC variable.
55
56              •  Optionally  define  which  browsers  are to be managed in the
57                 BROWSERS array. If none are defined, the default is  all  de‐
58                 tected browsers.
59
60              •  Optionally  disable  the use of crash-recovery snapshots (not
61                 recommended). Do this in the USE_BACKUPS variable.
62
63              •  Optionally define the number of crash-recovery  snapshots  to
64                 keep. Do this in the BACKUP_LIMIT variable.
65
66       NOTE: occasionally, updates/changes are made to the default config file
67       (/usr/share/psd/psd.conf)   upstream.   The   user   copy    ($XDG_CON‐
68       FIG_HOME/psd/psd.conf) will need to be diffed against it.
69

RUNNING PSD

71   PREVIEW MODE
72       The  preview  option  can be called to show users exactly what psd will
73       do/is doing based on the entries in the config file. It will also  pro‐
74       vide  useful information such as profile size, paths, and if any recov‐
75       ery snapshots have been created.
76
77        $ psd p
78
79        Profile-sync-daemon v6.39
80
81        systemd service: active
82        resync-timer:    active
83        sync on sleep:   enabled
84        use overlayfs:   enabled
85
86        Psd will manage the following per /home/facade/.config/psd/.psd.conf settings:
87
88         browser/psname:  chromium/chromium
89         owner/group id:  facade/100
90         sync target:     /home/facade/.config/chromium
91         tmpfs dir:       /run/user/1000/facade-chromium
92         profile size:    93M
93         overlayfs size:  39M
94         recovery dirs:   2 <- delete with the c option
95          dir path/size:  /home/facade/.config/chromium-backup-crashrecovery-20200423_171359 (92M)
96          dir path/size:  /home/facade/.config/chromium-backup-crashrecovery-20200424_112204 (93M)
97
98         browser/psname:  firefox/firefox
99         owner/group id:  facade/100
100         sync target:     /home/facade/.mozilla/firefox/f8cv8bfu.default
101         tmpfs dir:       /run/user/1000/facade-firefox-f8cv8bfu.default
102
103         profile size:    145M
104         overlayfs size:  13M
105         recovery dirs:   none
106
107
108   START AND STOP PSD
109       Psd ships with a systemd user service to start  or  stop  it  (psd.ser‐
110       vice).  Additionally, a provided resync-timer will run an hourly resync
111       from tmpfs back to the disk. The resync-timer is started  automatically
112       with  psd.service  so  there  is no need to start the timer; only start
113       psd.service.
114
115        $ systemctl --user [option] psd.service
116
117       Available options: start stop enable disable
118
119   CLEAN MODE
120       The clean mode will delete ALL recovery  snapshots  that  have  accumu‐
121       lated. Only run it when sure these are no longer needed.
122
123        $ psd c
124
125        Profile-sync-daemon v6.39
126
127        Deleting 2 crashrecovery dirs for profile /home/facade/.config/chromium
128         /home/facade/.config/chromium-backup-crashrecovery-20200423_171359
129         /home/facade/.config/chromium-backup-crashrecovery-20200424_112204
130
131

SUPPORTED BROWSERS

133       •  Chromium (stable, beta, and dev)
134
135       •  Conkeror
136
137       •  Epiphany
138
139       •  Falkon
140
141       •  Firefox (stable, beta, and aurora)
142
143       •  Firefox-trunk   (this  is  an  Ubuntu-only  browser:  http://www.we
144          bupd8.org/2011/05/install-firefox-nightly-from-ubuntu-ppa.html)
145
146       •  Google Chrome (stable, beta, and dev)
147
148       •  Heftig's  version   of   Aurora   (Arch   Linux:   https://bbs.arch
149          linux.org/viewtopic.php?id=117157)
150
151       •  Icecat
152
153       •  Iceweasel
154
155       •  Inox (https://bbs.archlinux.org/viewtopic.php?id=198763)
156
157       •  Luakit
158
159       •  Midori
160
161       •  Opera (legacy, stable, next, and developer)
162
163       •  Otter-browser
164
165       •  Palemoon
166
167       •  QupZilla
168
169       •  Qutebrowser
170
171       •  Rekonq
172
173       •  Seamonkey
174
175       •  Vivaldi
176
177       •  Vivaldi-snapshot
178
179       Psd's infrastructure can work in principal with any browser that uses a
180       generic chrome or mozilla, etc. format. User supplied profiles are pro‐
181       vided   in  /usr/share/psd/contrib/  and  can  be  manually  copied  to
182       /usr/share/psd/browsers/ if one wishes to sync that particular browser.
183       Make  a  corresponding  entry  in  the BROWSERS array within the config
184       file. Support for these is unsupported.
185

NOTE ON SYMLINKED PROFILES

187       Currently, psd does not support symlinked profiles and will  refuse  to
188       sync  if  one  is  detected.  For  example,  your  firefox  profile  is
189       ~/.mozilla/firefox/f8cv8bfu.default but you have moved  that  directory
190       to /foo/bar/f8cv8bfu.default and replaced it with symlink:
191
192        $ ls -l ~/.mozilla/firefox
193        lrwxrwxrwx 1 facade users  26 Oct  1 17:02 f8cv8bfu.default -> /foo/bar/f8cv8bfu.default
194
195       Running psd in preview mode will end in an error informing you of this:
196
197        $ psd p
198
199        Warning!
200        /home/facade/.mozilla/firefox/f8cv8bfu.default appears to be a symlink but these are not supported.
201        Please make the browser profile a live directory and try again. Exiting.
202
203       A  proper  work  around  for firefox is to simply edit ~/.mozilla/fire‐
204       fox/profiles.ini defining the canonical path there. One also  needs  to
205       adjust the IsRelative flag like so:
206
207        [Profile0]
208        Name=default
209        IsRelative=0
210        Path=/foo/bar/f8cv8bfu.default
211
212       Other  solutions  may exist for other browsers but documenting them all
213       here is out of scope.
214

SUPPORTED DISTROS

216       Since psd is just a bash script with a systemd service, it  should  run
217       on  any flavor of Linux running systemd. Several distros provide an of‐
218       ficial package or user-maintained option to install psd. One  can  also
219       build psd from source. See the official website for available packages,
220       dependencies, and installation instructions
221

FAQ

223       Q1: What is overlayfs mode?
224
225       A1: Overlayfs is a simple union filesystem mainlined in the Linux  ker‐
226       nel  version 3.18.0. When used with psd, a reduced memory footprint and
227       faster sync operations can be realized. The magic is in how the overlay
228       mount only writes out data that has changed rather than the entire pro‐
229       file. The same recovery features psd uses in its default mode are  also
230       active when running in overlayfs mode.
231
232       See  the example in the PREVIEW MODE section above which shows a system
233       using overlayfs to illustrate the  typical  memory  savings.  Note  the
234       "overlayfs size" report compared to the total "profile size" report for
235       each profile. Be aware that these numbers will change depending on just
236       how  much  new data is written to the profile, but in common use cases,
237       the overlayfs size will always be less than the profile size.
238
239       Q2: How do I enable overlayfs mode?
240
241       A2: First, be sure psd is not active or else any changes to the  config
242       file  will  be ignored until it is restarted. Overlayfs mode is enabled
243       with the USE_OVERLAYFS= variable which should be set to  "yes"  in  the
244       config file. Psd will automatically detect the overlayfs version avail‐
245       able to the kernel if it is configured to use one of them. It is recom‐
246       mended to run psd in preview mode to verify that the system can in fact
247       use overlayfs.
248
249       Users wanting to use overlayfs mode MUST have sudo rights without pass‐
250       word  prompt to /usr/bin/psd-overlay-helper or global sudo rights with‐
251       out password prompt. If the user does not have global rights,  add  the
252       following  line to /etc/sudoers after any other lines defining sudo ac‐
253       cess. It is recommended to use /usr/bin/visudo as root to set this up:
254
255        foo ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper
256
257       Q3: Why do I have another  browser  profile  directory  "foo-back-ovfs"
258       when I enable overlayfs?
259
260       A3:  The  way  overlayfs  works  is to mount a read-only base copy (so-
261       called lower dir) of the profile, and manage the new  data  on  top  of
262       that.  In  order to avoid resyncing to the read-only filesystem, a copy
263       is used instead. So using overlayfs is a trade-off: faster initial sync
264       times and less memory usage vs. disk space in the home dir.
265
266       Q4:   I   need  more  memory  to  accommodate  my  profile/profiles  in
267       /run/user/xxxx. How can I allocate more?
268
269       A4: The standard way of controlling the size of /run/user/ is the  Run‐
270       timeDirectorySize  directive  in  logind.conf  (see  the  man  page for
271       logind.conf for more). By default, 10% of physical memory is  used  but
272       one  can  increase it safely. Remember that tmpfs only consumes what is
273       actually used; the number specified here is just a maximum allowed.
274
275       Q5: My system crashed for some reason and psd didn't sync back. What do
276       I do?
277
278       A5:  The  "last  good" backup of the browser profile/profiles should be
279       the filesystem. Upon restarting psd (on a reboot for example), a  check
280       is  performed to see if the symlink to the tmpfs copy of the profile is
281       invalid. If it is invalid, psd will snapshot the "last good" backup be‐
282       fore  it  rotates  it  back into place. This is more for a sanity check
283       that psd did no harm and that any data loss was a function of something
284       else.
285
286       Q6: Where can I find this snapshot?
287
288       A6: It depends on the browser. The snapshot will be located in the same
289       directory as the browser profile and it will contain a  date-time-stamp
290       that  corresponds to the time at which the recovery took place. For ex‐
291       ample, a chromium snapshot will  be  ~/.config/chromium-backup-crashre‐
292       covery-20130912_153310  -- of course, the date_time suffix will be dif‐
293       ferent.
294
295       Q7: How can I restore the snapshot?
296
297       A7: Follow these steps:
298
299              1.  Stop psd.
300
301              2.  Move the "bad" copy  of  the  profile  to  a  backup  (don't
302                  blindly delete anything).
303
304              3.  Copy  the  snapshot  directory  to the name that browser ex‐
305                  pects.
306
307              Example using chromium:
308
309              1.  systemctl --user stop psd.service
310
311              2.  mv ~/.config/chromium ~/.config/chromium-bad
312
313              3.  cp         -a          ~/.config/chromium-backup-crashrecov‐
314                  ery-20130912_153310 ~/.config/chromium
315
316       At  this point, launch chromium which will use the backup snapshot just
317       copied into place. If all  is  well,  it  is  safe  to  delete  ~/.con‐
318       fig/chromium-bad  and the snapshot. Remember, to start psd, no browsers
319       must be open (or psd will refuse to start).
320
321       Q8: Can psd delete the snapshots automatically?
322
323       A8: Yes, run psd with the "clean" switch to delete snapshots.
324

CONTRIBUTE

326       Users wishing to contribute to this project, should fork it and send  a
327       pull request. Source is freely available on github.
328

BUGS

330       Discovered a bug? Please open an issue.
331
332              •  Several  cases  of  data  loss  have been reported when using
333                 eCryptFS and psd, therefore until this issue is flushed  out,
334                 users  of eCryptFS are encouraged not to use psd unless will‐
335                 ing to help troubleshoot suspected browser  corruption.  See:
336                 https://github.com/graysky2/profile-sync-daemon/issues/158
337

ONLINE

339       •  Project page: https://github.com/graysky2/profile-sync-daemon
340
341       •  Wiki page: https://wiki.archlinux.org/index.php/Profile-sync-daemon
342

AUTHOR

344       graysky (graysky AT archlinux DOT us)
345
346
347
348                                02 October 2023         profile-sync-daemon(1)
Impressum