It seems that due to a more advanced (???) dependncy it cannot install php8.1-gd. I tried adding "--no-install-recommends" but id didn't help.
In addition, I had ubuntu 18 and upgraded to 22 (through 20), maybe this is the root of the problem?
> sudo apt install php8.1-gd
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
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:
php8.1-gd : Depends: php8.1-common (= 8.1.2-1ubuntu2.4) but 8.1.8-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.