Foreman-rake failed ActiveRecord::SubclassNotFound: ‘Setting::General’

Problem:
Hi,
for several weeks I have this problem on foreman, when I modify a value from the settings page.

production.log say:

2022-08-29T10:28:46 [I|app|a3eb8d22] Backtrace for 'Action failed' error (ActiveRecord::SubclassNotFound): The single-table inheritance mechanism failed to locate the subclass: 'Setting::General'. This error is raised because the column 'category' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Setting.inheritance_column to use another column for that information.

the solution to solve this problem is:

foreman-rake db:migrate:down VERSION=20210929132645 
foreman-rake db:migrate:down VERSION=20210915132645
foreman-rake db:migrate
foreman-rake db:seed

the problem comes back every day, any ideas ?

Foreman and Proxy versions:
foreman-3.2.1-1.el8.noarch
foreman-proxy-3.2.1-1.el8.noarch

Foreman and Proxy plugin versions:
foreman-tasks 6.0.1
foreman_ansible 7.1.0
foreman_discovery 20.0.1
formean_hooks 0.3.17
foreman_puppet 3.0.6
foreman_remote_execution 6.0.0
puppetdb_foreman 5.0.0
Distribution and version:

Other relevant data:

it looks like something is renaming the Setting category to Setting::General:

254 | fix_db_cache                 |                                          | Fix DB cache on next Foreman restart                                                                                              
                   | Setting::General | boolean       | --- false                        +| 2022-06-20 20:30:06.039069 | 2022-06-20 20:30:06.039069 | Fix DB cache                    | f
     |                              |                                          |                                                                                                                                   
                   |                  |               | ...                               |                            |                            |                                 | 
 185 | instance_id                  | --- c949d0fa-e728-4a08-8312-9a75e10141d5+| Foreman instance ID, uniquely identifies this Foreman instance.                                                                   
                   | Setting::General | string        | --- uuid                         +| 2020-04-01 08:59:22.141654 | 2020-04-01 08:59:22.141654 | Foreman UUID                    | f
     |                              | ...                                      |                                                                                                                                   
                   |                  |               | ...                               |                            |                            |                                 | 
 206 | instance_title               |                                          | The instance title is shown on the top navigation bar (requires reload of page).                                                  
                   | Setting::General |               | ---                              +| 2021-03-02 11:08:58.573032 | 2021-03-02 11:08:58.573032 | Instance title                  | f
     |                              |                                          |                                                                                                                                   
                   |                  |               | ...                               |                            |                            |                                 | 
  24 | entries_per_page             | --- 20                                  +| Number of records shown per page in Foreman                                                                                       
                   | Setting::General | integer       | --- 20                           +| 2017-05-15 13:56:18.106837 | 2019-02-18 15:16:31.303122 | Entries per page                | f
     |                              | ...                                      |                                                                                                                                   
                   |                  |               | ...                              +|                            |                            |                                 | 
     |                              |                                          |                                                                                                                                   
                   |                  |               |                                   |                            |                            |                                 | 
  30 | login_text                   | --- Version $VERSION                    +| Text to be shown in the login-page footer                                                                                         
                   | Setting::General |               | ---                              +| 2017-05-15 13:56:18.16537  | 2022-08-30 08:22:33.970061 | Login page footer text          | f
     |                              | ...                                      |                                                                                                                                   
                   |                  |               | ...                              +|                            |                            |                                 | 
     |                              |                                          |                                                                                                                                   
                   |                  |               |                                   |                            |                            |                                 | 
  31 | host_power_status            |                                          | Show power status on host index page. This feature calls to compute resource providers which may lead to decreased performance on 
host listing page. | Setting::General | boolean       | --- true                         +| 2017-05-15 13:56:18.173826 | 2017-05-15 13:56:18.173826 | Show host power status          | f
     |                              |                                          |                                                                                                                                   
                   |                  |               | ...                              +|                            |                            |                                 | 
     |                              |                                          |                                                                                                                                   
                   |                  |               |                                   |                            |                            |                                 | 
 135 | http_proxy                   |                                          | Sets a proxy for all outgoing HTTP connections from Foreman. System-wide proxies must be configured at operating system level.    
                   | Setting::General |               | ---                              +| 2018-04-23 14:06:55.694936 | 2020-11-25 12:13:03.562416 | HTTP(S) proxy                   | f
     |                              |                                          |                                                                                                                                   
                   |                  |               | ...                               |                            |                            |                                 | 
 136 | http_proxy_except_list       |                                          | Set hostnames to which requests are not to be proxied. Requests to the local host are excluded by default.                        
                   | Setting::General | array         | --- []                            | 2018-04-23 14:06:55.700076 | 2019-01-24 11:31:33.178747 | HTTP(S) proxy except hosts      | f
 137 | lab_features                 |                                          | Whether or not to show a menu to access experimental lab features (requires reload of page)                                       
                   | Setting::General | boolean       | --- false                        +| 2018-04-23 14:06:55.704158 | 2018-04-23 14:06:55.704158 | Show Experimental Labs          | f
     |                              |                                          |                                                                                                                                   
                   |                  |               | ...                               |                            |                            |                                 | 
 182 | default_locale               |                                          | Language to use for new users                                                                                                     
                   | Setting::General |               | ---                              +| 2020-04-01 08:40:02.909481 | 2020-04-01 08:40:02.909481 | Default language                | f
     |                              |                                          |                                                                                                                                   
                   |                  |               | ...                               |                            |                            |                                 | 
 183 | default_timezone             | --- Paris                               +| Timezone to use for new users                                                                                                     
                   | Setting::General |               | ---                              +| 2020-04-01 08:40:02.920701 | 2021-12-31 12:44:30.100343 | Default timezone                | f
     |                              | ...                                      |                                                                                                                           

Setting::General was changed to Setting a while back.

Do you have correct versions of all plugins?

cc @ezr-ondrej

I’ve got no idea what might be happening, but it is safe to rename the category manually and try if that helped:

UPDATE settings SET category = "Setting" WHERE category = "Setting::General"

I had similar problems with upgrading foreman to 3.2.1 (Foreman 3.2.1 upgrade - The single-table inheritance mechanism failed to locate the subclass: 'Setting::Auth' - #2 by chr1s). In my case this was not only “Setting::General”, there were a lot more.

Perhaps some of the migrations did not work proberly? Also i noticed, that after correcting these values, something changed them back.

1 Like

I found my problem, I recently migrated from redhat 7 > alma 8 servers and I thought I stopped all services except the crontab, I turned off my servers.