The behavior is expected when you open the ssh session in Cloud Shell
The machine that provides your Cloud Shell session is temporary, and it is recycled after your session is inactive for 20 minutes. Permissions are set as regular users without sudo access. Any installation outside your $Home directory is not persisted.
For more reading: Cloud Shell Limitations
----------
--please don't forget to upvote
and Accept as answer
if the reply is helpful--