I have encountered this issue in the last week (on both an old installation and fresh install) where when trying to install new packages I get dependency errors because a newer version than required is to be installed.
Here is one example of the error message when this is happening (but not limited to this specific case):
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created or
been moved out of Incoming. The following information may help to
resolve the situation:
The following packages have unmet dependencies:
g++-11 : Depends: gcc-11-base (= 11.2.0-19ubuntu1) but 11.3.0-1ubuntu1~22.04 is to be installed
Depends: gcc-11 (= 11.2.0-19ubuntu1) but 11.3.0-1ubuntu1~22.04 is to be installed
Depends: libstdc++-11-dev (= 11.2.0-19ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held
broken packages.
It feels like I got some update through that updated things beyond whatever the dependency map thinks things should be, but I really am not sure how I ended up with this issue.
Edit to add: Checking apt-cach policy may give a clue, but I don't know how to act on this information:
$ apt-cache policy gcc-11 gcc-11-base python3
gcc-11:
Installed: 11.3.0-1ubuntu1~22.04
Candidate: 11.3.0-1ubuntu1~22.04
Version table:
*** 11.3.0-1ubuntu1~22.04 100
100 /var/lib/dpkg/status
11.2.0-19ubuntu1 500
500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
gcc-11-base:
Installed: 11.3.0-1ubuntu1~22.04
Candidate: 11.3.0-1ubuntu1~22.04
Version table:
*** 11.3.0-1ubuntu1~22.04 100
100 /var/lib/dpkg/status
11.2.0-19ubuntu1 500
500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
python3:
Installed: 3.10.6-1~22.04
Candidate: 3.10.6-1~22.04
Version table:
*** 3.10.6-1~22.04 500
500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
100 /var/lib/dpkg/status
3.10.4-0ubuntu2 500
500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages