An interesting question you pose.
I'm writing my answer via a computer that is 7 years old and has been using GNU/Linux for 3 or 4 years. The battery or battery charger no longer works, but everything else does, and everything else is original.
When I got this computer, new, it ran Windows NT. After about 3 years it was virtually unusable due to the Microsoft ladened crud that it had acquired over time that was slowing it down and causing it to crash. I've never had a similar issue after I replaced Windows NT with the Ubuntu distribution of GNU/Linux.
Three or four years ago I seriously considered replacing this computer with a new one because of the issues I was having. Replacing Windows with GNU/Linux not only saved me money but also reduced my environmental impact on the planet.
For some people this is not an option due to the reasons they use computers and the software they use. There are a lots of applications written for Windows that cannot be used on GNU/Linux because they are either proprietary or they haven't been converted. If you use computers to play games check what is available on GNU/Linux, it's limited compared in Windows.
For other types of applications: media players, office suites, photo editors there are applications in GNU/Linux that are as good, and in some cases better, than similar applications used by Windows. Research is required before adopting GNU/Linux.
As a side note, most of the world's super computers, Internet servers and servers operated by larger corporations, internationally, run GNU/Linux. It's extremely stable, cheap and generally doesn't need to be rebooted after an update or upgrade.
Concerning the sustainability of software, recently I saw an application that was written more than 20 years ago still being used by a corporation - colored text on a black screen with no graphics and no mouse; the TAB key was used to navigate around the screen.
There is lots of legacy scientific and engineering code written in FORTRAN and commercial/corporate code written in COBOL. Both these languages were introduced in the 1950s. Some legacy code has been re-written in C or C++, but most is still in its original, old format.
Recently I came across an article that discussed how the computing system used for a pension scheme in one of the Balkan countries badly needed to be replaced with something modern but it was such a large and complicated undertaking no-one is prepared to commit to change. There is no desire to disrupt people's pensions during a transition period. One of the issues is when the system was devised in the 1970s it was modern for the time but it used a programming language called PL/1, which was popular then but very few people know that language now.
What makes software sustainable is people wanting to learn a particular computing language so that software can be maintained. There must also be a need for keeping the software.
Update 10 December 2021
It is now 6 years since I wrote this answer. Over the years the computer ended up being too low spec for bloated upgrades of Ubuntu, so Ubuntu was replaced by Linux Mint, which happily ran on the computer for years.
Sadly, all things expire. After having had the computer for 13.5 years (May 2008 to November 2021) the graphics card failed. I suspect due to the failure of the cooling fan. After having removed the hard drive, the laptop will be sent to be recycled.