From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <a.zeidler@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 3763795068
 for <pve-devel@lists.proxmox.com>; Thu, 11 Apr 2024 19:07:22 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 18EA735582
 for <pve-devel@lists.proxmox.com>; Thu, 11 Apr 2024 19:07:22 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Thu, 11 Apr 2024 19:07:20 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id ADBC044C47
 for <pve-devel@lists.proxmox.com>; Thu, 11 Apr 2024 19:07:20 +0200 (CEST)
Message-ID: <87d02c31eb31eb33bc42f96ae314e28bea8084fd.camel@proxmox.com>
From: Alexander Zeidler <a.zeidler@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>, Proxmox VE development
 discussion <pve-devel@lists.proxmox.com>
Date: Thu, 11 Apr 2024 19:07:12 +0200
In-Reply-To: <e1157bab-a281-4982-a2a3-98c97891e132@proxmox.com>
References: <20240322135933.164404-1-a.zeidler@proxmox.com>
 <e1157bab-a281-4982-a2a3-98c97891e132@proxmox.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.46.4-2 
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.103 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [report.pm]
Subject: Re: [pve-devel] [PATCH manager 1/9] report: add kernel command line
 including boot time
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 11 Apr 2024 17:07:22 -0000

On Mon, 2024-03-25 at 08:52 +0100, Thomas Lamprecht wrote:
> > > > On 22/03/2024 14:59, Alexander Zeidler wrote:
> > > > > > > > While using `/proc/cmdline` would already provide an initia=
l info for
> > > > > > > > debugging passthrough and similar, the use of `dmesg` is an=
 easy way
> > > > > > > > to get the boot date as an absolute value for free (additio=
nal to the
> > > > > > > > relative value in `uptime` from `top`).
> > > > > > > >=20
> > > > > > > > Signed-off-by: Alexander Zeidler <a.zeidler@proxmox.com>
> > > > > > > > ---
> > > > > > > > =C2=A0PVE/Report.pm | 1 +
> > > > > > > > =C2=A01 file changed, 1 insertion(+)
> > > > > > > >=20
> > > > > > > > diff --git a/PVE/Report.pm b/PVE/Report.pm
> > > > > > > > index 53ffdcbb..d4191769 100644
> > > > > > > > --- a/PVE/Report.pm
> > > > > > > > +++ b/PVE/Report.pm
> > > > > > > > @@ -31,6 +31,7 @@ my $init_report_cmds =3D sub {
> > > > > > > > =C2=A0	    cmds =3D> [
> > > > > > > > =C2=A0		'hostname',
> > > > > > > > =C2=A0		'date -R',
> > > > > > > > +		'dmesg -T | head | grep Command',
> > > >=20
> > > > Meh, I'd rather get the command line explicitly and the last boots

Alright!

> > > > using:
> > > >=20
> > > > journalctl --list-boots

On slow servers / storage drives this execution can easily take 10 seconds
or longer. But there is an alternative that is quite fast and even shows
the booted kernel version:

# last reboot -F -n10
reboot system boot 6.5.11-7-pve Thu Apr 11 16:31:24 2024 still running
reboot system boot 6.5.11-7-pve Thu Apr 11 16:29:17 2024 - Thu Apr 11 16:31=
:12 2024 (00:01)
reboot system boot 6.5.11-7-pve Thu Apr 11 16:25:41 2024 - Thu Apr 11 16:31=
:12 2024 (00:05)
...

Furthermore, as simulated and visible above, a duplicated "until" field
hints that the earlier system boot (16:25:41) crashed unexpectedly (sometim=
e
before the next boot at 16:29:17).

Limiting the output to 10 lines seems reasonable for most cases.

> > > >=20
> > > >=20
> > > > As here you get much more info, e.g. about (recent) frequent reboot=
s.
> > > >=20
> > > > Please remember to add this also to the PMG and PBS reports.=20
> > > >=20
> > > > > > > > =C2=A0		'pveversion --verbose',
> > > > > > > > =C2=A0		'cat /etc/hosts',
> > > > > > > > =C2=A0		'pvesubscription get',
> > > >=20