instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.57k stars 2.48k forks source link

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

Open hitika26 opened 1 year ago

hitika26 commented 1 year ago

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:

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

huangdengpan commented 1 year ago

RAILS_ENV=production bundle exec rake db:reset_encryption_key_hash

fchienvuhoang commented 1 year ago

@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!

fooeyround commented 1 year ago

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 commented 1 year ago

I also tried it without

RAILS_ENV=production

and without

bundle exec

geet-h17 commented 10 months ago

@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 ????

huangdengpan commented 10 months ago

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

jrm213 commented 10 months ago

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.

thinhngo1798 commented 8 months ago

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

reza commented 7 months ago

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