mackup icon indicating copy to clipboard operation
mackup copied to clipboard

Initial backup fails with symlink problems on iterm2

Open pjknowles opened this issue 1 year ago • 19 comments

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'

pjknowles avatar Jun 15 '23 06:06 pjknowles

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: [email protected] ✔, 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)

atahani avatar Jun 16 '23 07:06 atahani

Same exact issue for me...

manishie avatar Jun 20 '23 23:06 manishie

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...

jamesrtnz avatar Jun 25 '23 08:06 jamesrtnz

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 avatar Jun 29 '23 02:06 timfee

I lied :-)

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

timfee avatar Jun 29 '23 02:06 timfee

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
➜  ~

manishie avatar Jun 29 '23 05:06 manishie

@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....

jamesrtnz avatar Jun 30 '23 02:06 jamesrtnz

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

taudor avatar Jun 30 '23 17:06 taudor

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

worked for me! thanks.

nFec avatar Jul 04 '23 09:07 nFec

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.

ytra avatar Jul 11 '23 13:07 ytra

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 avatar Jul 11 '23 19:07 jamesrtnz

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.

jamesrtnz avatar Aug 05 '23 01:08 jamesrtnz

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.

Angboo avatar Sep 12 '23 03:09 Angboo

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.

zhangxiaoyu2046 avatar Nov 26 '23 02:11 zhangxiaoyu2046

Ditto - this is why I gave up

timfee avatar Dec 29 '23 00:12 timfee

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

chenhaitao9527 avatar Apr 04 '24 06:04 chenhaitao9527

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

mgdigital avatar May 08 '24 09:05 mgdigital

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'

gaspo53 avatar May 17 '24 16:05 gaspo53

I believe this is still an issue. Using 0.8.40 of Mackup.

image

Chad-Ballay avatar Aug 14 '24 21:08 Chad-Ballay