You are doing many things wrong. You have first to update the package list before upgrading them. Then you should better use apt full-upgrade instead of only simple apt upgrade.
rpi ~$ sudo apt update
rpi ~$ sudo apt full-upgrade
Then you use rpi-update that may leave an unstable operating system because its only for testing things under development. ...