lra / mackup

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

mackup restore on new machine cause `OSError: [Errno 2] No such file or directory` #704

Open leoredi opened 8 years ago

leoredi commented 8 years ago

Hi, I am having a problem using mackup with iCloud. what I do is the following

Federicos-MacBook-Air:~ fredi$ ls -l .mackup.cfg 
lrwxr-xr-x  1 fredi  staff  76 30 Oct 17:02 .mackup.cfg -> /Users/fredi/Library/Mobile Documents/com~apple~CloudDocs/Mackup/.mackup.cfg
Federicos-MacBook-Air:~ fredi$ cat .mackup.cfg 
[storage]
engine = icloud
Federicos-MacBook-Air:~ fredi$ ls -l /Users/fredi/Library/Mobile\ Documents/com~apple~CloudDocs/Mackup/.mackup.cfg
-rw-------  1 fredi  staff  26 28 Oct 11:10 /Users/fredi/Library/Mobile Documents/com~apple~CloudDocs/Mackup/.mackup.cfg
Federicos-MacBook-Air:~ fredi$ cat /Users/fredi/Library/Mobile\ Documents/com~apple~CloudDocs/Mackup/.mackup.cfg
[storage]
engine = icloud

Federicos-MacBook-Air:~ fredi$ mackup restore
Traceback (most recent call last):
  File "/usr/local/Cellar/mackup/0.8.12/libexec/bin/mackup", line 9, in <module>
    load_entry_point('mackup==0.8.12', 'console_scripts', 'mackup')()
  File "/usr/local/Cellar/mackup/0.8.12/libexec/lib/python2.7/site-packages/mackup/main.py", line 121, in main
    app.restore()
  File "/usr/local/Cellar/mackup/0.8.12/libexec/lib/python2.7/site-packages/mackup/application.py", line 157, in restore
    home_filepath))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 156, in samefile
    s2 = os.stat(f2)
OSError: [Errno 2] No such file or directory: '/Users/fredi/.ssh/config'
leoredi commented 8 years ago

bump

hannupekka commented 8 years ago

Try mkdir ~/.ssh

ericpedia commented 8 years ago

I'm getting the same error while attempting to restore after moving the Mackup folder within Dropbox and changing .mackup.cfg. I'm using the default Dropbox engine.

mackup restore fails, claiming there's no .mackup.cfg file—but it exists and is in the specified location.

$ mackup restore
Traceback (most recent call last):
  File "/usr/local/Cellar/mackup/0.8.13/libexec/bin/mackup", line 9, in <module>
    load_entry_point('mackup==0.8.13', 'console_scripts', 'mackup')()
  File "/usr/local/Cellar/mackup/0.8.13/libexec/lib/python2.7/site-packages/mackup/main.py", line 103, in main
    mackup_app.restore()
  File "/usr/local/Cellar/mackup/0.8.13/libexec/lib/python2.7/site-packages/mackup/application.py", line 157, in restore
    home_filepath))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 156, in samefile
    s2 = os.stat(f2)
OSError: [Errno 2] No such file or directory: '/Users/me/.mackup.cfg'
alanning commented 4 years ago

Proposed change: Mackup should either:

  1. ignore these errors or,
  2. create the missing files

Currently its very painful to mackup restore on a new computer:

➜  ~ mackup restore
Restoring .docker/config.json ...
You already have a file named .docker/config.json in your home.
Do you want to replace it with your backup ? <Yes|No>no
Restoring .gitconfig ...
Traceback (most recent call last):
  File "/usr/local/bin/mackup", line 11, in <module>
    load_entry_point('mackup==0.8.27', 'console_scripts', 'mackup')()
  File "/usr/local/Cellar/mackup/0.8.27/libexec/lib/python3.7/site-packages/mackup/main.py", line 115, in main
    app.restore()
  File "/usr/local/Cellar/mackup/0.8.27/libexec/lib/python3.7/site-packages/mackup/application.py", line 169, in restore
    and os.path.samefile(mackup_filepath, home_filepath)
  File "/usr/local/Cellar/mackup/0.8.27/libexec/bin/../lib/python3.7/genericpath.py", line 101, in samefile
    s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/<user>/.gnupg/trustdb.gpg'
➜  ~ rm -r ~/Dropbox/Mackup/.gnupg
➜  ~ mackup restore
Restoring .docker/config.json ...
You already have a file named .docker/config.json in your home.
Do you want to replace it with your backup ? <Yes|No>no
Restoring .keepassx ...
You already have a folder named .keepassx in your home.
Do you want to replace it with your backup ? <Yes|No>no
Traceback (most recent call last):
  File "/usr/local/bin/mackup", line 11, in <module>
    load_entry_point('mackup==0.8.27', 'console_scripts', 'mackup')()
  File "/usr/local/Cellar/mackup/0.8.27/libexec/lib/python3.7/site-packages/mackup/main.py", line 115, in main
    app.restore()
  File "/usr/local/Cellar/mackup/0.8.27/libexec/lib/python3.7/site-packages/mackup/application.py", line 169, in restore
    and os.path.samefile(mackup_filepath, home_filepath)
  File "/usr/local/Cellar/mackup/0.8.27/libexec/bin/../lib/python3.7/genericpath.py", line 101, in samefile
    s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/<user>/Library/Application Support/keepassx/keepassx2.ini'
lra commented 4 years ago

Those "no such file or directory" errors don't seem related unless I'm missing something. Back to OP, it might be related to iCloud. Are you still experiencing this error?

exprez135 commented 4 years ago

I experienced this issue as well. I moved my mackup backup directory (I'm using git). Essentially just re-named a folder. Then manually added a correct .mackup.cfg file to ~. But all of the files that mackup restore wants to restore to still exist as symbolic links to the previous directory. Instead of giving the option to overwrite these, Mackup displays this error. I'm manually removing all of the files/symbolic links now, which allows for mackup restore to properly restore them.

I'm assuming I could have avoided all this by running mackup uninstall then changing the directory and running mackup backup.

leoredi commented 4 years ago

Any news?

Markhenn commented 3 years ago

Had the same Problem and it seems to be related to moving the mackup folder within Dropbox.

I fixed it as @exprez135 suggested by using mackup uninstall. I reacreated the original directory though and let .mackup.cfg point there before running mackup uninstall

Afterwards I used the new path inside .mackup.cfg when calling mackup restore

lra commented 3 years ago

Yes, @exprez135 's suggestion is the right one. If you move things around, a new install of Mackup cannot guess where things are. Your best bet is to mackup uninstall -> mackup backup -> mackup restore.