How to repair the symlinks in a copied cygwin64 tree

KARR, DAVID dk068x@att.com
Fri Aug 9 13:38:01 GMT 2024


Thanks.  I gave up on the backed-up tree a while ago and reinstalled Cygwin, but I'll keep this information in mind if I ever run into this again.

From: Cygwin <cygwin-bounces~dk068x=att.com@cygwin.com> On Behalf Of Andrey Repin via Cygwin
Sent: Friday, August 9, 2024 3:07 AM
To: David Karr <davidmichaelkarr@gmail.com>; cygwin@cygwin.com
Cc: Andrey Repin <anrdaemon@yandex.ru>
Subject: Re: How to repair the symlinks in a copied cygwin64 tree

Greetings, David Karr! > At my work, I had to have my laptop reimagined for various reasons. I had > them save my cygwin64 tree to external storage first. I now have the laptop > back, and I copied the entire tree back in, but now I


Greetings, David Karr!



> At my work, I had to have my laptop reimagined for various reasons. I had

> them save my cygwin64 tree to external storage first. I now have the laptop

> back, and I copied the entire tree back in, but now I realize I should have

> done this differently, and I'm wondering how best to repair this. Some of

> you can probably guess, but now all of the files that were symlinks in

> Cygwin are now very small data files. I can tell they used to be symlinks

> because when I cat one, it shows "!<symlink>" in the first characters.



These symlinks usually point to Cygwin directory tree and should be fine.

Just chmod +S them.



> What is the best strategy for repairing this? The most simple-minded

> approach that I can see is simply renaming the cygwin64 tree to get it out

> of the way, and then just reinstalling Cygwin, and then copying in all the

> files in my cygwin home directory in the saved tree. I will likely guess

> wrong on what packages I had installed before. Is there some way I can

> simply repair the symylink files directly?



Easiest I've encountered is to



0. Have a backup of your existing installation, for reference.

1. Install Cygwin anew.

2. Pull /etc/setup/installed.db from backup into a temporary directory.

3. Get a list of manually installed packages from backup

    # sed -Ee '/ 1$/s/^([^[:space:]]+) [^[:space:]]+?(\.tar[^[:space:]]+ 1)$/\1 \1-0\2/; t; d;' < $backup/installed.db

    Warning note: There will be failures, not all package versions adhere to

    the same pattern.

4. Append the list to the end of current /etc/setup/installed.db

5. Run setup to pull the package "updates".



> Besides the symlink problem, is there anything else that I might have

> broken by doing it this way?



None that I know.



> I'm guessing the correct way to have done this would have been instead

> storing the "tar czpf" output in external storage. I think that would have

> preserved the symlinks and restored them properly with "tar xzf".



It would have a chance of destroying permissions, I prefer reinstall, with

backup of /etc/ and /usr/local directories (that's where I keep custom stuff).

Since I don't use Cygwin's /home, it's easy for me.





--

With best regards,

Andrey Repin

Friday, August 9, 2024 12:54:41



Sorry for my terrible english...





--

Problem reports:      https://urldefense.com/v3/__https://cygwin.com/problems.html__;!!BhdT!l3czdFqFecACnqETjVB_eY1UOMJ68HWpEmeoxXgc7mmyw-6v3UKg3kJVgyw8LPyf5ojJm6KYz_lgLg$<https://urldefense.com/v3/__https:/cygwin.com/problems.html__;!!BhdT!l3czdFqFecACnqETjVB_eY1UOMJ68HWpEmeoxXgc7mmyw-6v3UKg3kJVgyw8LPyf5ojJm6KYz_lgLg$>

FAQ:                  https://urldefense.com/v3/__https://cygwin.com/faq/__;!!BhdT!l3czdFqFecACnqETjVB_eY1UOMJ68HWpEmeoxXgc7mmyw-6v3UKg3kJVgyw8LPyf5ojJm6KwJ5XCyA$<https://urldefense.com/v3/__https:/cygwin.com/faq/__;!!BhdT!l3czdFqFecACnqETjVB_eY1UOMJ68HWpEmeoxXgc7mmyw-6v3UKg3kJVgyw8LPyf5ojJm6KwJ5XCyA$>

Documentation:        https://urldefense.com/v3/__https://cygwin.com/docs.html__;!!BhdT!l3czdFqFecACnqETjVB_eY1UOMJ68HWpEmeoxXgc7mmyw-6v3UKg3kJVgyw8LPyf5ojJm6KverV-Yg$<https://urldefense.com/v3/__https:/cygwin.com/docs.html__;!!BhdT!l3czdFqFecACnqETjVB_eY1UOMJ68HWpEmeoxXgc7mmyw-6v3UKg3kJVgyw8LPyf5ojJm6KverV-Yg$>

Unsubscribe info:     https://urldefense.com/v3/__https://cygwin.com/ml/*unsubscribe-simple__;Iw!!BhdT!l3czdFqFecACnqETjVB_eY1UOMJ68HWpEmeoxXgc7mmyw-6v3UKg3kJVgyw8LPyf5ojJm6KEsFjOFQ$<https://urldefense.com/v3/__https:/cygwin.com/ml/*unsubscribe-simple__;Iw!!BhdT!l3czdFqFecACnqETjVB_eY1UOMJ68HWpEmeoxXgc7mmyw-6v3UKg3kJVgyw8LPyf5ojJm6KEsFjOFQ$>


More information about the Cygwin mailing list