'timedatectl' had status 1

I planned to switch a forecasting class to RStudio Cloud but am getting the error below when loading the {anytime} package, which also causes some installations from Github to fail. I have the tidyverse and tidyverts installed, but the error happens even if it is the only installed package in the user library. It seems to happen with both R 4.0.0 and 3.6.3.

loading {anytime}:

Restarting R session...

library(anytime)
Failed to create bus connection: No such file or directory
Warning message:
In system("timedatectl", intern = TRUE) :
running command 'timedatectl' had status 1

When installing the latest dev version of {fable}, eveything is fine until this point:

** byte-compile and prepare package for lazy loading
Failed to create bus connection: No such file or directory
Error: package or namespace load failed for ‘fabletools’:
.onLoad failed in loadNamespace() for 'anytime', details:
call: system("timedatectl", intern = TRUE)
error: (converted from warning) running command 'timedatectl' had status 1
Error: package ‘fabletools’ could not be loaded
Execution halted
ERROR: lazy loading failed for package ‘fable’
*removing ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/4.0/fable’
*restoring previous ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/4.0/fable’
Error: Failed to install 'fable' from GitHub:
(converted from warning) installation of package ‘/tmp/RtmpIJ22iY/file18b7fadf0a8/fable_0.2.1.9000.tar.gz’ had non-zero exit status

I have not used RStudio Cloud much, so this is probably user error.

The culplrit will be clearly identified if you don't get CLI results in the following form

$ timedatectl
               Local time: Sun 2020-07-05 23:05:35 PDT     
           Universal time: Mon 2020-07-06 06:05:35 UTC     
                 RTC time: Mon 2020-07-06 06:05:35         
                Time zone: America/Los_Angeles (PDT, -0700)
System clock synchronized: yes                             
              NTP service: active                          
          RTC in local TZ: no

which is what I get under Ubuntu shell and the R4 command line and RStudio have no problem loading anytime

I tried using the Terminal tab in RStudio, but not sure that is what you meant:

rstudio-user@application-1616434-deployment-4652053-8ltmd:/cloud/project$timedatectl
Failed to create bus connection: No such file or directory
rstudio-user@application-1616434-deployment-4652053-8ltmd:/cloud/project$

{anytime} loads if I repeat library(anytime) after getting the error message

library(anytime)
Failed to create bus connection: No such file or directory
Warning message:
In system("timedatectl", intern = TRUE) :
running command 'timedatectl' had status 1
library(anytime)

Thanks for your help.

Sorry to be obscure. Try from the terminal tab or from a terminal app. I suspect the system executable timedatectl is missing.

I suspect the issue here is that timedatectl command requires special system permissions to run (I believe it actually needs to communicate with systemd; something which our security settings do not permit).

I would try setting your timezone using the TZ variable in your .Renvrion file:

TZ="America/Los_Angeles"
4 Likes

Thanks very much technocrat and andy_kipp. All seems well. Do you recommend setting TZ for user or project?

I would recommend setting it if you're going to be doing anything with timezones. You can also use Sys.setenv().

1 Like

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