# Bug OP-12518 - Upgrade migration error "smtp_openssl_verify_mode is not writable"

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-12518

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 12.5.6 |
| Observed in versions |  |
| Sprint | 12.5.6 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Upgrade package install from 12.0.10 to 12.5.4 using the usual commands for Debian/Ubuntu as described in the [Upgrade Documentation](https://www.openproject.org/docs/installation-and-operations/operation/upgrading/).
2.  Run `sudo openproject configure` to finish the upgrade process.

### What is the buggy behavior?

  - When the `sudo openproject configure` command gets to the `[openproject] ./bin/postinstall` step an error is thrown that reads:

<!-- end list -->

``` text
INFO -- : Migrating to RestoreDefaultsOnEmptySettings (20220428071221)
== 20220428071221 RestoreDefaultsOnEmptySettings: migrating ===================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

smtp_openssl_verify_mode is not writable but can be set through env vars or configuration.yml file.
```

### What is the expected behavior?

1.  After a Packaged installation upgrade, `sudo openproject configure` command runs, completing the required migrations without error.

### **Logs**

``` text
[openproject] ./bin/postinstall
I, [2023-05-06T13:23:41.869085 #49231]  INFO -- : Migrating to RestoreDefaultsOnEmptySettings (20220428071221)
== 20220428071221 RestoreDefaultsOnEmptySettings: migrating ===================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

smtp_openssl_verify_mode is not writable but can be set through env vars or configuration.yml file.
/opt/openproject/app/models/setting.rb:175:in `set_value!'
/opt/openproject/app/models/setting.rb:170:in `value='
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/persistence.rb:756:in `public_send'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/persistence.rb:756:in `update_attribute'
/opt/openproject/db/migrate/20220428071221_restore_defaults_on_empty_settings.rb:15:in `block in up'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:71:in `each'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:71:in `block in find_each'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:245:in `block in in_batches'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:229:in `loop'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:229:in `in_batches'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:137:in `find_in_batches'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:70:in `find_each'
/opt/openproject/db/migrate/20220428071221_restore_defaults_on_empty_settings.rb:5:in `up'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:873:in `public_send'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:873:in `exec_migration'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:854:in `block (2 levels) in migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:853:in `block in migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:852:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1046:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1360:in `block in execute_migration_in_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/transactions.rb:209:in `transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1411:in `ddl_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1359:in `execute_migration_in_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1333:in `each'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1333:in `migrate_without_lock'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1282:in `block in migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1432:in `block in with_advisory_lock'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1447:in `with_advisory_lock_connection'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1428:in `with_advisory_lock'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1282:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1117:in `up'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1092:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/tasks/database_tasks.rb:262:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/railties/databases.rake:92:in `block (2 levels) in <top (required)>'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/opt/openproject/bin/bundle:110:in `load'
/opt/openproject/bin/bundle:110:in `<main>'

Caused by:
NoMethodError: smtp_openssl_verify_mode is not writable but can be set through env vars or configuration.yml file.
/opt/openproject/app/models/setting.rb:175:in `set_value!'
/opt/openproject/app/models/setting.rb:170:in `value='
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/persistence.rb:756:in `public_send'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/persistence.rb:756:in `update_attribute'
/opt/openproject/db/migrate/20220428071221_restore_defaults_on_empty_settings.rb:15:in `block in up'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:71:in `each'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:71:in `block in find_each'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:245:in `block in in_batches'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:229:in `loop'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:229:in `in_batches'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:137:in `find_in_batches'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/relation/batches.rb:70:in `find_each'
/opt/openproject/db/migrate/20220428071221_restore_defaults_on_empty_settings.rb:5:in `up'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:873:in `public_send'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:873:in `exec_migration'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:854:in `block (2 levels) in migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:853:in `block in migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:852:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1046:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1360:in `block in execute_migration_in_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/transactions.rb:209:in `transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1411:in `ddl_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1359:in `execute_migration_in_transaction'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1333:in `each'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1333:in `migrate_without_lock'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1282:in `block in migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1432:in `block in with_advisory_lock'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1447:in `with_advisory_lock_connection'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1428:in `with_advisory_lock'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1282:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1117:in `up'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/migration.rb:1092:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/tasks/database_tasks.rb:262:in `migrate'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/railties/databases.rake:92:in `block (2 levels) in <top (required)>'
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/opt/openproject/bin/bundle:110:in `load'
/opt/openproject/bin/bundle:110:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
```

### Environment information

**OpenProject installation type**

- [ ] Hosted cloud edition
- [x] Packaged installation
    - Debian / Ubuntu
- [ ] Docker All-in-one container
- [ ] Docker-compose installation
- [ ] Other (please specify)

**OpenProject version**

Upgrade from 12.0.10 to 12.5.4.

**Browser**

- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Mobile Safari
- [ ] Other (please specify) - Not Applicable

**Language**

(Not Applicable)
