Linux SIGBUSHigh

Bus Error in Linux: Causes and Fixes

A Bus Error occurs due to incorrect access to physical memory. This article covers causes—from hardware issues to code errors—and provides proven solutions for Linux systems.

Updated at February 16, 2026
15-30 minutes
Medium
FixPedia Team
Применимо к:Ubuntu 22.04+CentOS 8+Debian 11+Raspberry Pi OS

What a Bus Error Means

Bus Error (signal SIGBUS) is an error sent by the system to a process when it attempts invalid access to physical memory. Unlike a Segmentation Fault (SIGSEGV), which relates to virtual addressing, SIGBUS typically indicates:

  • Alignment violations (e.g., attempting to read a 4-byte value from a misaligned address on some architectures, such as SPARC or older ARM).
  • Hardware failures — issues with RAM, the bus, or the processor.
  • Data corruption during I/O (e.g., an error reading from a disk into a memory-mapped file).
  • Errors in drivers or the kernel leading to incorrect memory mapping.

A typical log message (dmesg or system journal):

[12345.678] myapp[1234]: unaligned access to address 0x7fffdcba
[12345.679] myapp[1234]: Bus error (core dumped)

Or in the terminal:

Bus error (core dumped)

The error often manifests in high-load systems, on Raspberry Pi, when working with memory-mapped files (mmap), or when using low-level operations (e.g., direct access to /dev/mem).


Common Causes

  1. Incorrect Data Alignment
    The program attempts to access data at an address not aligned to the size of the data type (e.g., a 4-byte int at address 0x1001). On some architectures (SPARC, Alpha, ARM in certain modes), this triggers SIGBUS.
  2. Faulty RAM
    Issues with RAM modules, overheating, or incompatibility often lead to bus errors during read/write operations.
  3. Disk or File System Problems
    Bad sectors on the disk, file system errors (e.g., after a sudden power loss) can cause a memory-mapped file to contain invalid data.
  4. Hardware Driver or Kernel Bugs
    A driver crash (e.g., graphics or network) might incorrectly set up memory page tables, causing SIGBUS on access.
  5. CPU Overheating or Unstable Overclocks
    On Raspberry Pi and other single-board computers, overheating or an unstable overclock frequently causes bus errors.
  6. Misuse of System Calls
    For example, passing an invalid pointer or length to read()/write() for a memory-mapped file that was truncated by another process.

Solution 1: Test and Replace RAM

Hardware RAM issues are the most common cause of SIGBUS on Linux servers and workstations.

  1. Boot into memtest86+
    Reboot the system and select memtest86+ from the bootloader menu (GRUB). If it's not present, install it:
    sudo apt update && sudo apt install memtest86+
    

    Or for RHEL/CentOS:
    sudo yum install memtest86+
    
  2. Run the Test
    Memtest will start automatically. Let it run for at least 4 full passes (this may take several hours). Any errors (red lines) indicate a faulty RAM stick.
  3. If Errors Are Found
    • Power off the computer and unplug the power cable.
    • Remove all RAM modules, clean the contacts with isopropyl alcohol.
    • Install modules one by one, testing each slot and stick.
    • Replace any faulty modules.
  4. Check for Overheating
    Use sensors (install lm-sensors):
    sensors
    

    RAM temperature (if supported) should not exceed 85–90°C.

Solution 2: Update System and Kernel

Outdated drivers or a kernel with bugs can cause SIGBUS, especially with newer hardware.

  1. Update All Packages
    For Ubuntu/Debian:
    sudo apt update && sudo apt full-upgrade
    

    For CentOS/RHEL 8+:
    sudo dnf update
    

    For Raspberry Pi OS:
    sudo apt update && sudo apt full-upgrade
    
  2. Install the Latest Kernel
    On Ubuntu:
    sudo apt install linux-generic-hwe-22.04
    

    On CentOS:
    sudo dnf install kernel
    

    Reboot after installation.
  3. Check Kernel Version
    uname -r
    

    Ensure a recent version is in use (e.g., 5.15.0-78-generic or newer).
  4. If the Problem Persists After an Update
    Boot into the previous kernel from the GRUB menu (Advanced options) and check if the error disappears. If it does, the new kernel is likely the issue—report the bug to your distribution's bug tracker.

Solution 3: Diagnose Disk and File System

Read errors from disk into a memory-mapped file (mmap) are a common cause of SIGBUS.

  1. Check Disk SMART Status
    Install smartmontools:
    sudo apt install smartmontools  # Debian/Ubuntu
    sudo dnf install smartmontools  # RHEL/CentOS
    

    Check disk /dev/sda:
    sudo smartctl -a /dev/sda
    

    Look for SMART overall-health self-assessment test result: PASSED and attributes like Reallocated_Sector_Ct, Current_Pending_Sector. Non-zero values indicate wear.
  2. Run a SMART Test
    sudo smartctl -t long /dev/sda
    

    After it completes (may take hours), view results:
    sudo smartctl -a /dev/sda | grep -A5 " SMART"
    
  3. Check the File System
    For unmounted partitions:
    sudo fsck -f /dev/sda1
    

    For ext4, add -c to scan for bad blocks:
    sudo fsck -fcc /dev/sda1
    

    Warning: Do not run fsck on a mounted root partition. Use a LiveCD or boot into rescue mode.
  4. Verify Integrity of Memory-Mapped Files
    If the error occurs in a specific application (e.g., a database), check its data files:
    # For PostgreSQL
    sudo -u postgres pg_checksums -D /var/lib/postgresql/14/main
    # For MySQL
    sudo mysqlcheck -u root -p --all-databases --auto-repair
    

Solution 4: Debug the Problematic Application

If the error only occurs in one program, the issue is likely in its code.

  1. Run the Program Under Valgrind
    Valgrind detects memory access errors:
    valgrind --tool=memcheck ./your_program
    

    Look for Invalid address or Misaligned address messages.
  2. Use GDB to Analyze the Core Dump
    If the program dumps a core file (usually core or core.<pid> in the current directory):
    gdb ./your_program core
    

    Inside GDB:
    (gdb) bt
    (gdb) info registers
    

    These commands show the call stack and the address that caused SIGBUS.
  3. Check Alignment in Code
    If you are the developer, ensure:
    • Data structures are properly aligned (alignas in C++, __attribute__((aligned)) in C).
    • Aligned-access functions are used (e.g., memcpy instead of direct pointer copying when alignment is uncertain).
    • There is no access beyond array bounds.
  4. Try Compiling with Sanitizer Flags
    Add to your CFLAGS:
    -fsanitize=address,undefined -fno-omit-frame-pointer
    

    This helps catch errors at compile/run time.

Prevention

  1. Regularly Test RAM
    Run memtest86+ quarterly, especially after hardware changes or after overheating incidents.
  2. Monitor Temperatures
    Install lm-sensors and psensor. On Raspberry Pi, use vcgencmd measure_temp.
  3. Use Stable Overclocks
    On Raspberry Pi and other SBCs, avoid aggressive overclocking. Verify stability with stress tests (stress-ng).
  4. Update Firmware
    For Raspberry Pi:
    sudo rpi-eeprom-update -a
    

    For servers—update BIOS/UEFI and CPU microcode (intel-microcode or amd-microcode).
  5. Handle Memory-Mapped Files Correctly
    In your code:
    • Always check mmap results for MAP_FAILED.
    • Ensure the file size doesn't change due to another process during mapping.
    • Use msync to synchronize changes.
  6. Choose Quality Components
    When building a system, prefer ECC memory (for servers) and certified disks. For Raspberry Pi, use the official power supply and a high-quality SD card (Class 10/UHS-I).
  7. Set Up Monitoring
    Add a filter for SIGBUS in syslog:
    sudo grep -i "bus error" /var/log/syslog
    

    Configure alerts (e.g., via logwatch or fail2ban) for recurring errors.

F.A.Q.

How does Bus Error differ from Segmentation Fault?
Can Bus Error be fixed without rebooting the system?
Why does Bus Error often occur on Raspberry Pi?

Hints

Check RAM
Update system and kernel
Check hard drives and filesystem
Debug the problematic application
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community