rustdesk / rustdesk/rustdesk-server

### Issue: Persistent `disk I/O error` with `hbbs` Service

Open
#492 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
10.4k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Bug Description
System Information:
  • OS: Ubuntu 24.04.1 LTS (noble)
  • RustDesk Version: 1.1.12
  • Service: hbbs (RustDesk ID Server)
  • Database Location: /mnt/rustdesk-test/db_v2.sqlite3
Problem Description:

I have encountered a persistent disk I/O error when attempting to start the hbbs service. Despite extensive troubleshooting, the issue remains unresolved. The service fails with the following error message:

Error: An error occurred while creating a new object: error returned from database: disk I/O error
Steps Taken to Troubleshoot:
  1. Permissions and Ownership:

    • Verified and ensured correct permissions and ownership for the database file:
      sudo chmod 777 /mnt/rustdesk-test/db_v2.sqlite3
      sudo chown www-data:www-data /mnt/rustdesk-test/db_v2.sqlite3
      
  2. Write Access:

    • Tested write access to the database file as the www-data user:
      sudo -u www-data sqlite3 /mnt/rustdesk-test/db_v2.sqlite3 "CREATE TABLE test5 (id INTEGER PRIMARY KEY);"
      
  3. Filesystem Health:

    • Checked the filesystem for errors (unable to unmount root filesystem while system is running):
      sudo fsck -f /dev/sdd2
      
  4. AppArmor:

    • Disabled AppArmor to ensure it is not interfering with the service:
      sudo systemctl stop apparmor
      sudo systemctl disable apparmor
      sudo apt-get remove apparmor
      
  5. Service Configuration:

    • Updated the hbbs service to use the www-data user and pointed to the new database location:
      [Unit]
      Description=RustDesk ID Server
      After=network.target
      
      [Service]
      ExecStart=/usr/local/rustdesk-server/hbbs -r /mnt/rustdesk-test/db_v2.sqlite3
      Restart=always
      User=www-data
      Group=www-data
      WorkingDirectory=/usr/local/rustdesk-server
      StandardOutput=journal
      StandardError=journal
      
      [Install]
      WantedBy=multi-user.target
      
  6. Dependencies and Environment:

    • Ensured all required dependencies are installed:
      sudo apt-get install -y sqlite3 libsqlite3-dev
      
    • Verified the hbbs binary is not corrupted:
      md5sum /usr/local/rustdesk-server/hbbs
      
  7. Logs and Errors:

    • Monitored system logs and ensured no underlying disk errors:
      sudo dmesg | grep -i error
      sudo journalctl -xe
      
  8. Disk I/O Test:

    • Tested disk I/O operations to verify write operations:
      dd if=/dev/zero of=/mnt/rustdesk-test/testfile bs=1M count=1024 oflag=direct
      rm /mnt/rustdesk-test/testfile
      

Despite these efforts, the hbbs service continues to fail with the same disk I/O error. Any insights, suggestions, or guidance from the community would be greatly appreciated.

Thank you for your assistance!

How to Reproduce
How to Reproduce
  1. Setup the Environment:

    • Install Ubuntu 24.04.1 LTS (noble).
    • Ensure you have the RustDesk version 1.1.12 installed.
  2. Create the Database Directory:

    • Create a directory for the RustDesk database:
      sudo mkdir /mnt/rustdesk-test
      sudo chmod 777 /mnt/rustdesk-test
      sudo chown www-data:www-data /mnt/rustdesk-test
      
  3. Create the SQLite Database File:

    • Create a fresh SQLite database file in the directory:
      sudo sqlite3 /mnt/rustdesk-test/db_v2.sqlite3 "CREATE TABLE init (id INTEGER PRIMARY KEY);"
      sudo chown www-data:www-data /mnt/rustdesk-test/db_v2.sqlite3
      sudo chmod 777 /mnt/rustdesk-test/db_v2.sqlite3
      
  4. Configure the hbbs Service:

    • Create or edit the hbbs service file to use the new database location:

      sudo nano /etc/systemd/system/hbbs.service
      

      Ensure the ExecStart line is:

      [Unit]
      Description=RustDesk ID Server
      After=network.target
      
      [Service]
      ExecStart=/usr/local/rustdesk-server/hbbs -r /mnt/rustdesk-test/db_v2.sqlite3
      Restart=always
      User=www-data
      Group=www-data
      WorkingDirectory=/usr/local/rustdesk-server
      StandardOutput=journal
      StandardError=journal
      
      [Install]
      WantedBy=multi-user.target
      
  5. Restart the hbbs Service:

    • Reload systemd and start the hbbs service:
      sudo systemctl daemon-reload
      sudo systemctl start hbbs
      sudo systemctl status hbbs
      
  6. Monitor for Errors:

    • Check the logs for error messages:
      sudo journalctl -u hbbs -e
      

By following these steps, you should be able to reproduce the disk I/O error observed when starting the hbbs service.

Expected Behavior

Expected Behavior
The hbbs service should start successfully without encountering any errors. Specifically, it should be able to create new objects in the SQLite database located at /mnt/rustdesk-test/db_v2.sqlite3 without generating a disk I/O error. The service should run smoothly, allowing RustDesk to function correctly for managing connections and providing the necessary ID services.

Operating system(s) on local (controlling) side and remote (controlled) side

Ubuntu 24.04.1 LTS

RustDesk Version(s) on local (controlling) side and remote (controlled) side

1.1.12

Screenshots

N/A as operating in a console environment

Additional Context

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the hbbs service configuration and reproduce the failure using the documented SQLite path and service commands. Inspect the output from journalctl -u hbbs -e alongside the SQLite write test and the reported database error. Done means hbbs starts successfully and creates new objects in /mnt/rustdesk-test/db_v2.sqlite3 without the disk I/O error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite, ubuntu
Domain
backend, database, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.