rstudio issue at startup ubuntu

Hi everyone!
I just updated R and RStudio Desktop to the latest version on Ubuntu and I messed up something.
I can open the latest R version but when I open RStudio the startup fails...
I managed to copy the diagnostics (see below). Can anyone understand what's going on?

R Session Startup Failure Report

RStudio Version

RStudio 2022.07.2+576, "Spotted Wakerobin" (e7373ef8, 2022-09-06) for Ubuntu Jammy

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

Error message

[No error available]

Process Output

The R session exited with code 2.

Error output:

unable to initialize the JIT


Standard output:

[No output emitted]

Logs

/home/mbiella/.local/share/rstudio/log/rsession-mbiella.log

2023-01-06T22:40:07.133288Z [rsession-mbiella] ERROR R SUICIDE: unable to initialize the JIT; LOGGED FROM: void {anonymous}::rSuicide(const string&) src/cpp/session/SessionMain.cpp:1237
2023-01-06T22:40:07.133288Z [rsession-mbiella] ERROR R SUICIDE: unable to initialize the JIT; LOGGED FROM: void {anonymous}::rSuicide(const string&) src/cpp/session/SessionMain.cpp:1237

If you have an .Rprofile try renaming it and starting again. Then we can figure out what's causing the problem there if it works.

thanks for your help!

it seems that i have no .Rprofile file as the find command returns this:

find: ‘.Rprofile’: No such file or directory

besides that, i looked for the path of r (4.2.2) and rstudio (2022.07.2+576)

which R gives:

/usr/local/bin/R

and whic rstudio gives:

/usr/bin/rstudio

what else should i check?

That’s a PATH issue. Adjust to move the first up in precedence in your shell dotfile or consider removing R from the second.

thanks for your help! but i'm a little lost...
i looked at several resources (such as this RStudio Workbench Administration Guide – R Executable and Libraries), and I don't get what I have to do (I'm still fairly new to the linux world).

how can I change the rstudio's priority?
also, if rstudio is using the default r version, shouldn't it pick up the one located at /usr/local/bin/R?

any info is more then welcome! thanks a lot!!

From a terminal, enter ENV and the top should look like

 ENV 
MallocNanoZone=0
USER=ro
SECURITYSESSIONID=186b3
COMMAND_MODE=unix2003
__CFBundleIdentifier=co.zeit.hyper
PATH=/Users/ro/.nvm/versions/node/v18.9.1/bin:/usr/local/mysql-8.0.28-macos11-x86_64/bin:/bin:/usr/bin:/usr/local/bin:/usr/sbin:/sbin:/Users/ro/.local/bin:/Users/ro/Library/Python/3.9/bin:/Applications/CMake.app/Contents/bin:/opt/homebrew/bin:/Users/ro/.cargo/bin:/Applications/Julia-1.8.app/Contents/Resources/julia/bin/julia:/usr/local/go/bin:/Users/ro/.fig/bin
HOME=/Users/ro
SHELL=/bin/zsh

The 'PATHis the order in which commands are loaded, andSHELL` is the type of command line settings that determines the search order. What does yours show?

it shows a lot of info.
i think the crucial part is this:

SHELL=/bin/bash
MANPATH=/home/linuxbrew/.linuxbrew/share/man:
USER=mbiella
PATH=/home/mbiella/anaconda3/condabin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/mbiella/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

do you mean that I should see this (the output of which R):

/usr/local/bin/R

at the beginning of the 'PATH'?

thanks again!

[quote="technocrat, post:4, topic:156802"]

is where Rstudio is looking, so move that forward.

hi, thanks again!
i tried adding the two following lines (one at a time) to both .bashrc and .profile but nothing changed.

export PATH="/usr/bin/rstudio:$PATH"
export PATH="/usr/local/bin/R:$PATH"

the 'echo $PATH' command showed that the changes actually were implemented (see below) without any effect.

/usr/local/bin/R:/home/mbiella/anaconda3/condabin:/usr/bin/rstudio:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/mbiella/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

what am I doing wrong?

Try this for .RProfile in HOME directory

if (interactive() && requireNamespace("rprofile", quietly = TRUE)) {

  # Only useful if you use Makefiles
  rprofile::create_make_functions()
  
  # Startup options
  rprofile::set_startup_options()
  
  # Not RStudio console
  if (rprofile::is_terminal()) {
    rprofile::set_terminal()
  } else {
    rprofile::set_rstudio()
  }

  .env = rprofile::set_functions()
  attach(.env)
  # Display wifi and no of R sessions
  # Linux only
  rprofile::set_startup_info()
}
utils::assignInNamespace(
  "q", 
  function(save = "no", status = 0, runLast = TRUE) 
  {
    .Internal(quit(save, status, runLast))
  }, 
  "base"
)
# Prints RStudio project on start-up
setHook("rstudio.sessionInit", function(newSession) {
  active_rproj = rprofile::get_active_rproj()
  if (!is.null(active_rproj)) {
    message(glue::glue("{crayon::yellow('R-project:')} {active_rproj}"))
  }
}, action = "append")

options(Ncpus = 4)

.charind <- function (char) {
  lapply(char, FUN = function (x) {
    spl <- strsplit(x, "")[[1]]
    ret <- 1:length(spl)
    names(ret) <- spl
    ret
  })
}

i do not have a .RProfile file in HOME directory.
so, I created one with "touch" and added the code you sent but nothing changed.
is there anything else i can try before backing up my files and reinstalling ubuntu from scratch?

Have you simply tried resetting RStudio's state?

RStudio is already in the path regardless of the position and it is trying to load (with an error) so there is no point in going that way. Also, make sure to also remove the custom .Rprofile you have added to avoid possible conflicts. (there should not be a need for one to start a clean install of R).

resetting RStudio's state was the first thing I tried...

is it possible to mess something up so badly that even reinstalling r or RStudio doesn't solve the issue?

You said R is working so I wouldn't go that way. Uninstalling RStudio doesn't get rid of the configuration files. I'm only aware of the ones you already deleted while resetting RStudios state but there might be more left from an old install. You can try uninstalling with the purge command to see if it helps getting rid of those.

sudo apt purge rstudio

Most likely some environment variable is not being set correctly on startup or you have an incompatible system dependency that is not being correctly reported by the error messages.

About the environment variables, there is little I can do for you because there are tons of them and I don't fully understand how the RStudio IDE initialize them, although, you could try creating a new system user and try to launch from that account to see if the problem is with your specific user's environment.

And to explore the second possibility, can you confirm that you have used the correct installer for your Ubuntu version? there are separate installers for Ubuntu 18+ and Ubuntu 22 (because they have different system dependencies).

thanks everyone for your help!
i installed ubuntu in 2020 and updated regularly...
i had some issue moving from r4.0 to r4.2 and I guess I made some mistakes there.
for some time, I kept installing r and ending up with version 4.0 instead of 4.2. that was the only issue and studio always worked properly (even r packages and everything else).

if you run out of suggestions, I guess that backing up my file and starting with a fresh ubuntu installation would be the best solution.

anyway, thanks a lot for your help!

1 Like

If you go this way I would recommend going with the latest Long Term Support (LTS) version (22.04.1 LTS) rather than the latest and greatest. RStudio fully supports LTS versions only.

i see! i'll stick with ubuntu 22.04 then!
thanks a lot!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.