使用 init 脚本(或使用 openrc)我总是可以从不同的安装根运行服务。
但是当我跑步时,chroot /somepath/to_root /usr/bin/systemctl start someservice我得到了:
Running in chroot, ignoring request.
Run Code Online (Sandbox Code Playgroud)
有没有办法强制systemd运行服务?
更新:
我忘了说我的主机系统运行 init 脚本或 openrc,但从来没有使用 systemd,而且我使用 chroot 来对 Unix 系统进行故障排除,这些系统甚至无法启动最小的 shell。
Virtualbox 能够向正在运行的虚拟机发出命令:
vboxmanage controlvm NameOfRunningVM acpipowerbutton
Run Code Online (Sandbox Code Playgroud)
但是,此命令会立即返回,这会导致我的情况无法正常关闭。
情况:我计划在 /etc/init.d 脚本中使用它。这将允许正常关闭所有正在运行的 VM。目前,当我发出vboxmanage controlvm NameOfRunningVM acpipowerbutton命令时,关闭会被切断,因为该命令不会等待 VM 关闭。
我需要一个 Bash 脚本,它将 Virtualbox 机器的名称和超时(以秒为单位)作为输入,然后等待 VM 返回到“关机”状态或超时发生?
我不确定这样做的最佳方法是什么。
我正在考虑使用以下命令检查 VM 的状态:
[user@machine ~]$ vboxmanage list runningvms
"VirtualMachineName" {65c93f1f-4508-4119-b07d-ce9e89b23b8e}
Run Code Online (Sandbox Code Playgroud)
bash 脚本可能会轮询正在运行的虚拟机列表。一旦机器名称停止列出,VM 将被视为已完成。
我将我的服务器更新为 Debian wheezy 并尝试使用它。过了一会儿我想重新启动并遇到错误
shutdown: /run/initctl: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我在网上搜索,发现 initctl 来自 upstart。即使它没有根据 aptitude 安装并且servicesysvinit的命令仍然有效。我很感激任何帮助。
我有两台安装了 Devuan 的笔记本电脑。关闭时,当 cryptsetup 尝试关闭加密分区时,它会挂起大约一分钟。
\n\n留言:
\n\nStopping remaining crypto disks...sda5_crypt (busy)... failed.\nStopping early crypto disks...sda5_crypt (busy)... failed.\nRun Code Online (Sandbox Code Playgroud)\n\n分区:
\n\nsda5\n\xe2\x94\x94\xe2\x94\x80sda5_crypt\n \xe2\x94\x9c\xe2\x94\x80vg-root\n \xe2\x94\x9c\xe2\x94\x80vg-var\n \xe2\x94\x9c\xe2\x94\x80vg-swap_1\n \xe2\x94\x9c\xe2\x94\x80vg-tmp\n \xe2\x94\x9c\xe2\x94\x80vg-home\nRun Code Online (Sandbox Code Playgroud)\n\n修改脚本 ( /lib/cryptsetup/cryptodisks.functions) 后,我知道 LVM 卷仍然处于活动状态,并且我认为它会阻止 cryptsetup 关闭分区。如果我dmsetup remove_all在 cryptsetup 关闭分区之前添加,大多数 LVM 卷都会被删除,但 vg-root 仍然存在,因此它会再次失败。
我将如何在 ArchLinux 中使用Systemdlike rc.localin在启动时运行命令Sysv?
sysvinit ×5
systemd ×2
arch-linux ×1
bash ×1
chroot ×1
debian ×1
devuan ×1
init-script ×1
lvm ×1
openrc ×1
unix ×1
upstart ×1
virtualbox ×1