From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exZqx-0000YX-4Z for guix-patches@gnu.org; Sun, 18 Mar 2018 11:04:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1exZqs-0000rS-6j for guix-patches@gnu.org; Sun, 18 Mar 2018 11:04:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:60608) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1exZqs-0000qs-37 for guix-patches@gnu.org; Sun, 18 Mar 2018 11:04:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1exZqr-0007c3-Kl for guix-patches@gnu.org; Sun, 18 Mar 2018 11:04:01 -0400 Subject: [bug#30604] Keyboard detection before =?UTF-8?Q?=E2=80=98cryptsetup=E2=80=99?= runs In-Reply-To: <20180225114557.816-1-dannym@scratchpost.org> Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87h8plkkkc.fsf@gnu.org> <20180312221541.1886-1-ludo@gnu.org> <20180312221541.1886-5-ludo@gnu.org> <87fu54fjfj.fsf@gnu.org> Date: Sun, 18 Mar 2018 16:03:06 +0100 Message-ID: <87o9jlo28l.fsf@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30604@debbugs.gnu.org Hi Danny, ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Something annoying is that my external USB keyboard doesn=E2=80=99t work = while > in the initrd (when I type my passphrase). I can see that it=E2=80=99s d= etected > early on, before I type my passphrase: While experimenting with this on the bare metal, it became clear that it=E2=80=99s a timing issue: the keyboard is detected right after the crypt= setup is displayed, so =E2=80=98load-needed-linux-modules=E2=80=99 didn=E2=80=99t= have a chance to load the relevant modules. Similarly, if I boot with =E2=80=98--repl=E2=80=99, and I manually type (load-needed-linux-modules =E2=80=A6) from there, then the keyboard=E2=80= =99s module gets loaded as expected. That=E2=80=99s because the device showed up in the meantime and the kernel created a /sys entry for it. In essence, we want a mini-udev and something akin to =E2=80=9Cudevadm sett= le=E2=80=9D. Merely calling =E2=80=98load-needed-linux-modules=E2=80=99 once isn=E2=80= =99t enough. One way to do that would be to have a separate thread that calls =E2=80=98load-needed-linux-modules=E2=80=99 as appropriate. Ideally it wou= ld use inotify on /sys like udev does, but a poor programmer=E2=80=99s version cou= ld simply call =E2=80=98load-needed-linux-modules=E2=80=99 every half a second= or so. Alternately, before passing control to user code (pre-mount actions, etc.), we could do a =E2=80=9Csettle=E2=80=9D kind of thing: call =E2=80=98load-linux-modules-from-directory=E2=80=99 every 0.5 seconds until= its result is the same as before. There=E2=80=99s still a risk of missing devices, and those devices will never show up later because nobody=E2=80=99s monitoring = /sys. But then again, =E2=80=9Cudevadm settle=E2=80=9D must have the same problem= : it can=E2=80=99t really know whether things have settled, I guess. WDYT? Thanks, Ludo=E2=80=99.