为什么我刚创建了 Ubuntu 云服务器后,journalctl 不起作用?

为什么我刚创建了 Ubuntu 云服务器后,journalctl 不起作用?

journalctlNo journal files were found在我刚刚创建云 Ubuntu 服务器并通过基于 Web 的控制台访问它后,响应为。

我已将控制台输出粘贴到下面

2023-06-18T03:56:23-root@ubuntu:~# journalctl -n 10

No journal files were found.

-- No entries --

2023-06-18T03:56:50-root@ubuntu:~# journalctl -k

No journal files were found.

-- No entries --

2023-06-18T03:56:56-root@ubuntu:~# journalctl -b

No journal files were found.

-- No entries --

所以我检查服务的状态:

2023-06-18T03:56:59-root@ubuntu:~# systemctl status journalctl

Unit journalctl.service could not be found.

2023-06-18T03:57:13-root@ubuntu:~# systemctl status systemd-journald.service

● systemd-journald.service - Journal Service

     Loaded: loaded (/lib/systemd/system/systemd-journald.service; static)

     Active: active (running) since Sun 2023-06-18 03:55:13 UTC; 2min 11s ago

TriggeredBy: ● systemd-journald.socket

             ● systemd-journald-audit.socket

             ● systemd-journald-dev-log.socket

       Docs: man:systemd-journald.service(8)

             man:journald.conf(5)

   Main PID: 374 (systemd-journal)

     Status: "Processing requests..."

      Tasks: 1 (limit: 9492)

     Memory: 3.9M

        CPU: 182ms

     CGroup: /system.slice/systemd-journald.service

             └─374 /lib/systemd/systemd-journald

我重新启动服务:

2023-06-18T03:57:47-root@ubuntu:~# systemctl restart systemd-journald.service

2023-06-18T03:58:12-root@ubuntu:~# systemctl status systemd-journald.service

● systemd-journald.service - Journal Service

     Loaded: loaded (/lib/systemd/system/systemd-journald.service; static)

     Active: active (running) since Sun 2023-06-18 03:58:02 UTC; 21s ago

TriggeredBy: ● systemd-journald.socket

             ● systemd-journald-audit.socket

             ● systemd-journald-dev-log.socket

       Docs: man:systemd-journald.service(8)

             man:journald.conf(5)

   Main PID: 7967 (systemd-journal)

     Status: "Processing requests..."

      Tasks: 1 (limit: 9492)

     Memory: 4.9M

        CPU: 16ms

     CGroup: /system.slice/systemd-journald.service

             └─7967 /lib/systemd/systemd-journald



Jun 18 03:58:02 ubuntu systemd-journald[7967]: Journal started

Jun 18 03:58:02 ubuntu systemd-journald[7967]: System Journal (/var/log/journal/09dac98d7851cdf1a9dadf62648e805e) is 8.0M, max 4.0G, 3.9G free.

Notice: journal has been rotated since unit was started, output may be incomplete.

2023-06-18T03:58:23-root@ubuntu:~# systemctl status journalctl

Unit journalctl.service could not be found.

我再次调用journalctl,这次它按预期工作了

2023-06-18T03:58:47-root@ubuntu:~# journalctl -n 10

Jun 18 03:58:02 ubuntu systemd[1]: Stopping Journal Service...

Jun 18 03:58:02 ubuntu systemd-journald[374]: Received SIGTERM from PID 1 (systemd).

Jun 18 03:58:02 ubuntu systemd[1]: systemd-journald.service: Deactivated successfully.

Jun 18 03:58:02 ubuntu systemd[1]: Stopped Journal Service.

Jun 18 03:58:02 ubuntu systemd[1]: Starting Journal Service...

Jun 18 03:58:02 ubuntu systemd-journald[7967]: Journal started

Jun 18 03:58:02 ubuntu systemd-journald[7967]: System Journal (/var/log/journal/09dac98d7851cdf1a9dadf62648e805e) is 8.0M, max 4.0G, 3.9G free.

Jun 18 03:58:02 ubuntu systemd[1]: Started Journal Service.

为什么会发生这种情况?

相关内容