私のkea-dhcp4-serverは私のpostgresqlデータベースに依存しています。再起動後、DHCP サーバーで次のエラーが発生します。 sudo systemctl status kea-dhcp4-server
× kea-dhcp4-server.service - Kea IPv4 DHCP daemon
Loaded: loaded (/lib/systemd/system/kea-dhcp4-server.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/kea-dhcp4-server.service.d
└─override.conf
Active: failed (Result: exit-code) since Sun 2024-02-11 17:09:18 UTC; 11min ago
Docs: man:kea-dhcp4(8)
Process: 1104 ExecStart=/usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf (code=exited, status=1/FAILURE)
Main PID: 1104 (code=exited, status=1/FAILURE)
CPU: 39ms
Feb 11 17:09:18 ns1 systemd[1]: Started Kea IPv4 DHCP daemon.
Feb 11 17:09:18 ns1 kea-dhcp4[1104]: 2024-02-11 17:09:18.166 ERROR [kea-dhcp4.dhcp4/1104.140666424032896] DHCP4_CONFIG_LOAD_FAIL configuration error using file: /etc/kea/kea-dhcp4.conf, reason: Unable to open database: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection>
Feb 11 17:09:18 ns1 kea-dhcp4[1104]: Is the server running on that host and accepting TCP/IP connections?
Feb 11 17:09:18 ns1 kea-dhcp4[1104]: 2024-02-11 17:09:18.166 ERROR [kea-dhcp4.dhcp4/1104.140666424032896] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/etc/kea/kea-dhcp4.conf': Unable to open database: connection to server at "localhost" (127.0.0.1), port 5432>
Feb 11 17:09:18 ns1 kea-dhcp4[1104]: Is the server running on that host and accepting TCP/IP connections?
Feb 11 17:09:18 ns1 systemd[1]: kea-dhcp4-server.service: Main process exited, code=exited, status=1/FAILURE
Feb 11 17:09:18 ns1 systemd[1]: kea-dhcp4-server.service: Failed with result 'exit-code'.
したがって、Postgresqlデータベースが後で開始されたか、まだ準備されていないようです。注:このkea-dhcp4-severサービスを手動で開始すると、すべてがうまく機能します。 kea-dhcp4-server.serviceを編集するときは、次のようにさまざまなオプションを試しました。 sudo systemctl edit kea-dhcp4-server
Wants =、After =、およびRequires =を試しましたが、すべて成功しませんでした。 たぶんPostgres <==ネットワーク==> Dhcpサーバー間の循環依存関係もありますか? 私の質問は:Ubuntu 22.04で起動中にpostgresqlデータベースが準備されるまでkea-dhcp4-serverを待つようにするにはどうすればよいですか?
bashスクリプトをサービスにしたのは今回が初めてで、Java引数のテキストファイル(user_jvm_args.txt)を開くことができなかったため、サービスが失敗したというエラーが発生しました。ある種の権限問題があると思いますが、迷っています。より良くなって学びようと努力すれば何でも役に立ちます。ありがとうございます! サービスファイルは次のとおりです。 [Service]
ExecStart=/home/ethan/ATM9-Server/run.sh
run.sh bashスクリプトは次のとおりです。 #!/usr/bin/env sh
java @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.20.1-47.1.3/unix_args.txt "$@"
以下は、run.shスクリプトと同じフォルダーにあるuser_jvm_args.txtファイルです。 # Xmx and Xms set the maximum and minimum RAM usage, respectively.
# They can take any number, followed by an M or a G.
# M means Megabyte, G means Gigabyte.
# For example, to set the maximum to 3GB: -Xmx3G
# To set the minimum to 2.5GB: -Xms2500M
# A good default for a modded server is 4GB.
-Xms1G
-Xmx10G
-XX:+UseG1GC
-XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=200
-XX:+UnlockExperimentalVMOptions
-XX:+DisableExplicitGC
-XX:+AlwaysPreTouch
-XX:G1NewSizePercent=30
-XX:G1MaxNewSizePercent=40
-XX:G1HeapRegionSize=8M
-XX:G1ReservePercent=20
-XX:G1HeapWastePercent=5
-XX:G1MixedGCCountTarget=4
-XX:InitiatingHeapOccupancyPercent=15
-XX:G1MixedGCLiveThresholdPercent=90
-XX:G1RSetUpdatingPauseTimePercent=5
-XX:SurvivorRatio=32
-XX:+PerfDisableSharedMem
-XX:MaxTenuringThreshold=1
ほとんどはデフォルトで、私が変更したのは-Xmsと-Xmxだけです。 ログに示すように発生したエラーは次のとおりです。 Nov 03 15:44:43 ATM9-Server-Temp systemd[1]: Started run.service.
Nov 03 15:44:43 ATM9-Server-Temp run.sh[12480]: Error: could not open `user_jvm_args.txt'
Nov 03 15:44:43 ATM9-Server-Temp systemd[1]: run.service: Main process exited, code=exited, status=1/FAILURE
Nov 03 15:44:43 ATM9-Server-Temp systemd[1]: run.service: Failed with result 'exit-code'.
この設定を考慮すると: ---
version "3"
services:
wireguard:
image: "lscr.io/linuxserver/wireguard"
container_name: "wireguard"
cap_add:
- "NET_ADMIN"
environment:
PUID: "1000"
PGID: "1000"
TZ: "Europe/London"
ports:
- "8080:8080"
- "6881:6881"
- "6881:6881/udp"
volumes:
- "./wireguard/config:/config"
- "/lib/modules:/lib/modules"
sysctls:
- "net.ipv4.conf.all.src_valid_mark=1"
privileged: true
qbittorrent:
image: "lscr.io/linuxserver/qbittorrent"
container_name: "qbittorrent"
network_mode: "service:wireguard"
environment:
PUID: "1000"
PGID: "1000"
TZ: "Europe/London"
WEBUI_PORT: "8080"
volumes:
- "./qbittorrent/config:/config"
- "./qbittorrent/downloads:/downloads"
そのシステムサービスを起動および/または有効にできないのはなぜですか?私が実行したコマンドは次のとおりです。 sudo loginctl enable-linger myuser
podman-compose up -d
podman stop -a
podman generate systemd --new --files --name wireguard
podman generate systemd --new --files --name qbittorrent
podman system prune # pressed 'y'
mkdir -p $HOME/.config/systemd/user
sudo mv -v container-wireguard.service /etc/systemd/system/
mv -v container-qbittorrent.service $HOME/.config/systemd/user/
sudo systemctl daemon-reload
systemctl --user daemon-reload
sudo systemctl start container-wireguard.service
systemctl --user start container-qbittorrent.service
結果cat container-wireguard.service: # container-wireguard.service
# autogenerated by Podman 4.3.1
# Thu Sep 14 14:07:16 CEST 2023
[Unit]
Description=Podman container-wireguard.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm \
-f %t/%n.ctr-id
ExecStart=/usr/bin/podman run \
--cidfile=%t/%n.ctr-id \
--cgroups=no-conmon \
--rm \
--sdnotify=conmon \
--replace \
--name=wireguard \
-d \
--label io.podman.compose.config-hash=f7ac51a86e7d72fe8967478b47a2cd9a2e53d672610c3caa797afe25d62e2dfd \
--label io.podman.compose.project=torrent \
--label io.podman.compose.version=1.0.6 \
--label [email protected] \
--label com.docker.compose.project=torrent \
--label com.docker.compose.project.working_dir=/home/myuser/podman/torrent \
--label com.docker.compose.project.config_files=docker-compose.yml \
--label com.docker.compose.container-number=1 \
--label com.docker.compose.service=wireguard \
--cap-add NET_ADMIN \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/London \
-e ALLOWEDIPS=0.0.0.0/0 \
-e LOG_CONFS=True \
-v /home/myuser/podman/torrent/wireguard/config:/config:z \
-v /lib/modules:/lib/modules:z \
--net torrent_default \
--network-alias wireguard \
-p 8080:8080 \
-p 6881:6881 \
-p 6881:6881/udp \
--sysctl net.ipv4.conf.all.src_valid_mark=1 \
--privileged linuxserver/wireguard:latest
ExecStop=/usr/bin/podman stop \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm \
-f \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
結果sudo systemctl status container-wireguard.service: × container-wireguard.service - Podman container-wireguard.service
Loaded: loaded (/etc/systemd/system/container-wireguard.service; disabled; preset: enabled)
Active: failed (Result: exit-code) since Thu 2023-09-14 14:18:06 CEST; 26min ago
Docs: man:podman-generate-systemd(1)
Main PID: 4500 (code=exited, status=125)
CPU: 52ms
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Scheduled restart job, restart counter is at 5.
Sep 14 14:18:06 homeserver systemd[1]: Stopped container-wireguard.service - Podman container-wireguard.service.
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Start request repeated too quickly.
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Failed with result 'exit-code'.
Sep 14 14:18:06 homeserver systemd[1]: Failed to start container-wireguard.service - Podman container-wireguard.service.
結果journalctl -xeu container-wireguard.service: Sep 14 14:18:05 homeserver systemd[1]: Failed to start container-wireguard.service - Podman container-wireguard.service.
░░ Subject: A start job for unit container-wireguard.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit container-wireguard.service has finished with a failure.
░░
░░ The job identifier is 873 and the job result is failed.
Sep 14 14:18:05 homeserver systemd[1]: container-wireguard.service: Scheduled restart job, restart counter is at 3.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ Automatic restarting of the unit container-wireguard.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Sep 14 14:18:05 homeserver systemd[1]: Stopped container-wireguard.service - Podman container-wireguard.service.
░░ Subject: A stop job for unit container-wireguard.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A stop job for unit container-wireguard.service has finished.
░░
░░ The job identifier is 987 and the job result is done.
Sep 14 14:18:05 homeserver systemd[1]: Starting container-wireguard.service - Podman container-wireguard.service...
░░ Subject: A start job for unit container-wireguard.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit container-wireguard.service has begun execution.
░░
░░ The job identifier is 987.
Sep 14 14:18:05 homeserver podman[4458]: Error: unable to find network with name or ID torrent_default: network not found
Sep 14 14:18:05 homeserver systemd[1]: container-wireguard.service: Main process exited, code=exited, status=125/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit container-wireguard.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 125.
Sep 14 14:18:06 homeserver podman[4476]: Error: reading CIDFile: open /run/container-wireguard.service.ctr-id: no such file or directory
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Control process exited, code=exited, status=125/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStopPost= process belonging to unit container-wireguard.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 125.
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit container-wireguard.service has entered the 'failed' state with result 'exit-code'.
Sep 14 14:18:06 homeserver systemd[1]: Failed to start container-wireguard.service - Podman container-wireguard.service.
░░ Subject: A start job for unit container-wireguard.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit container-wireguard.service has finished with a failure.
░░
░░ The job identifier is 987 and the job result is failed.
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Scheduled restart job, restart counter is at 4.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ Automatic restarting of the unit container-wireguard.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Sep 14 14:18:06 homeserver systemd[1]: Stopped container-wireguard.service - Podman container-wireguard.service.
░░ Subject: A stop job for unit container-wireguard.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A stop job for unit container-wireguard.service has finished.
░░
░░ The job identifier is 1101 and the job result is done.
Sep 14 14:18:06 homeserver systemd[1]: Starting container-wireguard.service - Podman container-wireguard.service...
░░ Subject: A start job for unit container-wireguard.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit container-wireguard.service has begun execution.
░░
░░ The job identifier is 1101.
Sep 14 14:18:06 homeserver podman[4500]: Error: unable to find network with name or ID torrent_default: network not found
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Main process exited, code=exited, status=125/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit container-wireguard.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 125.
Sep 14 14:18:06 homeserver podman[4519]: Error: reading CIDFile: open /run/container-wireguard.service.ctr-id: no such file or directory
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Control process exited, code=exited, status=125/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStopPost= process belonging to unit container-wireguard.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 125.
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit container-wireguard.service has entered the 'failed' state with result 'exit-code'.
Sep 14 14:18:06 homeserver systemd[1]: Failed to start container-wireguard.service - Podman container-wireguard.service.
░░ Subject: A start job for unit container-wireguard.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit container-wireguard.service has finished with a failure.
░░
░░ The job identifier is 1101 and the job result is failed.
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Scheduled restart job, restart counter is at 5.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ Automatic restarting of the unit container-wireguard.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Sep 14 14:18:06 homeserver systemd[1]: Stopped container-wireguard.service - Podman container-wireguard.service.
░░ Subject: A stop job for unit container-wireguard.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A stop job for unit container-wireguard.service has finished.
░░
░░ The job identifier is 1215 and the job result is done.
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Start request repeated too quickly.
Sep 14 14:18:06 homeserver systemd[1]: container-wireguard.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit container-wireguard.service has entered the 'failed' state with result 'exit-code'.
Sep 14 14:18:06 homeserver systemd[1]: Failed to start container-wireguard.service - Podman container-wireguard.service.
░░ Subject: A start job for unit container-wireguard.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit container-wireguard.service has finished with a failure.
░░
░░ The job identifier is 1215 and the job result is failed.
結果podman ps -a: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
00b4f3b11446 docker.io/linuxserver/wireguard:latest 40 minutes ago Created 0.0.0.0:8080->8080/tcp, 0.0.0.0:6881->6881/tcp, 0.0.0.0:8083-8084->3000-3001/tcp, 0.0.0.0:6881->6881/udp wireguard
12d5c92f0c1e docker.io/linuxserver/qbittorrent:latest 40 minutes ago Created 0.0.0.0:8080->8080/tcp, 0.0.0.0:6881->6881/tcp, 0.0.0.0:8083-8084->3000-3001/tcp, 0.0.0.0:6881->6881/udp qbittorrent
結果podman network ls: ...
a11919c606c3 torrent_default bridge
どんな助けでも大変感謝します。
systemd-tmpfilesを使ってディレクトリを整理したいと思います。 私のUbuntu 22サーバーでmantmpfiles.d次の例が表示されます。 # Files created and modified, and directories accessed more than
# an hour ago in "/tmp/foo/bar", are subject to time-based cleanup.
d /tmp/foo/bar - - - - bmA:1h -
これをテンプレートとして使用して、次のクリーンアップ仕様を作成しました。 d /var/mytmp 1777 root root - bmA:1h -
ただし、次のコマンドを実行するとエラーが発生します。 systemd-tmpfiles --clean /etc/tmpfiles.d/tmp.conf
/etc/tmpfiles.d/tmp.conf:6: d lines don't take argument fields, ignoring.
マニュアルページに誤字があるようで仕様を次に変更しました。 d /var/mytmp 1777 root root bmA:1h
これはうまくいくようです。 その後、Debian 11.5(雄牛の目)を実行しているバナナパイで同じ行を試しましたが、次のような結果が得られました。 /etc/tmpfiles.d/tmp.conf:11: Invalid age 'bmA:30d'
tmpfiles.d のマニュアルページは Debian で少し異なって見えますが、年齢仕様は Ubuntu 22 のように特定の点で制限されていないようです. 目標を達成する年齢をどのように指定しますか?