I tried to log in to another Azure subscription and tried running
az acr show -n <acr-name>
and received same error code as yours even when the az acr log in command was successfull, refer below:-

When I ran the same commands and logged into the correct subscription where my ACR is deployed, Then I was able to retrieve acr details with az acr show -n <acr-name>
command, Refer below:-
I am using sudo before every Azure CLI command to make sure I am running the scripts as a root user.
Scripts:-
Logged into my Azure account:-
sudo az login
Checked if the account is set to the correct subscription as my ACR:-
sudo az account set --subscription <subscription-id>
Logged into ACR:-
sudo az acr login --name <acr-name> --username siliconacr --password <password>
Ran the command:-
sudo az acr show --name siliconacr
Make sure you only add Container registry name and not the log in server name in the az acr show - n command.
Output:-


If the issue persists try az logout
command let and try logging in again as your Azure CLI in the ubuntu VM might have cached the credentials.
Reference:-
azure - az acr - Unable to find repository in case of multiple subscription on single account - Stack Overflow