I was trying to upload a sketch to my Arduino Nano that was 986 bytes,but it keeps saying that there is no serial port connected:
*Arduino: 1.8.19 (Linux), Board: "Arduino Nano, ATmega328P (Old Bootloader)"
Build options changed, rebuilding all Sketch uses 986 bytes (3%) of program storage space. Maximum is 30720 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes. Serial port not selected.
This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
What does lsusb say (before and after connecting the board)?
What does dmesg say after connecting the board?
You probably have a clone with the CH340 serial-to-usb converter. Linux might have decided to make your life miserable by thinking that it's a BRLTTY device; if so, uninstall BRLTTY.
Your topic has been moved to a category that is more suitable for board detection and upload problems.
Open a shell (command prompt)
Run lsusb without the board connected
$ lsusb
Bus 001 Device 007: ID 04d9:1503 Holtek Semiconductor, Inc. Keyboard
Bus 001 Device 006: ID 2341:8036 Arduino SA Leonardo (CDC ACM, HID)
Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 004: ID 0458:003a KYE Systems Corp. (Mouse Systems) NetScroll+ Mini Traveler / Genius NetScroll 120
Bus 001 Device 003: ID 2341:0042 Arduino SA Mega 2560 R3 (CDC ACM)
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Connect the board
$ lsusb
Bus 001 Device 009: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 007: ID 04d9:1503 Holtek Semiconductor, Inc. Keyboard
Bus 001 Device 006: ID 2341:8036 Arduino SA Leonardo (CDC ACM, HID)
Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 004: ID 0458:003a KYE Systems Corp. (Mouse Systems) NetScroll+ Mini Traveler / Genius NetScroll 120
Bus 001 Device 003: ID 2341:0042 Arduino SA Mega 2560 R3 (CDC ACM)
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Check the differences; in above the CH340 is the new device. Does it show?
Run dmesg; after you connected the board in the previous step, the output should look like
[ 696.289060] usb 1-5.4.4: new full-speed USB device number 10 using ehci-pci
[ 696.371351] usb 1-5.4.4: New USB device found, idVendor=1a86, idProduct=7523
[ 696.371358] usb 1-5.4.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 696.371362] usb 1-5.4.4: Product: USB2.0-Serial
[ 696.371975] ch341 1-5.4.4:1.0: ch341-uart converter detected
[ 696.373749] usb 1-5.4.4: ch341-uart converter now attached to ttyUSB0
If you see more, check what is different with the above (e.g. a mention of BRLTTY). You can show us the last 20 or 30 lines of the dmesg output.
After that, action depends on the Linux distro that you're using; if it's BRLTTY that causes the problem and you're using Ubuntu (or a distro derived from Ubuntu or Debian), uninstall it with sudo apt-get remove brltty.