I know that in history, countries have sold certain parts of their territories to other countries. If a country is in massive debt today, and they feel there is no way they can get out of it, and the debt is causing huge problems, can they just decide to sell some of their land to another country, to get themselves reset financially again? Is this legal, and has it happened in modern times? As far as I know, there is no particular reason why national borders must always stay in exactly the same place, and countries can sell (or trade) land if they wanted to.
Note: Of course, it would not be very popular politically to suggest losing part of your country's territorial area, but if your country was in severe financial problems, and the country's leaders said to the people, "If we do this, we can avoid decades of austerity and financial hardship and start afresh and try to run things better in the future, and your lives would all be a lot easier," then it might be acceptable to the population. They could also point out, "You know, the borders of countries have often changed before in history." Obviously anybody living on the land that was sold would have to be compensated with part of the money, so they could move and buy elsewhere in the country.
As an example: Could, say, Greece announce it was going to auction off one of its islands to whoever bid high enough? (Selling an island or two would probably be more acceptable than a piece of your mainland.) A country who had money - such as, say, China, might be willing to pay an untold sum of money to gain a piece of Chinese territory in the Mediterranean, with all the associated rights that brings. And other countries with money - like, say, Germany, might pay a huge sum of money rather that see another country get those rights. So, in this example, Germany would gain an island in the Mediterranean, and instead of there being recurring problems between Germany and Greece over debt payments, all would become square and the debt would be resolved, or Greece may even find itself in profit if the amount paid was high enough.
Even if a country just announced it was planning to do this, it would be a massive bargaining chip in the next debt negotiations - they might get much easier terms, or large parts of their debt erased, if they agree to cancel their plans for now.
Wouldn't this be a reasonable solution to fix the severest financial crises? It would make a kind of sense that effectively the countries that are running themselves better would be potentially gaining territory, and countries that have run themselves badly would be losing territory. But with their big debts out of the way, they could then start trying to run themselves better again with a fresh start. And it would make things a lot easier for the population. And land and territorial rights is worth so much these days, that even a small amount of land could be enough to pay off huge debts.