Skip to content

Device code sometimes changes automatically in GDM #1121

@adombeck

Description

@adombeck

While executing the e2e tests locally, I've seen the "Test login with GDM" fail because the device code changed about 1 second after it was first shown.

Here are the relevant logs from the broker:

Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Creating new session ([email protected], lang=C, mode=a>
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Building new daemon
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Starting to serve requests
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Serving requests as com.ubuntu.authd.MSEntraID
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Created new session 08b9f91c-523a-4b98-9c7d-9814def6534c
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Getting authentication modes for session 08b9f91c-523a-4b98-9c7d-9814def6534c
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Token does not exist for user "[email protected]", so local pass>
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Got authentication modes for session 08b9f91c-523a-4b98-9c7d-9814def6534c: [map>
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Selecting authentication mode device_auth_qr for session 08b9f91c-523a-4b98-9c7>
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Retrieving device code...
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Selecting authentication mode device_auth_qr for session 08b9f91c-523a-4b98-9c7>
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Retrieving device code...
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Retrieved device code.
Nov 13 15:24:01 ubuntu authd-msentraid[1932]: Selected authentication mode device_auth_qr for session 08b9f91c-523a-4b98-9c7d>
Nov 13 15:24:02 ubuntu authd-msentraid[1932]: Handling IsAuthenticated call for session 08b9f91c-523a-4b98-9c7d-9814def6534c
Nov 13 15:24:02 ubuntu authd-msentraid[1932]: Device code expiry time: 2025-11-13 15:39:01.456753711 +0000 UTC
Nov 13 15:24:02 ubuntu authd-msentraid[1932]: Polling to exchange device code for token...
Nov 13 15:24:02 ubuntu authd-msentraid[1932]: Retrieved device code.
Nov 13 15:24:02 ubuntu authd-msentraid[1932]: Selected authentication mode device_auth_qr for session 08b9f91c-523a-4b98-9c7d>

It looks like SelectAuthenticationMode is called twice, which causes the device code to be retrieved twice, which causes it to be changed after ~1 second.

I spent a few minutes trying to figure out if anything the GDM model code of the PAM module could cause that, but the code is too convoluted for me to make sense of it.

I'll enable debug logs for the PAM module and attach them here if I see the issue again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions