この内容は古いバージョンです。最新バージョンを表示するには、戻るボタンを押してください。
バージョン:4
ページ更新者:爽健
更新日時:2026-06-11 07:10:02

タイトル: エラー一覧
SEOタイトル: Redmine よくあるエラー集と対処

この記事の要点
  • 500 Internal Server Error: log/production.log を見る → Ruby/Rails のスタックトレースで原因特定
  • Could not authenticate you: LDAP/OAuth 設定 / パスワードハッシュ / 2FA
  • Mail delivery failed: SMTP 設定 / DNS / SPF / 25 番ブロック
  • マイグレーション失敗: bundle exec rake db:migrate RAILS_ENV=production
  • プラグイン不一致: Redmine と Rails の対応バージョンを確認

はじめに: ログの場所

Redmine トラブル時に必ず最初に見るのがログです。

# Redmine 自身のログ
tail -f /var/lib/redmine/log/production.log
tail -f /var/www/redmine/log/production.log

# Web サーバ
tail -f /var/log/nginx/error.log
tail -f /var/log/apache2/error.log
tail -f /var/log/passenger/passenger.log

# システム
journalctl -u redmine -f
journalctl -u nginx -f
journalctl -u postgresql -f

# DB
tail -f /var/log/mysql/error.log
tail -f /var/log/postgresql/postgresql-*.log

500 Internal Server Error

最も頻発するエラー。ブラウザに「We're sorry, but something went wrong.」と出ます。

# 直近の500を確認
grep "FATAL" /var/lib/redmine/log/production.log | tail -20

# Ruby のスタックトレース例
F, [2024-01-01T12:34:56] FATAL -- :
ActionView::Template::Error (undefined method `name' for nil:NilClass):
  app/views/issues/show.html.erb:42:in `_app_views_issues_show'
  ...

# 原因はコード or データ不整合 → 該当 View / Controller を確認

典型的な原因

原因確認対処
マイグレーション未実行rake db:migrate:statusrake db:migrate
プラグイン互換性なしplugins/ 配下の READMEプラグイン削除 / アップデート
DB 接続失敗config/database.yml認証情報修正
メモリ不足 (OOM)dmesg | grep KilledSwap 追加 / unicorn worker 削減
files/ 書き込み権限不足ls -la files/chown / chmod 修正

Could not authenticate you(認証失敗)

You have been denied access.
または
Invalid user or password

原因と対処

  • パスワード違い: 管理者画面から再発行
  • LDAP / Active Directory 同期失敗: 接続テスト
  • 2 要素認証エラー: 管理者画面でリセット
  • セッションタイムアウト: config/configuration.ymlsession_lifetime 確認
  • API key 無効: ユーザー設定 → 「API アクセスキーを表示」で再発行
# 管理者パスワードを CLI からリセット
$ cd /var/lib/redmine
$ RAILS_ENV=production bundle exec rails runner \
    'u = User.find_by_login("admin"); u.password = "newpass"; \
     u.password_confirmation = "newpass"; u.save!'

# LDAP 設定の検証
$ ldapsearch -x -H ldap://ldap.example.com \
    -D "cn=admin,dc=example,dc=com" -w secret \
    -b "ou=users,dc=example,dc=com" "(uid=foo)"

Mail delivery failed(メール送信失敗)

log/production.log:
Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted)
または
Errno::ECONNREFUSED (Connection refused - connect(2) for "smtp.gmail.com":587)

SMTP 設定は config/configuration.yml にあります:

# config/configuration.yml
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: smtp.gmail.com
      port: 587
      domain: example.com
      authentication: :login
      user_name: notify@example.com
      password: "app_password_here"
      enable_starttls_auto: true
      openssl_verify_mode: 'peer'

切り分け手順

# 1. SMTP サーバ疎通確認
$ telnet smtp.gmail.com 587

# 2. 25 番ブロック確認(AWS / クラウド業者)
$ nc -zv smtp.gmail.com 25
# → クラウドは 25 ブロック → 587 / 465 を使う

# 3. SendGrid / SES 等を経由するなら認証情報を再確認
# 4. Gmail の場合「アプリパスワード」が必要(通常パスワード不可)
# 5. SPF / DKIM / DMARC の設定確認

# テスト送信
$ cd /var/lib/redmine
$ bundle exec rake redmine:email:test["test@example.com"] RAILS_ENV=production

マイグレーション失敗

# Redmine 本体 + プラグインのマイグレーション
$ cd /var/lib/redmine
$ bundle exec rake db:migrate RAILS_ENV=production
$ bundle exec rake redmine:plugins:migrate RAILS_ENV=production

# よくあるエラー
# 1. プラグインの DB スキーマと本体バージョン不一致
ActiveRecord::PendingMigrationError

# 2. 前回マイグレーションがロールバックされている
# → schema_migrations テーブルを確認

# 3. 解決
$ bundle exec rake db:migrate:status RAILS_ENV=production
$ bundle exec rake redmine:plugins:migrate NAME=plugin_name VERSION=0 \
    RAILS_ENV=production   # 該当プラグインを完全 rollback

プラグインの不一致

RedmineRailsRuby
5.1.x6.12.7 - 3.2
5.0.x6.12.7 - 3.0
4.2.x5.22.4 - 2.7
4.1.x5.22.3 - 2.6

プラグインの README に 「Compatible with Redmine X.X」 が書かれているので、必ず確認してから plugins/ に配置します。

# プラグイン無効化(一時的に外す)
$ cd /var/lib/redmine/plugins
$ mv suspicious_plugin /tmp/

$ touch tmp/restart.txt   # Passenger 再起動
# または systemctl restart redmine

# 起動できたら原因確定

データベース接続失敗

PG::ConnectionBad (could not connect to server: Connection refused)
Mysql2::Error::ConnectionError (Can't connect to MySQL server on 'localhost')

→ DB プロセス停止 / ファイアウォール / config/database.yml の host:port
# config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine_user
  password: "secret"
  encoding: utf8mb4
  port: 3306

メモリ不足 (OOM Killer)

# Linux カーネルが Ruby プロセスを殺している
$ dmesg | grep -i "killed process"
$ journalctl | grep "Out of memory"

# Passenger / Unicorn / Puma のワーカ数を減らす
# /etc/nginx/conf.d/redmine.conf
passenger_max_pool_size 4;
passenger_pool_idle_time 300;
passenger_max_request_queue_size 30;

# Swap 領域追加
$ sudo fallocate -l 2G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile

Ruby バージョン不一致

# Gemfile が要求するバージョンと現在の Ruby が違う
Bundler could not find compatible versions for ruby

# 確認
$ ruby -v
$ cat /var/lib/redmine/Gemfile | head -5

# rbenv / RVM で切替
$ rbenv install 3.2.2
$ rbenv local 3.2.2

# bundle 再実行
$ cd /var/lib/redmine
$ bundle install --without development test

SVN / Git リポジトリブラウザのエラー

  • 「Connection reset」: SVN / Git のバイナリが見つからない → which svn git
  • 「Permission denied」: www-data ユーザがリポジトリにアクセス不可 → chmod / chown
  • 大きすぎる Diff で 500: config/configuration.ymlrepositories_log_max_size 調整
  • Git の subdir 認識ミス: プロジェクト設定でリポジトリパス確認

FAQ

Q: production.log にエラーが何も書かれない
A: ログレベルが warn 以上になっている可能性。config/environments/production.rbconfig.log_level = :debug に変更し、Passenger 再起動。

Q: アップグレード後にエラー連発
A: 必ず事前バックアップを取り、db:migrate + plugins:migrate + cache:clear を順次実行。プラグインは1つずつ復活させて切り分け。

Q: 大量のチケットがあると遅い
A: SET statement_timeout(PostgreSQL)や Issue インデックス追加。プラグイン無効化、custom_field 数の見直しも有効。