Disclaimer: this is not necessarily a proper answer because it
involves indeterministic and rather sporadic approaches. That said,
thought it'd still be worth it to jot it down and share it for
informational purpose. :)
What didn't work for me:
✗ Using my newer Mac (2019/Big Sur) whose USB ports are USB-C/3.1.
✗ Trying out various USB 2.0 cables and adapters (USB-C/3.1 <-> USB-A/2.0, USB-A/3.0 <-> USB-A/2.0, etc.). More about that here (https://stackoverflow.com/a/58774581/2013891) and here (https://www.reddit.com/r/GooglePixel/comments/7lj50n/apparently_the_pixel_2_nonxl_doesnt_like_usb_3031/).
✗ Installing Linux (Ubuntu) on VirtualBox, or any virtual machines in this case.
✗ Getting RMA since I bought the phone secondhand on eBay [sic.] :D
What made it work for me:
➜ Praying. (yup seriously, this could be the most important pre-step that I forgot to do when failing continuously before ;) )
➜ Using my older Mac (2015/El Capitan) whose USB ports are USB-A/3.0.
fastboot getvar all. While it's saying
< waiting for any device >, plugging-in and -out again the Pixel 2 (assumed it is booted already to FastBoot mode) until all the vars are printed out in the console. Note that this step is like a game of chance to me. Depending on your luck, you may need to do it 100 times or even 1000 times while wiggling the cable, waiting for a little, and making a sudden plug-in/out over and over again. Your mileage may vary, hence the praying step. 🙏
➜ When the vars got printed, it means the hardware connection has been successfully established in the USB interface. Running
fastboot devices will list your Pixel 2 device. From this point on, it's business as usual -- I did the
./flash-all.sh thingy from https://developers.google.com/android/images#walleye.
Having all these messes, I still strongly believe a few Google phone/tablet hardwares are buggy when they come to establishing USB connection. Now, even after I managed to bring my Pixel 2 back to life, it's still not able create a USB connection to do a wired files transfer unless I do the "game of chance" mentioned above. Well, at least I got it working and it's becoming usable again.