How can I tell whether I am booted into the A or B partition? Android can install to an A or a B partition. This seems to be a default these days. How can I tell which one I am booted into using adb?
I am using LineageOS 17.1.
The right-most way (bootctl)
The command to provide this information is bootctl. As root (having run adb root), you can use this like this,
$ adb shell bootctl get-current-slot

Note this is the slot's number, you resolve that to the letter with,
$ adb shell 'bootctl get-suffix $(bootctl get-current-slot)'

See also: How can I boot to a specific partition with ADB?, which also uses bootctl
Using getvar
$ adb shell /bin/getprop ro.boot.slot_suffix
_b

Other ways
From /proc/bootloader_log
This command from adb shell
$ grep -i 'DEBUG: boot_' /proc/bootloader_log

Or like this,
adb shell &quot;grep -i 'DEBUG: boot_' /proc/bootloader_log&quot;

It return output like this,
avb_slot_verify.c:325: DEBUG: boot_b: Loading entire partition.

I believe that's in reference to the b partition that it's booting from.
From /proc/cmdline
You can also parse this out of /proc/cmdline
$ adb shell 'cat /proc/cmdline | tr &quot; &quot; &quot;\n&quot; | grep -i slot'
androidboot.slot_suffix=_b