RStudio Server not changing the version of R when updated

Hi

I hope you guys can help I am on Red Hat Enterprise Linux release 8.3 (Ootpa)
uname -a
Kernel 4.18.0-240.22.1.el8_3.x86_64 #1 SMP Thu Mar 25 14:36:04 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux

I have Rstudio Server installed version rstudio-server-1.4.1106-1.x86_64

The issue I am having is related to RStudio not allowing me to plot anything and not having access to X11.

plot(mtcars)
No protocol specified
Error in RStudioGD() :
Shadow graphics device error: r error 4 (R code execution error)
In addition: Warning message:
In grDevices:::png("/tmp/RtmpQXOyCo/2b48b8e74a284eab85450a16365ec296.png", :
unable to open connection to X11 display ''

This error appears and disappears randomly. It was working fine until today

To remedy this I have compiled R from source with the right config

capabilities() #This is by Running R on command line
jpeg png tiff tcltk X11 aqua
TRUE TRUE FALSE FALSE TRUE FALSE
http/ftp sockets libxml fifo cledit iconv
TRUE TRUE TRUE TRUE TRUE TRUE
NLS profmem cairo ICU long.double libcurl
TRUE FALSE TRUE FALSE TRUE TRUE

Running R on RStudio for some reason returns something different entirely
capabilities()
jpeg png tiff tcltk X11 aqua http/ftp sockets libxml fifo
FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE
cledit iconv NLS profmem cairo ICU long.double libcurl
FALSE TRUE TRUE FALSE FALSE FALSE TRUE TRUE

It seem that RStudio regardless of how many times you reinstall it or specify the location of R somehow still uses some old Version of R. I am not sure where it gets it from as I have looked through the whole system and there is only one that sits in /usr/local/bin/R.

This is happening with R version 4.0.3 and I have tried to install 4.0.5 and for some reason it still manages to use 4.0.3. Where it gets it from? I Don't Know!!?.

The $PATH variable has no link to any old version either. (I removed R from /usr/local/bin/R a couple of times and RStudio Server fails to run) double mystery :cry:

Can you please help me find a way to resolve this? I have already spent two hours trying every possible solution that came to mind reinstalling R and RStudio Server.

Also is there a way to reset RStudio Server as I am not sure YUM does a very good job of that and the install leaves many lingering files in the system.

Thanks a million