From nobody Wed Nov 27 16:42:24 2024 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xz4x853Zfz5fS7X for ; Wed, 27 Nov 2024 16:42:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xz4x83BD5z4pRs for ; Wed, 27 Nov 2024 16:42:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-212348d391cso67235965ad.2 for ; Wed, 27 Nov 2024 08:42:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1732725755; x=1733330555; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=oryuTcTcPkAHhK2rrMu3cNzsLCcYWAP/XPF7dIuKt7k=; b=dcA1FwCudFoL3S29Lx0dKdcB5F4jMzCSUs417HXpVhSifKaWZlwMdL2W4k+O5fmRr5 Grs7aWGBgCCETqLRMm7E2iFd0Wk5lczmAQkeaeTOjGjr7SAbct8xszapUPc6Lgyvpfhp nKA6Mf02QwkHOJloNOzzvfVolVUA/pRu6NgqVKknSfjoyJsyLQcurGtMql2BbcxWjoj6 B1gt6BNvXl4FIeCihM/SiyuomCg/ukOLEfZ3A0s6+2Y57XJLdDmn+XoBTRhFLGDjfeX7 gAqLagUJLWS83i3QWF+LTsutMQkojDOQOXQjy4gzRJYkC2z+tvIkpkeb0Dw0vvz8bFjU a2uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732725755; x=1733330555; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oryuTcTcPkAHhK2rrMu3cNzsLCcYWAP/XPF7dIuKt7k=; b=bt3zjce06nkyEhXPmEdhz6/WpKN/Jok0Xzb1xdG6Y+PLlmZ7+VqVNSNX6aRSKM9Zm9 QdWyKe9OePlW/11j8gwPXJNP+RClEUpxDAq9j34yG3fO07oi86Gx80j70p7CYvqeHTtK DnHR4yZ0Q71yPB7C+QB2KE33xxMVEo/pTsdykleGb24fORlGGUSGl5TNrr0u/9O4jFvu L7tnwYL6IgtkyKVt5NknztnLY1GWA8En6IFQs/g9GKDcDo7W0bR8TwNL1AqrBO77yqw7 hV+1V1eWyv0Mhy2cb29EkFNC6vOeJGd9qGJ8G+qYG3hzpiyEoplsfYduYnJ2pjxNdkNB Iuyw== X-Forwarded-Encrypted: i=1; AJvYcCUtnJMX6ej6jDgbEYIsAiZQKcJ/rvOQjA+mj6+w2vb7WKawGlNasqBmMvQaAaLdoI3nz5posY8=@freebsd.org X-Gm-Message-State: AOJu0Yw4RkM9dzNx5rAvaWaeeUiHaikdQrE357H/AydibcFj4WSzMuCG 3sUE7L8W8Emo7+jKh9Ktlv8wwY3+mwJT9fgccttlh5r5dta4+HSG2XbemtD5LGrYtLAFoW156Bb vIVHS0p/CvMhoHZYosQeoetwCCo7M/VqJB7rcQA== X-Gm-Gg: ASbGncuC8b1GN1/yZP+z0fidpc8nBRCqlUjBE55YY85XFiuJfK4vRHJNqDxBKPZQcXz zU/tzJ9xZZbdwJwGHyu3LMRqOK4H9FiM= X-Google-Smtp-Source: AGHT+IHW0KfSHAH9PrRV8BcFFo0JN4yqZCyvFZj1jynxOAeFuGPNkH5o7hmYUS+27fUxRCGxnp7VcCmYCOyQojNXT7Q= X-Received: by 2002:a17:903:228d:b0:211:e66d:7450 with SMTP id d9443c01a7336-21501a44af6mr46594175ad.32.1732725755041; Wed, 27 Nov 2024 08:42:35 -0800 (PST) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-stable@freebsd.org Sender: owner-freebsd-stable@FreeBSD.org MIME-Version: 1.0 References: <365D866D-F7D2-4DB6-AFFB-B4C3829D8467@cs.huji.ac.il> In-Reply-To: <365D866D-F7D2-4DB6-AFFB-B4C3829D8467@cs.huji.ac.il> From: Warner Losh Date: Wed, 27 Nov 2024 09:42:24 -0700 Message-ID: Subject: Re: not working /dev/console To: Daniel Braniss Cc: Kurt Jaeger , Freebsd-stable List Content-Type: multipart/alternative; boundary="0000000000001f79400627e7a77f" X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4Xz4x83BD5z4pRs X-Spamd-Bar: ---- --0000000000001f79400627e7a77f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 27, 2024 at 3:48=E2=80=AFAM Daniel Braniss wrote: > > > On 27 Nov 2024, at 11:42, Warner Losh wrote: > > > > On Wed, Nov 27, 2024, 2:12=E2=80=AFAM Daniel Braniss wrote: > >> >> >> > On 27 Nov 2024, at 10:45, Kurt Jaeger wrote: >> > >> > Hi! >> > >> >> when the console is not uart0, init=E2=80=99s output, which I assume = uses >> /dev/console >> >> is lost. Boot, kernel and login work ok, also debugger. >> >> >> >> so, is there a way to configure /dev/console to uart1? >> > >> > I made some notes, and they point, among other things, to: >> > >> > https://reviews.freebsd.org/D36286 >> > >> > kenv | grep cons >> > boot_multicons=3D"YES" >> > comconsole_pcidev=3D"" >> > comconsole_port=3D"1016" >> > comconsole_speed=3D"115200" >> > console=3D"comconsole" >> > hw.uart.console=3D"io:1016,br:115200" >> > >> > So probably it can be configured, but I've never tried it. >> >> done that, that=E2=80=99s how I get most of the messages - forgot to men= tion >> i=E2=80=99m using SOL/ipmi to get the console, >> it=E2=80=99s the annoying init=E2=80=99s output that is missing, so I ha= ve to guess >> why it=E2=80=99s not going multiuser :-( >> > > BIOS or UEFI? > > UEFI. > the hosts in question are Dell 7xx, and bios/pxeboot no longer works > Hmmm, it should still work. I cleaned out the extra junk in the BIOS boot loader so it should fit again and my simple tests worked.... But, the tl;dr is likely just adding 'boot_serial=3DYES' and the "hw.uart.console" line above to /loader.conf and deleting all the comconsole lines (since the= y will result in doubled output if the console really is redirected at the UEFI level, see below for more details on all this :_ The too long to read is: So, if you have UEFI, then comconsole won't do anything. Ignore all the advice that says to set it. That won't help. That's really only for BIOS and UEFI that does *NOT* have console redirection. Also, ignore the advice about setting the flags. That's ignored when you have hw.uart.console set anyway. It's th= e old SIO way of doing things that uart only ever partially emulated. You need to set "hw.uart.console" to select the proper console. If it really is COM1, then hw.uart.console=3D"io:1016,br:115200" will work (it is also the default). Sadly, we do not have an ACPI parser in the loader, so we can't set this automatically by default. But, if by some chance you're wrong about the port, the following is what I recommend (if you are right, you'll have ttyu0 below). After the system boots, you'll have a login banner: FreeBSD/amd64 (dune.bsdimp.com) (ttyu1) login: The 'uX' is the part you're interested in. That says which port is really connected to the redirect. Once you see that, you can find its resources with devinfo -r: ... uart1 Interrupt request lines: 0x3 I/O ports: 0x2f8-0x2ff ... So for my case, you'd need to add hw.uart.console=3D"io:0x2f8,br:115200" in your /boot/loader.conf. If you can't easily get to the console, for whatever reason (usually it's a bad baud rate that's been set, but not always), you can find the right thing to use another way: % sudo efivar --device-path 8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOut 8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOut : PciRoot(0x2)/Pci(0x1,0x2)/Pci(0x0,0x0)/Pci(0x0,0x0)/AcpiAdr(0x80010100),/Pc= iRoot(0x0)/Pci(0x14,0x3)/Serial(0x2)/Uart(115200,8,N,1)/UartFlowCtrl(Hardwa= re)/VenVt100Plus() Here you see that I have a setup where I have video and serial for the mulit-cons (when the redirect is active, we automatically pick that up, so boot_mulit isn't really needed= ) The serial port is "Serial(0x2)" which means that the _UID of the serial port is 2. You'd then find that with devinfo -v: devinfo -v | grep uart uart0 pnpinfo _HID=3DPNP0501 _UID=3D1 _CID=3Dnone at handle=3D\_SB_.PCI0.SBRG.UAR1 uart1 pnpinfo _HID=3DPNP0501 _UID=3D2 _CID=3Dnone at handle=3D\_SB_.PCI0.SBRG.UAR2 And again you'd see that it's uart1. The _UID is just an arbitrary number (technically it could be a string, but other standards only have room for a number so I've only ever seen numbers here). I have other systems that number UID from 0 and have seen one super weird one that has the UID numbers 42 and 2112 for its two serial ports (Must have been a Douglas Adams and Rush fan). If you get only the kernel messages on the serial port, but not the results of /etc/rc and then see a login prompt, you'll likely find something like: Dual Console: Video Primary, Serial Secondary in your dmesg. We currently don't support two physical devices connected to /dev/console, so the primary one wins. You can make the serial console primary by adding "boot_serial=3DYES" to /boot/loader.conf. That still give= s you both serial and video, but makes the serial port primary so you see all the /etc/rc boot messages there. dmesg will contain: Dual Console: Serial Primary, Video Secondary after you do this. conscontrol(8) will list what's configured and what's available, though has it's own quirks that likely need to be documented better. For example 'uart' is would be the console here, and it would obey hw.uart.console tuneable. The primary is also listed first here. Warner > > Warner > > thanks, >> danny >> >> >> >> > >> > -- >> > pi@FreeBSD.org +49 171 3101372 Now what ? > > > --0000000000001f79400627e7a77f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Nov 27, 2024 at 3:48=E2=80=AF= AM Daniel Braniss <danny@cs.huji.= ac.il> wrote:


On 27 Nov 2024, at 11:42, Warner Losh <imp@bsdimp.com> wrote:

<= div>


=
On Wed, Nov 27, 2024, 2:12=E2=80=AFAM= Daniel Braniss <danny@cs.huji.ac.il> wrote:


> On 27 Nov 2024, at 10:45, Kurt Jaeger <= ;pi@= freebsd.org> wrote:
>=C2=A0
> Hi!
>=C2=A0
>> when the console is not uart0, init=E2=80=99s= output, which I assume uses /dev/console
>> is lost. Boot, kernel= and login work ok, also debugger.
>>=C2=A0
>&g= t; so, is there a way to configure /dev/console to uart1?
>=C2= =A0
> I made some notes, and they point, among other things, t= o:
>=C2=A0
>=C2=A0https://reviews.freebsd.org/D36286
>=C2=A0
> = kenv | grep cons
> boot_multicons=3D"YES"
> comconsol= e_pcidev=3D""
> comconsole_port=3D"1016"
> = comconsole_speed=3D"115200"
> console=3D"comconsole&qu= ot;
> hw.uart.console=3D"io:1016,br:115200"
>= =C2=A0
> So probably it can be configured, but I've never = tried it.

done that, that=E2=80=99s how I get most of the messages -= forgot to mention
i=E2=80=99m using SOL/ipmi to get the console,= =C2=A0
it=E2=80=99s the annoying init=E2=80=99s output that is mi= ssing, so I have to guess
why it=E2=80=99s not going multiuser :-(

BIOS o= r UEFI?
UEFI.
the hosts in question= are Dell 7xx, and bios/pxeboot no longer works

Hmmm, it should still work. I cleaned out the extra junk i= n the BIOS boot loader
so it should fit again and my simple tests= worked....

But, the tl;dr is likely just adding &= #39;boot_serial=3DYES' and the "hw.uart.console"
li= ne above to /loader.conf and deleting all the comconsole lines (since they<= /div>
will result in doubled output if the console really is redirected= at the UEFI
level, see below for more details on all this :_

The too long to read is:

So,= if you have UEFI, then comconsole won't do anything. Ignore all the ad= vice
that says to set it. That won't help. That's really = only for BIOS and UEFI that
does *NOT* have console redirection. = Also, ignore the advice about setting
the flags. That's ignor= ed when you have hw.uart.console set anyway. It's the
old SIO= way of doing things that uart only ever partially emulated.

=
You need to set "hw.uart.console" to select the proper= console. If it really is=C2=A0
COM1, then
hw.uart.cons= ole=3D"io:1016,br:115200"
will work (it is also the def= ault). Sadly, we do not have an ACPI parser in
the loader, so we = can't set this automatically by default. But, if by
some chan= ce you're wrong about the port, the following is what I
recom= mend (if you are right, you'll have ttyu0 below).

<= div>After the system boots, you'll have a login banner:

<= /div>
FreeBSD/amd64 (dune.bsdimp.com= ) (ttyu1)
login:

The 'uX' is the pa= rt you're interested in. That says which port is really
conne= cted to the redirect. Once you see that, you can find its resources
with devinfo -r:
...
=C2=A0 =C2=A0 uart1
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 Interrupt request lines:
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 0x3
=C2=A0 =C2=A0 =C2=A0 =C2=A0 I/O ports:
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x2f8-0x2ff
...

=
So for my case, you'd need to add
hw.uart.console= =3D"io:0x2f8,br:115200"
in your /boot/loader.conf.

If you can't easily get to the console, for whatev= er reason (usually it's a bad
baud rate that's been set, = but not always), you can find the right thing to use
another way:=

% sudo efivar --device-path 8be4df61-93ca-11d2-aa= 0d-00e098032b8c-ConOut
8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOut
: = PciRoot(0x2)/Pci(0x1,0x2)/Pci(0x0,0x0)/Pci(0x0,0x0)/AcpiAdr(0x80010100),/Pc= iRoot(0x0)/Pci(0x14,0x3)/Serial(0x2)/Uart(115200,8,N,1)/UartFlowCtrl(Hardwa= re)/VenVt100Plus()

Here you see that I have a setu= p where I have video and serial for the mulit-cons=C2=A0(when the redirect<= /div>
is active, we automatically pick that up, so boot_mulit isn't= really needed)

The serial port is "Serial(0x= 2)" which means that the _UID of the serial port is 2. You'd
=
then find that with devinfo -v:

=C2=A0devinfo= -v | grep uart
=C2=A0 =C2=A0 uart0 pnpinfo _HID=3DPNP0501 _UID=3D1 _CID= =3Dnone at handle=3D\_SB_.PCI0.SBRG.UAR1
=C2=A0 =C2=A0 uart1 pnpinfo _HI= D=3DPNP0501 _UID=3D2 _CID=3Dnone at handle=3D\_SB_.PCI0.SBRG.UAR2

And again you'd see that it's uart1. The _UID is ju= st an arbitrary number (technically it could
be a string, but oth= er standards only have room for a number so I've only ever seen numbers=
here). I have other systems that number UID from 0 and have seen= one super weird one
that has the UID numbers 42 and 2112 for its= two serial ports (Must have been a Douglas
Adams and Rush fan).<= /div>

If you get only the kernel messages on the serial = port, but not the results of
/etc/rc and then see a login prompt,= you'll likely find something like:
=C2=A0 =C2=A0 Dual Consol= e: Video Primary, Serial Secondary
in your dmesg. We currently do= n't support two physical devices connected
to /dev/console, s= o the primary one wins. You can make the serial console
primary b= y adding "boot_serial=3DYES" to /boot/loader.conf. That still giv= es
you both serial and video, but makes the serial port primary s= o you see
all the /etc/rc boot messages there. dmesg will contain= :
=C2=A0 =C2=A0=C2=A0Dual Console: Serial Primary, Video Secondar= y
after you do this.

conscontrol(8) will= list what's configured and what's available, though has it's
own quirks that likely need to be documented better. For example &= #39;uart' is
would be the console here, and it would obey hw.= uart.console tuneable. The
primary is also listed first here.

Warner


=

Warner

thanks,
=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0= danny



>=C2=A0
> --=C2=A0<= br>>=C2=A0pi@FreeBSD.org=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+49 171 3101372=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Now what ?

<= /div>
--0000000000001f79400627e7a77f--