Sorry if my answer does not help you. However, what you’re encountering is quite normal given the current state contact sync is in sfos. Don’t expect having more than one carddav account (nextcloud integration count as a carddav account) to work bidirectionnaly.
Linked contacts are used to group together contacts of different sources. For example, you could link a nextcloud contact with a skype/whatsapp/whatever contact. It makes a lot of sense for services which have their own contact list. It also makes sense if you wish to link contacts which are both professional (for example, in your enterprise exchange address book) and personal (in your nc account).
When you create an account on SFOS, it by default creates it on the phone. It also creates (i don’t remember exactly if it’s at creation or at synchronization) an aggregate contact (ie, a link which currently holds only one contact). At synchronization, buteo creates a carddav contact, linked with the aggregate. What properties it chooses to replicate is where starts the dark magic. Then, that contact (the newly created one) is sent to the carddav server (if you got multiple ones, it picks one by default, not sure if it is the first added or the last added). Not that after this point, if you modify your contact, property changes are likely to never reach your carddav account, because they will only be done on the local phone contact, not the carddav one (you end up with 3 entries in the database)
When you create a contact on your carddav server, and when buteo receives it, it creates two local contacts: an aggregate and a carddav one. This carddav contact acts as a local cache, and will correctly receive updates from the server. You have 2 entries in the database. However, if you modify it on the phone, the phone will create a new local contact (thus, 3 entries in the database), and put most of your changes (especially, added properties, which are not handled the same as modified properties) there, which means they’ll never reach your carddav server. You’re back at the same point, where things just don’t work.
When you delete a carddav account, the cache entries related to this carddav account are deleted from the database. You end up with only local contacts, for contacts you’ve modified or added on the phone (the ones you never changed disappear as they no longer exists). This is what you got if i understand correctly.
In your case, the nextcloud integration should have recreated the contacts, however. There may be some issues, because i think it’s a bad idea to have two accounts pointing at the same server, at the same time. The steps you should do are more:
- delete carddav sync (contacts should disappear)
- set up nextcloud integration
- sync and wait for contacts to show up
If it still does not work, then it will be time to start to look at buteo’s logs (https://sailfishos.org/wiki/CalDAV_and_CardDAV_Community_Contributions#Sync_Logs provides some useful information).
My advice remains: if you want a clean address book, synced with other devices (such as with you desktop email client), don’t modify your contacts on the phone. Do the change elsewhere (directly in nc, in your mail client, anything that has a good carddav support), and wait for the phone to receive them. That way it works nicely.
Disclaimer: what i state here is based on my own experience and investigation on how contact sync works in sfos, it may be inaccurate or wrong (it is probably wrong or imprecise to some extent).