Detecting Image Using Image Detection Tool
Linux system image detection tool
Before importing a custom image to Baidu AI Cloud, use the image detection tool bd_diagnosis to check import compatibility. This helps ensure the quality of custom images, thus enabling smooth deployment of fully functional and well-compatible instances. This document will introduce how to use the bd_diagnosis tool to detect custom images.
Introduction to bd_diagnosis tool
bd_diagnosis is a Linux system image detection tool provided by Baidu AI Cloud, used to scan system and service configurations in images and generate detection reports. This report describes image details and any exceptions detected.
The FreeBSD system is currently not supported.
Operation steps
- Log in to the target server using the
rootaccount. - Run the following commands sequentially to download and unzip the
bd_diagnosistool.
1wget https://wanjuan-docs.bj.bcebos.com/bd_diagnosis.tar.gz
2tar xf bd_diagnosis.tar.gz
Alternatively, you can download the bd_diagnosis tool via browser.
- Execute the following command to run the detection tool
1cd bd_diagnosis
2./main
The detection tool primarily checks the following ConfigMap:
| Item | Level | Description | Recommendations |
|---|---|---|---|
| virtio driver | High | Verify if the virtio driver is installed. Instance operations require support from appropriate virtual device drivers. If these drivers are not installed, it may result in instance startup issues. | Install virtio. |
| cloud-init | High | Confirm whether cloud-init is installed. Cloud-init dynamically completes system initialization during startup, including hostname and SSH keys configuration, and executes scripts from instance custom data (user data). Without it, the system initialization configuration will be incomplete. | Install Cloud-init. |
| fstab config | High | Ensure that the disk attachment information in the image's /etc/fstab file is correctly configured. Incorrect configurations, such as missing device information or device UUID errors, may lead to system startup issues. | None |
| grub | High | Check if the grub boot file in the image is functioning properly. Device configuration issues, missing devices, or UUID errors may cause system startup problems. | None |
| root | High | Verify the existence of the root user in the system. If the root user is missing, management permissions will be restricted, increasing security risks. | You can modify the root user configuration in /etc/passwd to: root:x:0:0:root:/root:/bin/bash |
| sshd service | High | Inspect the configuration file for the sshd service (commonly located at /etc/ssh/sshd_config) to ensure it is functioning correctly. If issues exist, the instance's SSH connection will fail. | None |
| passwd command | High | Check the existence and read-write permission of /etc/shadow and /etc/passwd files . Without read-write permission, operations like instance password modification will be invalid. |
You can restore read-write permissions for the files by executing chmod +rw /etc/shadow /etc/passwd as the root user. |
| DHCP | High | Verify whether the network configuration is set to DHCP. If the image is configured for static mode, it may result in network configuration issues after the instance starts up. | Set the network to DHCP mode for dynamic IP address allocation and clear the 70-persistent-net.rules file. |
| disk size | High | Check whether the disk size in the system exceeds 500GB. Baidu AI Cloud supports up to 500GB system disks. Your disk partition size should not exceed 500GB. Otherwise, the import will fail. |
None |
| disk partition | High | Check whether system disk partition type is correct. BCC instances started in BIOS mode use MBR disk partitioning. EBC instances typically starts in UEFI mode where GPT disk partition is used, but will cause startup failure because it is incompatible with the system. |
None |
| file system type | High | Check the type of file system in use. It is recommended to use ext2, ext3, or ext4 file systems, as other types may cause system stability issues. | None |
| selinux | Medium | Ensure SELinux is disabled, as enabling it might cause system startup problems. | SELinux must be disabled. |
| Firewall | Medium | Check whether the firewall service is active. It is recommended to disable the firewall service and instead use security groups to manage ingress and egress traffic for cloud server instances. Enabling the system firewall may result in access issues. | Disable the firewall service. |
| LVM | Medium | Inspect the usage and configuration of LVM disk partitions. Using LVM can lead to mounting failures, which may prevent access to the root disk partition container. Its use is not recommended. | None |
| disk uuid | Medium | Check whether the Linux system root disk partition is attached via UUID. When the root disk partition is mounted by device name, name changes during system startup will cause failure to locate the root file system and result in startup failure. It is recommended to attach the root partition via UUID. |
You can run the blkid command to retrieve the disk partition UUID and replace the partition identifier in /etc/fstab with the UUID. |
| mlx5 driver | Medium | Verify if the Mellanox network interface card driver is installed. If not, instance types relying on Mellanox network interface cards (like bcc.ga2, bcc.ica2, bcc.ma2, bcc.la2, etc.) cannot be utilized. | If your image application instance specifications depend on this network interface card driver, please install the Mellanox network interface card driver. |
| Kernel config | Medium | Verify the kernel configuration on the Linux system to ensure critical features (such as hardware hot-plugging) are enabled. Disabling these features does not impact instance operation, but the system will be unable to support kernel functionalities like hardware hot-plugging. For example, for instances in the g4/c4/ic4/m4 families, a reboot will be required for online resizing operations to take effect. | The exception does not affect instance operation and can be configured as needed after image import. |
| halt | Medium | Check if halt is properly configured. Shutting down an EBC instance depends on this functionality. If the image is being used to create EBC instances, it is recommended to configure halt. | The exception does not affect instance startup and can be configured as needed after image import. |
| SshPort | Low | Ensure that port 22 is enabled. If port 22 is disabled, operations like login and data transfer will not be possible through this port. | The exception does not affect instance startup and can be configured as needed after image import. |
| online resize fs | Low | Determine whether the image supports automatic expansion of the root disk partition. For instance, if the virtual disk size of your image is 10 GB and the purchased instance system disk is 200 GB, tools like cloud-init and growpart will automatically expand the root disk partition and file system to utilize the full 200 GB during instance initialization. | The exception does not affect instance operation and can be configured as needed after import. |
| graphic | Low | Verify whether the Ubuntu system has graphical desktop functionalities enabled. When using Ubuntu for EBC instances, it is advised not to enable the graphical desktop, as this could potentially lead to sleep mode and subsequently cause SSH login failures. | For EBC instances, it is recommended to disable the graphical desktop. |
| bsm agent | Medium | Check for the installation of bsm-agent. This agent streamlines the automatic management of BCC and BBC instances. Installing bsm-agent is advisable. | The exception does not affect instance startup, but disables cloud assistant and operation orchestration service capabilities. If required, after image import and instance creation, install bsm-agent. |
| bcm agent | Medium | Confirm whether bcm-agent is installed. BCM-Agent functions as a client-side data collection tool, gathering and transmitting critical monitoring information, enabling users to proactively assess system conditions. Installing bcm-agent is recommended. | The exception does not affect instance startup, but makes the instance cannot monitor metric data. If required, after image import and instance creation, install bcm-agent. |
| has agent | Medium | Check whether has-agent is installed. This agent facilitates real-time monitoring of hardware component health and reports any anomalies, aiding operation personnel in diagnosing and resolving hardware issues quickly. Installing has-agent is suggested for hardware monitoring purposes. | The exception does not affect instance startup, but may delay the detection of EBC Instance hardware failures. If required, after image import and instance creation, install has-agent. |
| hosteye | Medium | Verify if the Hosteye client is installed. Hosteye, the host security monitoring tool, extends monitoring and security measures at the user service level, offering robust host security with high stability and lightweight deployment. Installing the Hosteye client along with relevant rule settings is recommended for enhanced protection. | The exception does not affect instance startup, but reduces cloud security protection. If required, after image import and instance creation, install hosteye. |
Once the detection tool completes its analysis, it will return results similar to the following information.

Based on the severity level of each item, the detection tool will return results labeled OK, CRITICAL, or WARNING.
Detection result description
- OK: All detection items are compliant with the requirements.
- CRITICAL: It is highly recommended to fix these items. Instances created with the custom image may encounter critical issues like failure to startup, network exception. It is recommended to fix these errors before importing the image.
- WARNING: It is recommended to optimize these items.It does not affect the startup of instances created with this custom image, but causes incapability in automated operation of cloud assistant. You may ignore error messages and proceed with image import, but it is recommended to optimize it after creating instance with imported image as needed to enhance the operation efficiency on the cloud server.
Windows system image detection tool
Detection items are as follows:
| Item | Description | Suggestion |
|---|---|---|
| VirtIO drivers | Baidu AI Cloud supports KVM virtual technology. To import an image into Baidu AI Cloud, KVM virtio drivers must be installed | For instructions on how to install virtio drivers for your system, please refer to Install VirtIO Drivers |
| Disk partition type | Baidu AI Cloud BCC supports MBR disk partition type by default | None |
| Disk Size | BCC supports a maximum 2TB system disk | None |
| cloudbase-init | It is recommended to install cloudbase-init for configuring hostname, passwords, etc. | For instructions on how to install cloudbase-init for the system, please refer to Install cloudbase-init |
| MLNX_WinOF2 network driver | For Windows Server 2016, 2019 and 2022, it is recommended to installMLNX_WinOF2 network interface card driver; for some specifications, such as bcc.ga2, bcc.ica2, bcc.ma2 and bcc.la2, it is required to install this network interface card to identify the network device | For instructions on how to install MLNX_WinOF2 driver, please refer to Install MLNX_WinOF2 Driver |
Download the detection tool check-windows.ps1 to your system, open a PowerShell window, and execute the script:

