canvas-lms icon indicating copy to clipboard operation
canvas-lms copied to clipboard

encryption key is incorrect. if you have intentionally changed it, you may want to run `rake db:reset_encryption_key_hash`

Open hitika26 opened this issue 2 years ago • 9 comments

Summary:

Hi, I have been working on hosting canvas lms on the Ubuntu server manually. I have been following the wiki page - Production Start. After resolving all the errors, I successfully executed all the steps. But when I opened the browser to access the application using IP address/ hostname, I got the below webpage: image

When I accessed the log file at path /var/log/apache2/error.log, I got the following error: Could not spawn process for application /var/canvas: The application encountered the following error: encryption key is incorrect. if you have intentionally changed it, you may want to run rake db:reset_encryption_key_hash (SystemExit)

I tried the following commands/ways to resolve this error:

  • bundle exec rake db:reset_encryption_key_hash
  • rake db:reset_encryption_key_hash
  • bundle exec rake db:migrate RAILS_ENV=production
  • rake db:migrate RAILS_ENV=production
  • bundle exec rake db:generate_security_key
  • Updated encryption key in security.yml file, removed the encryption key

Still, there was no luck, can anyone help me with this?

hitika26 avatar Apr 22 '23 17:04 hitika26

RAILS_ENV=production bundle exec rake db:reset_encryption_key_hash

huangdengpan avatar Apr 24 '23 02:04 huangdengpan

@hitika26 it look like issue of Redis, because redis store old data. You need remove all redis key by command: redis-cli flushall and restart nginx or apache again!

fchienvuhoang avatar Apr 28 '23 06:04 fchienvuhoang

I have what seems to be the same error:

encryption key is incorrect. if you have intentionally changed it, you may want to run `rake db:reset_encryption_key_hash`
App 70316 output: Error: The application encountered the following error: encryption key is incorrect. if you have intentionally changed it, you may want to run `rake db:reset_encryption_key_hash` (SystemExit)

I did this

RAILS_ENV=production bundle exec rake db:reset_encryption_key_hash

I may have misconfigured something and required sudo...

but it did not work for me.

fooeyround avatar Aug 13 '23 20:08 fooeyround

I also tried it without

RAILS_ENV=production

and without

bundle exec

fooeyround avatar Aug 13 '23 20:08 fooeyround

@hitika26 i have the same page , i even used sudo RAILS_ENV=production bundle exec rake db:reset_encryption_key_hash still its showing Psych::AliasesNotEnabled: Alias parsing was not enabled. To enable it, pass aliases: true to Psych::load or Psych::safe_load. error and the same page as you is on the browser have u overcomed the issue ????

geet-h17 avatar Nov 09 '23 08:11 geet-h17

@geet-h17 execute the bash line in your project home root

huangdengpan avatar Nov 09 '23 08:11 huangdengpan

i'm getting the same issue as geet-h17 it tells me an issue with Psych::AliasesNotEnabled when I run the bash to reset the encryption key. I am running it from the project root.

jrm213 avatar Nov 28 '23 14:11 jrm213

Hi, I have the same issue. And I found this solution. But I don't know exactly how to implement the solution? Can anyone please help? https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias

thinhngo1798 avatar Jan 21 '24 02:01 thinhngo1798

If you are stuck with rake, this is my fix:

  1. Backup and edit config/initializers/canvas_security.rb
  2. Replace CanvasSecurity.validate_encryption_key(ENV["UPDATE_ENCRYPTION_KEY_HASH"]) to CanvasSecurity.validate_encryption_key(1)
  3. Restart your server, it will prepare the environment and generate security keys
  4. Restore config/initializers/canvas_security.rb afterwards

reza avatar Mar 01 '24 15:03 reza

try this:

  1. backup your canvas_production database
  2. drop canvas_production database
  3. create new database
  4. restore your backup
  5. compile_assets

najiha avatar Jan 27 '25 18:01 najiha