ESP8266 and ESP32 with the Arduino IDE 2.x on Linux. Two separate things
have to be set up: serial port access (a group), and the board support
package (what people loosely call ’the ESP library’).

1. USB serial access - the group

The adapter shows up as a character device owned by root with a group:
ls -l /dev/ttyUSB0 -> crw-rw---- root uucp

Arch / Manjaro group: uucp (lp is also useful for printers)
Debian / Ubuntu group: dialout
Fedora / openSUSE group: dialout

Add yourself once, then LOG OUT and back in - a new group is only picked
up by a fresh login session, not by opening a new terminal:

    sudo usermod -aG uucp $USER        # Arch/Manjaro    sudo usermod -aG dialout $USER     # Debian/Ubuntu

Check what you actually have:
id -nG

Device names:
/dev/ttyUSB0 CH340, CP2102, FTDI - a separate USB-serial chip
/dev/ttyACM0 ESP32-S2 / S3 / C3 - native USB in the chip itself

No drivers to install: ch341, cp210x, ftdi_sio and cdc_acm are all part
of the Linux kernel. Vendor driver downloads are a Windows thing.

2. The trap: brltty steals CH340 adapters

Symptom: the port appears for a few seconds after plugging in, then
disappears, and the IDE’s port list goes empty again.

Cause: brltty (braille terminal support, pulled in as a dependency on
many desktops) ships a udev rule - 90-brltty-usb-customized.rules - that
claims USB IDs 1a86 (CH340), 10c4 (CP210x) and 0403 (FTDI), because some
braille displays use the same chips.

Confirm it with:

    dmesg -w        # plug the board in: ch341 attaches, then detaches

Fix (pick one):

    sudo systemctl mask 'brltty@*.service'    # keep the package, stop the grab    sudo pacman -Rns brltty                   # if you do not need braille

On Debian/Ubuntu the equivalent is: sudo apt remove brltty

A second, rarer thief is ModemManager, which probes new ttyACM devices.
If uploads fail intermittently on an S3/C3 board:
sudo systemctl disable --now ModemManager

3. Board support packages - ESP8266 and ESP32

File > Preferences > ‘Additional boards manager URLs’, one per line:

ESP8266: http://arduino.esp8266.com/stable/package_esp8266com_index.json
ESP32: https://espressif.github.io/arduino-esp32/package_esp32_index.json

Then Tools > Board > Boards Manager, search ’esp8266’ or ’esp32’, Install.
Recent IDE versions already list the Espressif ESP32 core in the default
index, so the second URL may be optional - it still gets you the newest.

Cores land in, one directory per vendor and version:

    ~/.arduino15/packages/esp8266/hardware/esp8266/<version>/    ~/.arduino15/packages/esp32/hardware/esp32/<version>/

Deleting a core by hand means deleting its directory there; the Boards
Manager is the cleaner route.

4. Sketch libraries - a different thing

Board package = the compiler, core and board definitions.
Library = code you #include in a sketch. They live in different places.

Sketch > Include Library > Manage Libraries installs into
~/Arduino/libraries/<LibraryName>/

Manual install of a ZIP from GitHub: unpack it so that the folder
directly contains the .h file or a src/ directory -
~/Arduino/libraries/ArduinoJson/src/…, not an extra nested level.
Rename the folder if GitHub appended ‘-master’. Restart the IDE after.

Libraries bundled with the IDE itself sit in ~/.arduino15/libraries and
should be left alone.

5. Same thing from the command line (arduino-cli)

    arduino-cli config add board_manager.additional_urls         http://arduino.esp8266.com/stable/package_esp8266com_index.json    arduino-cli core update-index    arduino-cli core install esp8266:esp8266    arduino-cli core install esp32:esp32    arduino-cli board list                 # shows the detected port    arduino-cli lib install ArduinoJson

Compile and upload a sketch directory:

    arduino-cli compile --fqbn esp8266:esp8266:d1_mini MySketch/    arduino-cli upload -p /dev/ttyUSB0 --fqbn esp8266:esp8266:d1_mini MySketch/

6. Board settings that usually matter

Wemos/LOLIN D1 mini -> board ‘LOLIN(WEMOS) D1 R2 & mini’,
flash size 4MB (FS 2MB), upload 115200
NodeMCU -> ‘NodeMCU 1.0 (ESP-12E Module)’
Generic ESP32 -> ‘ESP32 Dev Module’, upload 115200 (up to 921600)

7. Quick checklist when the port will not appear

  1. id -nG - am I in uucp / dialout? (log out after adding)
  2. dmesg -w - does the kernel see ch341/cp210x/cdc_acm at all?
  3. ls -l /dev/ttyUSB* /dev/ttyACM* - does the node exist, which group?
  4. is brltty masked? does the node vanish after a few seconds?
  5. try another cable - charge-only USB cables are the classic waste of
    an evening; they power the board, so its LED lights, but carry no data.