system(“ timedatectl”)“查询服务器失败:连接超时”

时间:2019-02-22 17:25:33

标签: r time timezone rstudio rstudio-server

我正在具有RHEL 7.6的AWS服务器上运行带有R 3.5.1的RStudio 1.1.456(请参阅下面的sessionInfo)。我第一次(每次会话)调用Sys.timezone()时,出现错误:

> Sys.timezone()
Failed to query server: Connection timed out
[1] "America/Chicago"
Warning message:
In system("timedatectl", intern = TRUE) :
  running command 'timedatectl' had status 1

随后运行良好:

> Sys.timezone()
[1] "America/Chicago"

但是system(“ timedatectl”)继续失败:

> system("timedatectl", intern = TRUE)
Failed to query server: Connection timed out
character(0)
attr(,"status")
[1] 1
Warning message:
In system("timedatectl", intern = TRUE) :
  running command 'timedatectl' had status 1

就我所知,在命令行中一切正常:

# timedatectl
      Local time: Fri 2019-02-22 11:18:14 CST
  Universal time: Fri 2019-02-22 17:18:14 UTC
        RTC time: Fri 2019-02-22 17:18:13
       Time zone: America/Chicago (CST, -0600)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2018-11-04 01:59:59 CDT
                  Sun 2018-11-04 01:00:00 CST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2019-03-10 01:59:59 CST
                  Sun 2019-03-10 03:00:00 CDT

# chronyc sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* time.richiemcintosh.com       2   6   377    82   -405us[ -364us] +/-   33ms
^+ pool-173-71-69-215.cmdnn>     1   7   377    18  -1828us[-1828us] +/-   56ms
^+ vps5.ctyme.com                2   6   377    82   +972us[ +972us] +/-   66ms
^+ mirror1.sjc02.svwh.net        2   7   377    18  +2250us[+2250us] +/-   61ms

更新:它也可以直接从R在命令行中正常运行。它仅在Rstudio中失败。

我还应该尝试什么?我不明白为什么system(“ timedatectl”)与命令行中的timedatectl如此不同。

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1    yaml_2.2.0  

1 个答案:

答案 0 :(得分:0)

此问题已解决:

# grep timedated /var/log/audit/audit.log | audit2allow -M timedated
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i timedated.pp

# semodule -i timedated.pp