我刚刚在我的 ubuntu PC 上找到了这些目录。它们是如何产生的?
/var/tmp/systemd-private-762c8e6ced154b18ac76720c2c05f2aa-colord.service-fcAgPb
/var/tmp/systemd-private-762c8e6ced154b18ac76720c2c05f2aa-rtkit-daemon.service-iVKzv4
/var/tmp/systemd-private-809e24ac9abd4087b9941b3590575e64-colord.service-KlzdX8
/var/tmp/systemd-private-809e24ac9abd4087b9941b3590575e64-rtkit-daemon.service-mNk1of
Run Code Online (Sandbox Code Playgroud)
每个目录仅包含另一个tmp始终为空的子目录。
我的意思是文件名是不言自明的。systemd可能创建了它们,并且它们与rtkit和彩色服务/恶魔有关。
但为什么systemd 要创建它们呢?这些服务是否配置错误?
其中一些目录较旧。有些有上次启动的修改时间。
我可以删除它们吗?
我有一个备份脚本~/scripts/backup.sh和我的暴发户conf ~/.config/upstart/shutdown.conf。
description "my shutdown script"
start on desktop-end
task
console log
script
exec ~/scripts/backup.sh start
end script
Run Code Online (Sandbox Code Playgroud)
我的脚本备份到外部硬盘驱动器on desktop-end,但在调用我的脚本之前外部硬盘驱动器被卸载。
如何在关闭序列之前使用我的脚本,然后仅在脚本完成时恢复?
我尝试了这篇文章中的解决方案,但挂钩on starting rc不起作用。
谢谢。
我正在尝试使用命令从 cron 休眠systemctl hibernate。但是,我收到以下错误:
Failed to set wall message, ignoring: Interactive authentication required.
Failed to hibernate system via logind: Interactive authentication required.
Failed to start hibernate.target: Interactive authentication required.
See system logs and 'systemctl status hibernate.target' for details.
Run Code Online (Sandbox Code Playgroud)
如果我从终端手动执行上述命令,它会按预期工作。
如何从 cron 休眠?
我使用的是 Ubuntu 16.04。
上周末我将服务器从 14.04 LTS 升级到 16.04 LTS。
事情并没有像希望的那么顺利。并且必须学习如何使用systemctl和journalctl困难的方法并没有帮助。
无论如何:我注意到某些服务在重新启动时无法启动,但文本传递得太快,我无法读取哪些服务失败。
...是否有一种快速方法可以从日志中读取它 - 或者我是否需要将启动过程记录为视频并减慢视频速度?:-)
我了解到这是journalctl -b0指上次启动,但它可以再提炼吗?
github wiki或sourceforge wiki上没有描述如何执行此操作,只是如何执行此操作
有一个文件
/etc/default/ddclient
# Configuration for ddclient scripts
# generated from debconf on Thu Jul 27 17:32:33 ACST 2017
#
# /etc/default/ddclient
# Set to "true" if ddclient should be run every time DHCP client ('dhclient'
# from package isc-dhcp-client) updates the systems IP address.
run_dhclient="false"
# Set to "true" if ddclient should be run every time a new ppp connection is
# established. This might be useful, if you are using dial-on-demand.
run_ipup="false"
# …Run Code Online (Sandbox Code Playgroud) 我本地安装了 Ubuntu 16.04,默认情况下它具有systemctl子命令的 bash 补全功能。但是当我在 Digital Ocean 上启动 Ubuntu Server 18.04 实例时,子systemctl命令没有 bash 补全。我预计会缺少一些软件包,例如systemd-completion,但在我本地的 Ubuntu 上我只安装了这些软件包:
ii libpam-systemd:amd64 229-4ubuntu21.2 amd64 system and service manager - PAM module\nii libsystemd0:amd64 229-4ubuntu21.2 amd64 systemd utility library\nii libsystemd0:i386 229-4ubuntu21.2 i386 systemd utility library\nii systemd 229-4ubuntu21.2 amd64 system and service manager\nii systemd-shim 9-1bzr4ubuntu1 amd64 shim for systemd\nii systemd-sysv 229-4ubuntu21.2 amd64 system and service manager - SysV links\nRun Code Online (Sandbox Code Playgroud)\n\n和竣工工程。这bash-completion软件包已安装在两台机器上。
另外,在/etc/bash_completion.d/我的本地 16.04 机器上,我没有看到任何相关的 systemctl …
这是我的/etc/network/interfaces:
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
Run Code Online (Sandbox Code Playgroud)
这是我的/etc/netplan/01-netcfg.yaml:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s25:
addresses: [ 192.168.1.100/24 ]
gateway4: 192.168.1.1
nameservers:
addresses:
- "8.8.8.8"
- "8.8.4.4"
Run Code Online (Sandbox Code Playgroud)
当机器连接到网络时,它可以正常启动。但每当我把它带到我的办公桌上进行维护时,那里没有网线,我就会看到这样的信息:
启动作业正在运行以等待网络配置
我该如何解决这个问题,以便我可以在不连接以太网电缆的情况下启动机器?
刚刚安装了ubuntu服务器18.04。我无法使用 systemd-networkd 获得 dhcp 租约,但使用 dhclient 工作正常。
使用 SYSTEMD_LOG_LEVEL=debug 我得到:
$ journalctl
...
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: Link state is up-to-date
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: found matching network '/etc/systemd/network/10-netplan-enp3s0.network'
Apr 29 10:14:09 computer systemd-networkd[2169]: wlp2s0: Link is not managed by us
Apr 29 10:14:09 computer systemd-networkd[2169]: lo: Link is not managed by us
Apr 29 10:14:09 computer systemd-networkd[2169]: LLDP: Started LLDP client
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: Started LLDP.
Apr 29 10:14:09 computer systemd-networkd[2169]: enp3s0: …Run Code Online (Sandbox Code Playgroud) 我正在尝试在重新启动时使用 systemd 删除特定目录中的所有文件。
\n\n这是我的/lib/systemd/system/delete-at-boot.service文件(root,访问权限 644):
[Unit]\nDescription=Remove content of test folder at boot\n\n[Service]\nExecStart=/bin/rm /home/user/test/*\n\n[Install]\nWantedBy=multi-user.target\nRun Code Online (Sandbox Code Playgroud)\n\n当我/bin/rm /home/user/test/*手动运行时,删除工作正常,但当我启动该过程时,我可以看到我的文件没有被删除。
\xe2\x97\x8f delete-at-boot.service - Remove content of test folder at boot\n Loaded: loaded (/lib/systemd/system/delete-at-boot.service; enabled; vendor preset: enabled)\n Active: failed (Result: exit-code) since Fri 2019-08-02 18:21:09 UTC; 7s ago\n Process: 5460 ExecStart=/bin/rm /home/user/test/* (code=exited, status=1/FAILURE)\n Main PID: 5460 (code=exited, status=1/FAILURE)\n\nAug 02 18:21:09 tegra-ubuntu systemd[1]: Started Remove content of test folder at boot.\nAug 02 18:21:09 tegra-ubuntu rm[5460]: /bin/rm: cannot …Run Code Online (Sandbox Code Playgroud) 我最近从 16.04 升级到 18.04,我认为升级过程中出现了问题。当我运行时sudo apt-get install -f,它尝试升级udev,但随后我收到有关“不安全符号链接”的重复消息和此错误消息:
dpkg: error processing package systemd (--configure):
installed systemd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
systemd
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
我之前收到过类似的消息systemd-shim,但设法修复了它。我也遇到了不正确的问题/etc/apt/sources.list,但我认为这也已解决。我在升级过程中收到各种错误消息,最后我不得不“销毁”某些东西,而不是正确完成升级(不幸的是我不记得到底发生了什么。)对于发生了什么有什么想法吗?