【问题标题】:system("timedatectl") "Failed to query server: Connection timed out"system("timedatectl") "查询服务器失败:连接超时"
【发布时间】:2019-07-16 20:25:55
【问题描述】:

我正在使用 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  

【问题讨论】:

  • 基于相关的网络搜索(没有解决方案bugzilla.redhat.com/show_bug.cgi?id=1518762),我尝试了这个并得到了……一些东西:$ sudo tail -F /var/log/audit/audit.log | grep AVC type=USER_AVC msg=audit(1550861488.731:311): pid=2800 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied { send_msg } for msgtype=method_return dest=:1.143 spid=14619 tpid=14618 scontext=system_u:system_r:systemd_timedated_t:s0 tcontext=system_u:system_r:initrc_t:s0 tclass=dbus exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'
  • 在运行闪亮的应用程序时,我在 RStudio 服务器上使用 lubridate::seconds 时遇到了同样的错误

标签: r time timezone rstudio rstudio-server


【解决方案1】:

这解决了它:

# 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

【讨论】:

  • 您能否说明您在哪里实施了此修复程序?此错误发生在我在 shinyapps.io 服务器上的应用程序中,但在我本地运行时没有。谢谢!
  • 不幸的是,我们无法在 shinyapps 上运行终端修复!我认为 Rstudio 可能需要在他们的 shinyapps 服务器上运行它?
  • 如果 SELinux 被禁用,我认为这将不起作用
猜你喜欢
  • 1970-01-01
  • 2016-04-05
  • 2015-05-26
  • 2017-11-09
  • 2016-06-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多