Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Offical apps | Community apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Vaultwarden
  3. Vaultwarden fails to start after update – DB migration error (SSO)

Vaultwarden fails to start after update – DB migration error (SSO)

Scheduled Pinned Locked Moved Solved Vaultwarden
76 Posts 34 Posters 10.4k Views 28 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jdaviescoatesJ Offline
    jdaviescoatesJ Offline
    jdaviescoates
    wrote on last edited by
    #65

    I also had a not responding app and have reverted. Guess I need to look at that guide...

    I use Cloudron with Gandi & Hetzner

    1 Reply Last reply
    2
    • P Offline
      P Offline
      p44
      translator
      wrote on last edited by
      #66

      @jdaviescoates @joseph Thanks for your advice. I followed this guide: https://github.com/dani-garcia/vaultwarden/wiki/Using-the-MariaDB-(MySQL)-Backend#foreign-key-errors-collation-and-charset and problem now is fixed.

      thanks a lot

      1 Reply Last reply
      3
      • B Offline
        B Offline
        BetaBreak
        wrote on last edited by
        #67

        Is there a step by step instruction to solve this issue, for me it is unclear how to fix this issue. Thanks!

        1 Reply Last reply
        1
        • J Offline
          J Offline
          jayonrails
          translator
          wrote on last edited by
          #68

          The above posted link to the GitHub wiki seems to be the step by step instruction. Which is the part where you don't get forward?

          1 Reply Last reply
          2
          • B Offline
            B Offline
            BetaBreak
            wrote on last edited by BetaBreak
            #69

            Thanks, when I run the queries I don't get out put..
            Should I do it before upgrading, and or in recovery mode?

            1 Reply Last reply
            0
            • jamesJ Offline
              jamesJ Offline
              james
              Staff
              wrote on last edited by james
              #70

              Hello @d19dotca @teiluj @ikalou @p44 @jdaviescoates @betabreak @jayonrails
              This issue was discussed before, and I did create a handy script to fix the issue.
              Please see: https://forum.cloudron.io/topic/14812/vaultwarden-fails-to-start-after-update-db-migration-error-sso/24?_=1778581136537

              I have also merged this topic into the original topic so there is no duplicate.

              B 1 Reply Last reply
              5
              • jamesJ james referenced this topic on
              • jamesJ james

                Hello @d19dotca @teiluj @ikalou @p44 @jdaviescoates @betabreak @jayonrails
                This issue was discussed before, and I did create a handy script to fix the issue.
                Please see: https://forum.cloudron.io/topic/14812/vaultwarden-fails-to-start-after-update-db-migration-error-sso/24?_=1778581136537

                I have also merged this topic into the original topic so there is no duplicate.

                B Offline
                B Offline
                BetaBreak
                wrote on last edited by
                #71

                @james ✔ it works, thanks!

                jamesJ 1 Reply Last reply
                1
                • B BetaBreak

                  @james ✔ it works, thanks!

                  jamesJ Offline
                  jamesJ Offline
                  james
                  Staff
                  wrote on last edited by james
                  #72

                  Hello @BetaBreak
                  Great to read that it resolved your issue.
                  Always happy to help.

                  If possible, give the solution I linked also an upvote to improve the forum search.

                  1 Reply Last reply
                  2
                  • jamesJ james

                    Hello @vaultwarden users

                    Since users have voiced their concerns about manually editing the database I have created a bash script that does it for you.
                    Please follow these steps if you have this issue:

                    1. create an app backup of your @vaultwarden Cloudron app
                    2. put the erroring @vaultwarden app in recovery mode
                    3. open the File Manager of your @vaultwarden app and create a fix_db.sh file
                    4. copy and paste the following script into the just created fix_db.sh file:
                      #!/bin/bash
                      
                      echo "=> Checking if DEFAULT_CHARACTER_SET_NAME and DEFAULT_COLLATION_NAME are set to utf8mb4 and utf8mb4_unicode_ci"
                      
                      CURRENT_DEFAULT_CHARACTER_SET_NAME=$(mysql --silent --skip-column-names --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '${CLOUDRON_MYSQL_DATABASE}';" 2>/dev/null)
                      CURRENT_DEFAULT_COLLATION_NAME=$(mysql --silent --skip-column-names --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '${CLOUDRON_MYSQL_DATABASE}';" 2>/dev/null)
                      FIX_NEEDED=0
                      
                      if [ "${CURRENT_DEFAULT_CHARACTER_SET_NAME}" != "utf8mb4" ] || [ "${CURRENT_DEFAULT_COLLATION_NAME}" != "utf8mb4_unicode_ci" ]; then
                          echo "=> DEFAULT_CHARACTER_SET_NAME or DEFAULT_COLLATION_NAME is not set to utf8mb4 or utf8mb4_unicode_ci."
                          echo "==> Current values are: DEFAULT_CHARACTER_SET_NAME=${CURRENT_DEFAULT_CHARACTER_SET_NAME}, DEFAULT_COLLATION_NAME=${CURRENT_DEFAULT_COLLATION_NAME}"
                          FIX_NEEDED=1
                      else
                          echo "=> DEFAULT_CHARACTER_SET_NAME is ${CURRENT_DEFAULT_CHARACTER_SET_NAME} and DEFAULT_COLLATION_NAME is ${CURRENT_DEFAULT_COLLATION_NAME}"
                          echo "=> Nothing to do - quitting."
                          FIX_NEEDED=0
                          exit 0
                      fi
                      
                      if [ ${FIX_NEEDED} -eq 1 ]; then
                          read -p "Have you created a backup of your Cloudron Vaultwarden app? (y/N): " yn
                          case $yn in
                              [Yy]* )
                                  echo "=> Setting database character set and collation to utf8mb4 and utf8mb4_unicode_ci."
                                  mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "ALTER DATABASE \`${CLOUDRON_MYSQL_DATABASE}\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" 2>/dev/null
                                  echo "=> Converting all tables to character set utf8mb4 and collation utf8mb4_unicode_ci."
                                  mysql --silent --skip-column-names \
                        --user="${CLOUDRON_MYSQL_USERNAME}" \
                        --password="${CLOUDRON_MYSQL_PASSWORD}" \
                        --host="${CLOUDRON_MYSQL_HOST}" \
                        "${CLOUDRON_MYSQL_DATABASE}" \
                        -e "SELECT CONCAT('ALTER TABLE \`', TABLE_NAME,'\` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') AS CharSetConvert FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${CLOUDRON_MYSQL_DATABASE}' AND TABLE_TYPE=\"BASE TABLE\";" 2>/dev/null | while read -r sql_command; do
                                      echo "==> Executing: ${sql_command}"
                                      mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "SET foreign_key_checks=0; ${sql_command} SET foreign_key_checks=1;" 2>/dev/null
                                  done
                                  ;;
                              [Nn]* )
                                  echo "=> Please create a backup of your database before proceeding with the fix. Exiting."
                                  exit 1
                                  ;;
                              * )
                                  echo "=> Invalid response. Please answer with y or n. Exiting."
                                  exit 1
                                  ;;
                          esac
                      fi
                      
                    5. open the Web Terminal of your @vaultwarden Cloudron app
                    6. execute the following command:
                      bash /app/data/fix_db.sh
                      
                    7. Execute the following command to start @vaultwarden:
                      /app/pkg/start.sh
                      
                    8. Validate if your @vaultwarden is now working correctly
                    9. If validated working, you can delete the fix_db.sh file and disable the recovery mode of your @vaultwarden Cloudron app

                    Note:
                    If there are issues with the copy and paste from Windows devices apperent by error messages like line 2: $'\r': command not found, please run the following command to fix the script:

                    sed -i 's/\r$//g' /app/data/fix_db.sh
                    

                    If you run into any issues, copy the output of the terminal, post it here and restore your app from the backup created.

                    jdaviescoatesJ Offline
                    jdaviescoatesJ Offline
                    jdaviescoates
                    wrote on last edited by jdaviescoates
                    #73

                    @james said:

                    Please follow these steps if you have this issue:

                    Can this script be run on the working version I reverted to, or do I need to update to the broken version and then run it?

                    Edit: yes, it seems fixing the db and then updating also works fine.

                    I use Cloudron with Gandi & Hetzner

                    1 Reply Last reply
                    1
                    • jamesJ james referenced this topic
                    • jamesJ james referenced this topic
                    • jamesJ james

                      Hello @vaultwarden users

                      Since users have voiced their concerns about manually editing the database I have created a bash script that does it for you.
                      Please follow these steps if you have this issue:

                      1. create an app backup of your @vaultwarden Cloudron app
                      2. put the erroring @vaultwarden app in recovery mode
                      3. open the File Manager of your @vaultwarden app and create a fix_db.sh file
                      4. copy and paste the following script into the just created fix_db.sh file:
                        #!/bin/bash
                        
                        echo "=> Checking if DEFAULT_CHARACTER_SET_NAME and DEFAULT_COLLATION_NAME are set to utf8mb4 and utf8mb4_unicode_ci"
                        
                        CURRENT_DEFAULT_CHARACTER_SET_NAME=$(mysql --silent --skip-column-names --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '${CLOUDRON_MYSQL_DATABASE}';" 2>/dev/null)
                        CURRENT_DEFAULT_COLLATION_NAME=$(mysql --silent --skip-column-names --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '${CLOUDRON_MYSQL_DATABASE}';" 2>/dev/null)
                        FIX_NEEDED=0
                        
                        if [ "${CURRENT_DEFAULT_CHARACTER_SET_NAME}" != "utf8mb4" ] || [ "${CURRENT_DEFAULT_COLLATION_NAME}" != "utf8mb4_unicode_ci" ]; then
                            echo "=> DEFAULT_CHARACTER_SET_NAME or DEFAULT_COLLATION_NAME is not set to utf8mb4 or utf8mb4_unicode_ci."
                            echo "==> Current values are: DEFAULT_CHARACTER_SET_NAME=${CURRENT_DEFAULT_CHARACTER_SET_NAME}, DEFAULT_COLLATION_NAME=${CURRENT_DEFAULT_COLLATION_NAME}"
                            FIX_NEEDED=1
                        else
                            echo "=> DEFAULT_CHARACTER_SET_NAME is ${CURRENT_DEFAULT_CHARACTER_SET_NAME} and DEFAULT_COLLATION_NAME is ${CURRENT_DEFAULT_COLLATION_NAME}"
                            echo "=> Nothing to do - quitting."
                            FIX_NEEDED=0
                            exit 0
                        fi
                        
                        if [ ${FIX_NEEDED} -eq 1 ]; then
                            read -p "Have you created a backup of your Cloudron Vaultwarden app? (y/N): " yn
                            case $yn in
                                [Yy]* )
                                    echo "=> Setting database character set and collation to utf8mb4 and utf8mb4_unicode_ci."
                                    mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "ALTER DATABASE \`${CLOUDRON_MYSQL_DATABASE}\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" 2>/dev/null
                                    echo "=> Converting all tables to character set utf8mb4 and collation utf8mb4_unicode_ci."
                                    mysql --silent --skip-column-names \
                          --user="${CLOUDRON_MYSQL_USERNAME}" \
                          --password="${CLOUDRON_MYSQL_PASSWORD}" \
                          --host="${CLOUDRON_MYSQL_HOST}" \
                          "${CLOUDRON_MYSQL_DATABASE}" \
                          -e "SELECT CONCAT('ALTER TABLE \`', TABLE_NAME,'\` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') AS CharSetConvert FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${CLOUDRON_MYSQL_DATABASE}' AND TABLE_TYPE=\"BASE TABLE\";" 2>/dev/null | while read -r sql_command; do
                                        echo "==> Executing: ${sql_command}"
                                        mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE} -e "SET foreign_key_checks=0; ${sql_command} SET foreign_key_checks=1;" 2>/dev/null
                                    done
                                    ;;
                                [Nn]* )
                                    echo "=> Please create a backup of your database before proceeding with the fix. Exiting."
                                    exit 1
                                    ;;
                                * )
                                    echo "=> Invalid response. Please answer with y or n. Exiting."
                                    exit 1
                                    ;;
                            esac
                        fi
                        
                      5. open the Web Terminal of your @vaultwarden Cloudron app
                      6. execute the following command:
                        bash /app/data/fix_db.sh
                        
                      7. Execute the following command to start @vaultwarden:
                        /app/pkg/start.sh
                        
                      8. Validate if your @vaultwarden is now working correctly
                      9. If validated working, you can delete the fix_db.sh file and disable the recovery mode of your @vaultwarden Cloudron app

                      Note:
                      If there are issues with the copy and paste from Windows devices apperent by error messages like line 2: $'\r': command not found, please run the following command to fix the script:

                      sed -i 's/\r$//g' /app/data/fix_db.sh
                      

                      If you run into any issues, copy the output of the terminal, post it here and restore your app from the backup created.

                      luckymL Offline
                      luckymL Offline
                      luckym
                      wrote last edited by luckym
                      #74

                      @james

                      I'm only now getting around to applying this fix. Altering the tables worked but when I run /app/pkg/start.sh I get the following errors:

                      [2026-08-06 17:12:38.211][vaultwarden][ERROR] Web vault is not found at 'web-vault/'. To install it, please follow the steps in: 
                      [2026-08-06 17:12:38.211][vaultwarden][ERROR] https://github.com/dani-garcia/vaultwarden/wiki/Building-binary#install-the-web-vault
                      [2026-08-06 17:12:38.211][vaultwarden][ERROR] You can also set the environment variable 'WEB_VAULT_ENABLED=false' to disable it
                      

                      The web vault usually worked and was installed to my knowledge but I'm not sure I can just ignore this error and exit recovery mode regardless. I'm on version 1.37.1.

                      /edit Ok leaving recovery mode worked and the app is now working properly again!

                      1 Reply Last reply
                      0
                      • jamesJ Offline
                        jamesJ Offline
                        james
                        Staff
                        wrote last edited by
                        #75

                        Hello @luckym
                        Please try.

                        luckymL 1 Reply Last reply
                        0
                        • jamesJ james

                          Hello @luckym
                          Please try.

                          luckymL Offline
                          luckymL Offline
                          luckym
                          wrote last edited by
                          #76

                          @james Yay it's working again!

                          1 Reply Last reply
                          1

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Bookmarks
                          • Search