This solved my problem in ubuntu 23.10:
Open:
sudo nano /etc/apt/sources.list
add at the last line (quit the letter s , only http):
deb https://security.ubuntu.com/ubuntu lunar-security main universe
write the command : ctrl + o (save the changes)
write the command: ctrl + x (exit),
then:
sudo apt-get install libncurses5
finally:
sudo apt --fix-broken install