Keywords: Raspberry PI, config.txt not found, monitor, HDMI hotplug, HDMI_force_hotplug

If mobile access is poor, go to the — > GithubPage version

Quick preview:

  1. config.txtThe path is usually/boot/config.txtIf you can’t find it, it may be/boot/firmware/config.txt. Can not find again, refer to the article [find config. TXT] train of thought to find.
  2. Add the following two lines to config. TXT and restart raspberry PI to enable HDMI hot swap
hdmi_force_hotplug=1
hdmi_drive=2
Copy the code

0x00: Questions and background

The newly arrived Raspberry PI 4B is equipped with Ubuntu system with desktop. In the early stage, for convenience, the display is connected externally through HDMI cable for easy configuration of the system. However, after the configuration is complete and the monitor is unplugged, a problem is found: after restarting the Raspberry PI, if there is no external monitor, the system cannot be normally entered. The HDMI detection mechanism is located as a problem, and the system can be normally started only when the monitor is plugged in by default.

To access data, you need to turn on the PI’s HDMI hot plug without relying on an external monitor. So we need to:

  1. Find the config file config.txt
  2. Change the config. TXT

0x01: Locate config.txt

There are two types of methods for modifying config. TXT

  1. Take out SD card, read SD card content on other computers, findconfig.txtmodified
  2. Modify it directly in the raspberry PI’s internal running system

Here’s method 2:

Generally, the config. TXT directory is /boot/config. TXT. If the directory cannot be found, check the disk partition to find the directory where the boot partition resides.

$ fdisk -lDevice Boot Start End Sectors Size Id Type /dev/mmcblk0p1 * 2048 526335 524288 256M c W95 FAT32 (LBA) /dev/mmcblk0p2 526336 124735454 124209119 52.2g 83 Linux See two partitions: - /dev/mmcblk0p1 (boot partition) - /dev/mmcblk0p2
$ dfFilesystem 1K-blocks Used Available Use% Mounted on /dev/mmcblk0p1 258095 113997 144099 45% /boot/firmware /dev/mmcblk0p2 61862116 11804636 47472868 20% / visible - /dev/mmcblk0p2 mount to / - / dev/mmcblk0p1 mounted to/boot/firmware directory So, config. TXT not under the/boot /, should be under the/boot/firmware, namely the/boot/firmware/config. TXTCopy the code

0x02: Modify config.txt

Add the following 2 lines to config.txt and restart raspberry PI

hdmi_force_hotplug=1
hdmi_drive=2
Copy the code
  • hdmi_force_hotplug=1Set raspberry PI to use HDMI hot plug mode even if no HDMI monitor is detected.
  • hdmi_drive=2Set the raspberry PI to normal HDMI mode (sound will be sent if supported and enabled). Without this line, the Raspberry PI will switch to DVI (no audio) mode by default.

References:

  • How do I force the Raspberry Pi to turn on HDMI?
  • This section describes parameters in the raspberry PI configuration file config. TXT
  • Initial configuration of raspberry PI 4 system
  • Raspberry Pi: Forced HDMI hot swap

If you have any suggestions or questions, please feel free to contact me to discuss and learn together:

  • Making: likfe
  • CSDN: He calls himself Mr. Zhang
  • The Denver nuggets: cafeting
  • Weibo: cafeting