lra / mackup

Keep your application settings in sync (OS X/Linux)
GNU General Public License v3.0
14.42k stars 926 forks source link

Initial backup fails with symlink problems on iterm2 #1925

Open pjknowles opened 1 year ago

pjknowles commented 1 year ago

Mackup 0.8.37

% mackup backup
Mackup needs a directory to store your configuration files
Do you want to create it now? </Users/sacpjk/Library/CloudStorage/Dropbox/Mackup> <Yes|No> Yes
Backing up Library/Preferences/com.kapeli.dashdoc.plist ...
Backing up .docker/config.json ...
Backing up .docker/daemon.json ...
Backing up Library/Preferences/espanso ...
Backing up Library/Application Support/GIMP/2.10/devicerc ...
Backing up Library/Application Support/GIMP/2.10/templaterc ...
Backing up Library/Application Support/GIMP/2.10/pluginrc ...
Backing up Library/Application Support/GIMP/2.10/parasiterc ...
Backing up Library/Application Support/GIMP/2.10/menurc ...
Backing up Library/Application Support/GIMP/2.10/themerc ...
Backing up Library/Application Support/GIMP/2.10/sessionrc ...
Backing up Library/Application Support/GIMP/2.10/colorrc ...
Backing up Library/Application Support/GIMP/2.10/unitrc ...
Backing up Library/Application Support/GIMP/2.10/gimprc ...
Backing up Library/Application Support/GIMP/2.10/controllerrc ...
Backing up Library/Application Support/GIMP/2.10/contextrc ...
Backing up Library/Application Support/GIMP/2.10/toolrc ...
Backing up Library/Application Support/GIMP/2.10/dockrc ...
Backing up .gitconfig ...
Backing up .hammerspoon ...
Backing up Library/Application Support/Adobe/OOBE ...
Backing up .ipython ...
Backing up Library/Preferences/com.googlecode.iterm2.plist ...
Backing up .config/iterm2/AppSupport/DynamicProfiles ...
Traceback (most recent call last):
  File "/opt/homebrew/bin/mackup", line 33, in <module>
    sys.exit(load_entry_point('mackup==0.8.37', 'console_scripts', 'mackup')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/main.py", line 93, in main
    app.backup()
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/application.py", line 119, in backup
    utils.link(mackup_filepath, home_filepath)
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/utils.py", line 145, in link
    os.symlink(target, link_to)
FileExistsError: [Errno 17] File exists: '/Users/sacpjk/Library/CloudStorage/Dropbox/Mackup/.config/iterm2/AppSupport/DynamicProfiles' -> '/Users/sacpjk/.config/iterm2/AppSupport/DynamicProfiles'
atahani commented 1 year ago

same issue on arm64

ProductName:        macOS
ProductVersion:     13.4
BuildVersion:       22F66
brew info mackup
==> mackup: stable 0.8.37 (bottled), HEAD
Keep your Mac's application settings in sync
https://github.com/lra/mackup
/opt/homebrew/Cellar/mackup/0.8.37 (1,364 files, 10.8MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-06-16 at 10:25:23
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/mackup.rb
License: GPL-3.0-or-later
==> Dependencies
Required: python@3.11 βœ”, six βœ”
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 0 (30 days), 0 (90 days), 0 (365 days)
install-on-request: 0 (30 days), 0 (90 days), 0 (365 days)
build-error: 0 (30 days)
manishie commented 1 year ago

Same exact issue for me...

jamesrtnz commented 1 year ago

Try this replacement iterm2.cfg; which needs to go into ${HOME}/.mackup (you'll need to create this directory if you don't have one already):

[application]
name = iTerm2

[configuration_files]
Library/Preferences/com.googlecode.iterm2.plist
Library/Application Support/iTerm2/DynamicProfiles

The original config tries to backup an iTerm2 directory ${HOME}/.config/iterm2/AppSupport/DynamicProfiles; but on my machine, the parent "AppSupport" is a symlink - the modified config above targets the actual "DynamicProfiles" directory, not the symlinked version.

Would be useful to know if this works for anyone...

timfee commented 1 year ago

No such luck in my case (on iCloud as a destination). I nuked the Mackup App Support directory (/Users/timfee/Library/Mobile Documents/com~apple~CloudDocs/Timtop/config/mackup/Library/Application Support/iTerm2) and re-ran the command.

It re-populate a (non-symlinked) DynamicProfiles folder in CloudDocs.

> mackup backup
Backing up Library/Application Support/iTerm2/DynamicProfiles ...
Traceback (most recent call last):
  File "/opt/homebrew/bin/mackup", line 33, in <module>
    sys.exit(load_entry_point('mackup==0.8.37', 'console_scripts', 'mackup')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/main.py", line 93, in main
    app.backup()
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/application.py", line 119, in backup
    utils.link(mackup_filepath, home_filepath)
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/utils.py", line 145, in link
    os.symlink(target, link_to)
FileExistsError: [Errno 17] File exists: '/Users/timfee/Library/Mobile Documents/com~apple~CloudDocs/Timtop/config/mackup/Library/Application Support/iTerm2/DynamicProfiles' -> '/Users/timfee/Library/Application Support/iTerm2/DynamicProfiles'
timfee commented 1 year ago

I lied :-)

The file in ~/.mackup must be named iterm2.cfg (mine was just iterm.cfg) for this to work. Thanks!

manishie commented 1 year ago

Didn't work. πŸ™

➜  ~ mackup backup
Backing up Library/Application Support/iTerm2/DynamicProfiles ...
Traceback (most recent call last):
  File "/opt/homebrew/bin/mackup", line 33, in <module>
    sys.exit(load_entry_point('mackup==0.8.37', 'console_scripts', 'mackup')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/main.py", line 93, in main
    app.backup()
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/application.py", line 119, in backup
    utils.link(mackup_filepath, home_filepath)
  File "/opt/homebrew/Cellar/mackup/0.8.37/libexec/lib/python3.11/site-packages/mackup/utils.py", line 145, in link
    os.symlink(target, link_to)
FileExistsError: [Errno 17] File exists: '/Users/manishie/Dropbox/Mackup/Library/Application Support/iTerm2/DynamicProfiles' -> '/Users/manishie/Library/Application Support/iTerm2/DynamicProfiles'
➜  ~ cat .mackup/iterm2.cfg
[application]
name = iTerm2

[configuration_files]
Library/Preferences/com.googlecode.iterm2.plist
Library/Application Support/iTerm2/DynamicProfiles
➜  ~
jamesrtnz commented 1 year ago

@manishie : did you cleanup any existing older iTerm2 backup file(s) from the mackup backup directory like @timfee did?

@timfee : Thanks, I guess I'll raise a PR to get the file updated then....

taudor commented 1 year ago

Hi, I still have the same issue, even with the fix (did the cleanup before).

nFec commented 1 year ago

[configuration_files] Library/Preferences/com.googlecode.iterm2.plist Library/Application Support/iTerm2/DynamicProfiles

worked for me! thanks.

ytra commented 1 year ago

I ran into the same issue. The tips from here did not work for me. After cleaning everything up I thought it wasn't a good idea to run this backup from within a iTerm2 terminal but from the default macOS terminal instead. There it ran without any problems.

jamesrtnz commented 1 year ago

Yes; noticed that myself the other day - presumably the iTerm2 software is recreating the directory on the fly; this issue needs more thought.

I'm running the latest 3.5beta myself, FYI.

Also, have noticed that my iTerm2 won't correctly read the symlinked properties file when it's moved to my Cloud Storage; if I backup to a local directory, it's fine. Annoying; and probably not a actual issue with Mackup; but with iTerm2 itself.

jamesrtnz commented 11 months ago

As mentioned in #1916 , the advice from the iTerm2 authors is to use the native cloud storage facility built into iTerm2; they stated iTerm2 won't work with the way Mackup symlinks the plist files.

Angboo commented 10 months ago

This problem also occurred to me. At the same time, I found that a large number of configurations became soft links but did not exist in the backup folder, resulting in the loss of a large number of application configurations, such as git's .gitconfig and asdf's .toolversion.

At present, it seems that for the backup function, modifying the user's original configuration is not a good idea. When a program error occurs, the original configuration will be lost. This is extremely fatal for both backup software and users.

zhangxiaoyu2046 commented 7 months ago

I gave up. After trying all the above methods, my iterm2 is still losing the preference and profile config. Now I just mackup uninstall and my iterm2 profile came back finally. I think this fatal bug makes a lot of people give up using mackup, and really hope this issue can be fixed in some later versions.

timfee commented 6 months ago

Ditto - this is why I gave up

chenhaitao9527 commented 3 months ago

Try this replacement iterm2.cfg; which needs to go into ${HOME}/.mackup (you'll need to create this directory if you don't have one already):

[application]
name = iTerm2

[configuration_files]
Library/Preferences/com.googlecode.iterm2.plist
Library/Application Support/iTerm2/DynamicProfiles

The original config tries to backup an iTerm2 directory ${HOME}/.config/iterm2/AppSupport/DynamicProfiles; but on my machine, the parent "AppSupport" is a symlink - the modified config above targets the actual "DynamicProfiles" directory, not the symlinked version.

Would be useful to know if this works for anyone...

Maybe you need to add translation characters(\)

[application]
name = iTerm2

[configuration_files]
Library/Preferences/com.googlecode.iterm2.plist
Library/Application\ Support/iTerm2/DynamicProfiles
mgdigital commented 2 months ago

Same issue here, abandoning Mackup for now due to this :(

gaspo53 commented 2 months ago

Same issue here: Backing up Library/Application Support/BraveSoftware/Brave-Browser/Default/Preferences ... Backing up .config/iterm2/AppSupport/DynamicProfiles ... Traceback (most recent call last): File "/opt/homebrew/bin/mackup", line 8, in <module> sys.exit(main()) ^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/mackup/main.py", line 93, in main app.backup() File "/opt/homebrew/lib/python3.12/site-packages/mackup/application.py", line 112, in backup utils.link(mackup_filepath, home_filepath) File "/opt/homebrew/lib/python3.12/site-packages/mackup/utils.py", line 145, in link os.symlink(target, link_to) FileExistsError: [Errno 17] File exists: '/Users/gaspar/Library/Mobile Documents/com~apple~CloudDocs/Mackup/.config/iterm2/AppSupport/DynamicProfiles' -> '/Users/gaspar/.config/iterm2/AppSupport/DynamicProfiles'