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

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
46 Posts 22 Posters 797 Views 22 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.
  • 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

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

    andreasduerenA Offline
    andreasduerenA Offline
    andreasdueren
    wrote last edited by andreasdueren
    #26

    @james this won’t fix the issue of logging everyone out though I assume?

    Edit: just saw the newest update.

    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

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

      S Offline
      S Offline
      sangemaru
      wrote last edited by
      #27

      @james I also confirm this worked.

      1 Reply Last reply
      1
      • murgeroM Offline
        murgeroM Offline
        murgero
        App Dev
        wrote last edited by
        #28

        Confirming this fix worked however the latest package version still doesn't fix this problem.

        --
        https://urgero.org
        ~ Professional Nerd. Freelance Programmer. ~

        1 Reply Last reply
        1
        • jdaviescoatesJ Offline
          jdaviescoatesJ Offline
          jdaviescoates
          wrote last edited by
          #29

          @james said in Vaultwarden fails to start after update – DB migration error (SSO):

          From version Cloudron package version 1.22.2 => Vaultwarden Version 1.34.3 to Cloudron package version 1.23.0 => Vaultwarden Version 1.35.0

          Despite my worries and concerns, I never actually hit this problem. Guess I was lucky. But I wonder why? 🤔 🤷

          My Vaultwarden started fine after doing that update. And then I immediately updated to the next version without issue too. 🤔 🤷

          I use Cloudron with Gandi & Hetzner

          1 Reply Last reply
          1
          • 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

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

            GrienauerG Offline
            GrienauerG Offline
            Grienauer
            wrote last edited by
            #30

            @james Hi thx. But how to use the web terminal if it is not starting/responding? At least this is the Problem on my side currently. So I can not execute any commands there…

            Drupal CMS and Open Source Expert, Mautic Community lead Secretary

            andreasduerenA 1 Reply Last reply
            0
            • GrienauerG Grienauer

              @james Hi thx. But how to use the web terminal if it is not starting/responding? At least this is the Problem on my side currently. So I can not execute any commands there…

              andreasduerenA Offline
              andreasduerenA Offline
              andreasdueren
              wrote last edited by
              #31

              @Grienauer You need to put it into recovery mode, execure the script, take it out of it again

              1 Reply Last reply
              2
              • GrienauerG Offline
                GrienauerG Offline
                Grienauer
                wrote last edited by
                #32

                Yes, this did the trick. Thank you.
                Crazy superfast response from you btw. thx!

                Drupal CMS and Open Source Expert, Mautic Community lead Secretary

                1 Reply Last reply
                3
                • jamesJ james has marked this topic as solved
                • 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

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

                  F Offline
                  F Offline
                  factord
                  wrote last edited by factord
                  #33

                  @james it doesnt work for me, here is the output

                  root@b2a9826b-7631-435b-91a0-d0a505476ee9:/app/code# bash /app/data/fix_db.sh
                  /app/data/fix_db.sh: line 2: $'\r': command not found
                  => Checking if DEFAULT_CHARACTER_SET_NAME and DEFAULT_COLLATION_NAME are set to utf8mb4 and utf8mb4_unicode_ci
                  /app/data/fix_db.sh: line 4: $'\r': command not found
                  /app/data/fix_db.sh: line 8: $'\r': command not found
                  /app/data/fix_db.sh: line 22: syntax error near unexpected token `$'in\r''
                  'app/data/fix_db.sh: line 22: `    case $yn in
                  root@b2a9826b-7631-435b-91a0-d0a505476ee9:/app/code# /app/pkg/start.sh
                  => Exporting env vars expected by Vaultwarden
                  => Starting Bitwarden
                  /--------------------------------------------------------------------\
                  |                        Starting Vaultwarden                        |
                  |--------------------------------------------------------------------|
                  | This is an *unofficial* Bitwarden implementation, DO NOT use the   |
                  | official channels to report bugs/features, regardless of client.   |
                  | Send usage/configuration questions or feature requests to:         |
                  |   https://github.com/dani-garcia/vaultwarden/discussions or        |
                  |   https://vaultwarden.discourse.group/                             |
                  | Report suspected bugs/issues in the software itself at:            |
                  |   https://github.com/dani-garcia/vaultwarden/issues/new            |
                  \--------------------------------------------------------------------/
                  
                  [INFO] Using saved config from `/app/data/config.json` for configuration.
                  
                  [2026-01-03 17:24:33.038][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505
                     0: vaultwarden::init_logging::{{closure}}
                     1: std::panicking::panic_with_hook
                     2: std::panicking::panic_handler::{{closure}}
                     3: std::sys::backtrace::__rust_end_short_backtrace
                     4: __rustc::rust_begin_unwind
                     5: core::panicking::panic_fmt
                     6: core::result::unwrap_failed
                     7: vaultwarden::db::DbPool::from_config
                     8: vaultwarden::main::{{closure}}
                     9: vaultwarden::main
                    10: std::sys::backtrace::__rust_begin_short_backtrace
                    11: main
                    12: <unknown>
                    13: __libc_start_main
                    14: _start
                  
                  root@b2a9826b-7631-435b-91a0-d0a505476ee9:/app/code# 
                  

                  PS: i restored to 1.22.2 to get it working for now.

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

                    Hello @factord
                    This looks like a copy-paste issue from Windows.
                    \r in line 2 is a blank line, so a line break.
                    When you copy and pasted, it pasted the line breaks windows style.

                    Please describe how you have copy and pasted the code into the /app/data/fix_db.sh file.

                    jdaviescoatesJ 1 Reply Last reply
                    1
                    • ChristopherMagC Offline
                      ChristopherMagC Offline
                      ChristopherMag
                      wrote last edited by
                      #35

                      I have the same issue as @factord I am on windows 11 and created the file through the file manager, pasted the contents copied from the post into the file using the built in file editor that is a part of the file manager, saved the file, opened the web terminal and ran the bash /app/data/fix_db.sh command.

                      1 Reply Last reply
                      1
                      • ChristopherMagC Offline
                        ChristopherMagC Offline
                        ChristopherMag
                        wrote last edited by
                        #36

                        I have run the command sed -i 's/\r$//g' /app/data/fix_db.sh to fix the new line characters and then run bash /app/data/fix_db.sh again and it ran as expected. Disabled recover mode and confirmed things are back to working as expected.

                        R 1 Reply Last reply
                        3
                        • apesorgukA Offline
                          apesorgukA Offline
                          apesorguk
                          wrote last edited by apesorguk
                          #37

                          So everytime I upgrade from Vaultwarden 1.34.3 to 1.35.0 the instance becomes unresponsive, saying connection failure in the terminal and nothing really in the logs apart from connection failure again.

                          Jan 06 12:13:28 0: vaultwarden::init_logging::{{closure}}
                          Jan 06 12:13:28 10: std::sys::backtrace::__rust_begin_short_backtrace
                          Jan 06 12:13:28 11: main
                          Jan 06 12:13:28 12: <unknown>
                          Jan 06 12:13:28 13: __libc_start_main
                          Jan 06 12:13:28 14: _start
                          Jan 06 12:13:28 1: std::panicking::panic_with_hook
                          Jan 06 12:13:28 2: std::panicking::panic_handler::{{closure}}
                          Jan 06 12:13:28 3: std::sys::backtrace::__rust_end_short_backtrace
                          Jan 06 12:13:28 4: __rustc::rust_begin_unwind
                          Jan 06 12:13:28 5: core::panicking::panic_fmt
                          Jan 06 12:13:28 6: core::result::unwrap_failed
                          Jan 06 12:13:28 7: vaultwarden::db::DbPool::from_config
                          Jan 06 12:13:28 8: vaultwarden::main::{{closure}}
                          Jan 06 12:13:28 9: vaultwarden::main
                          Jan 06 12:13:28 Please generate a secure Argon2 PHC string by using `vaultwarden hash` or `argon2`.
                          Jan 06 12:13:28 See: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token
                          Jan 06 12:13:28 [2026-01-06 12:13:28.418][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505
                          Jan 06 12:13:28 [INFO] Using saved config from `/app/data/config.json` for configuration.
                          Jan 06 12:13:28 [NOTICE] You are using a plain text `ADMIN_TOKEN` which is insecure.
                          Jan 06 12:13:28 \--------------------------------------------------------------------/
                          Jan 06 12:13:28 | https://github.com/dani-garcia/vaultwarden/discussions or |
                          Jan 06 12:13:28 | https://github.com/dani-garcia/vaultwarden/issues/new |
                          Jan 06 12:13:28 | https://vaultwarden.discourse.group/ |
                          Jan 06 12:13:28 | Report suspected bugs/issues in the software itself at: |
                          Jan 06 12:13:28 | Send usage/configuration questions or feature requests to: |
                          Jan 06 12:13:28 | official channels to report bugs/features, regardless of client. |
                          Jan 06 12:13:37 => Healthcheck error: AbortError: The operation was aborted
                          Jan 06 12:13:41 => Healthcheck error: Error: connect ECONNREFUSED 172.18.16.123:3000
                          Jan 06 12:13:41 2026-01-06T12:13:41Z
                          Jan 06 12:13:41 2026-01-06T12:13:41Z
                          Jan 06 12:13:41 2026-01-06T12:13:41Z
                          Jan 06 12:13:41 2026-01-06T12:13:41Z
                          Jan 06 12:13:41 /--------------------------------------------------------------------\
                          Jan 06 12:13:41 0: vaultwarden::init_logging::{{closure}}
                          Jan 06 12:13:41 10: std::sys::backtrace::__rust_begin_short_backtrace
                          Jan 06 12:13:41 11: main
                          Jan 06 12:13:41 12: <unknown>
                          Jan 06 12:13:41 13: __libc_start_main
                          Jan 06 12:13:41 14: _start
                          Jan 06 12:13:41 1: std::panicking::panic_with_hook
                          Jan 06 12:13:41 2: std::panicking::panic_handler::{{closure}}
                          Jan 06 12:13:41 3: std::sys::backtrace::__rust_end_short_backtrace
                          Jan 06 12:13:41 4: __rustc::rust_begin_unwind
                          Jan 06 12:13:41 5: core::panicking::panic_fmt
                          Jan 06 12:13:41 6: core::result::unwrap_failed
                          Jan 06 12:13:41 7: vaultwarden::db::DbPool::from_config
                          Jan 06 12:13:41 8: vaultwarden::main::{{closure}}
                          Jan 06 12:13:41 9: vaultwarden::main
                          Jan 06 12:13:41 => Exporting env vars expected by Vaultwarden
                          Jan 06 12:13:41 => Starting Bitwarden
                          Jan 06 12:13:41 Please generate a secure Argon2 PHC string by using `vaultwarden hash` or `argon2`.
                          Jan 06 12:13:41 See: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token
                          Jan 06 12:13:41 [2026-01-06 12:13:41.691][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505
                          Jan 06 12:13:41 [INFO] Using saved config from `/app/data/config.json` for configuration.
                          Jan 06 12:13:41 [NOTICE] You are using a plain text `ADMIN_TOKEN` which is insecure.
                          Jan 06 12:13:41 \--------------------------------------------------------------------/
                          Jan 06 12:13:41 | Starting Vaultwarden |
                          Jan 06 12:13:41 | https://github.com/dani-garcia/vaultwarden/discussions or |
                          Jan 06 12:13:41 | https://github.com/dani-garcia/vaultwarden/issues/new |
                          Jan 06 12:13:41 | https://vaultwarden.discourse.group/ |
                          Jan 06 12:13:41 | Report suspected bugs/issues in the software itself at: |
                          Jan 06 12:13:41 | Send usage/configuration questions or feature requests to: |
                          Jan 06 12:13:41 | This is an *unofficial* Bitwarden implementation, DO NOT use the |
                          Jan 06 12:13:41 | official channels to report bugs/features, regardless of client. |
                          Jan 06 12:13:41 |--------------------------------------------------------------------|
                          Jan 06 12:13:52 => Healthcheck error: Error: connect EHOSTUNREACH 172.18.16.123:3000
                          

                          I then have to restore the 1.34.3 version for vaultwarden to work again. I have also had to disable auto update. Please note that I know there are two updates from 1.34.3, but both updates have the same connection issue.

                          jamesJ 1 Reply Last reply
                          0
                          • apesorgukA apesorguk

                            So everytime I upgrade from Vaultwarden 1.34.3 to 1.35.0 the instance becomes unresponsive, saying connection failure in the terminal and nothing really in the logs apart from connection failure again.

                            Jan 06 12:13:28 0: vaultwarden::init_logging::{{closure}}
                            Jan 06 12:13:28 10: std::sys::backtrace::__rust_begin_short_backtrace
                            Jan 06 12:13:28 11: main
                            Jan 06 12:13:28 12: <unknown>
                            Jan 06 12:13:28 13: __libc_start_main
                            Jan 06 12:13:28 14: _start
                            Jan 06 12:13:28 1: std::panicking::panic_with_hook
                            Jan 06 12:13:28 2: std::panicking::panic_handler::{{closure}}
                            Jan 06 12:13:28 3: std::sys::backtrace::__rust_end_short_backtrace
                            Jan 06 12:13:28 4: __rustc::rust_begin_unwind
                            Jan 06 12:13:28 5: core::panicking::panic_fmt
                            Jan 06 12:13:28 6: core::result::unwrap_failed
                            Jan 06 12:13:28 7: vaultwarden::db::DbPool::from_config
                            Jan 06 12:13:28 8: vaultwarden::main::{{closure}}
                            Jan 06 12:13:28 9: vaultwarden::main
                            Jan 06 12:13:28 Please generate a secure Argon2 PHC string by using `vaultwarden hash` or `argon2`.
                            Jan 06 12:13:28 See: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token
                            Jan 06 12:13:28 [2026-01-06 12:13:28.418][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505
                            Jan 06 12:13:28 [INFO] Using saved config from `/app/data/config.json` for configuration.
                            Jan 06 12:13:28 [NOTICE] You are using a plain text `ADMIN_TOKEN` which is insecure.
                            Jan 06 12:13:28 \--------------------------------------------------------------------/
                            Jan 06 12:13:28 | https://github.com/dani-garcia/vaultwarden/discussions or |
                            Jan 06 12:13:28 | https://github.com/dani-garcia/vaultwarden/issues/new |
                            Jan 06 12:13:28 | https://vaultwarden.discourse.group/ |
                            Jan 06 12:13:28 | Report suspected bugs/issues in the software itself at: |
                            Jan 06 12:13:28 | Send usage/configuration questions or feature requests to: |
                            Jan 06 12:13:28 | official channels to report bugs/features, regardless of client. |
                            Jan 06 12:13:37 => Healthcheck error: AbortError: The operation was aborted
                            Jan 06 12:13:41 => Healthcheck error: Error: connect ECONNREFUSED 172.18.16.123:3000
                            Jan 06 12:13:41 2026-01-06T12:13:41Z
                            Jan 06 12:13:41 2026-01-06T12:13:41Z
                            Jan 06 12:13:41 2026-01-06T12:13:41Z
                            Jan 06 12:13:41 2026-01-06T12:13:41Z
                            Jan 06 12:13:41 /--------------------------------------------------------------------\
                            Jan 06 12:13:41 0: vaultwarden::init_logging::{{closure}}
                            Jan 06 12:13:41 10: std::sys::backtrace::__rust_begin_short_backtrace
                            Jan 06 12:13:41 11: main
                            Jan 06 12:13:41 12: <unknown>
                            Jan 06 12:13:41 13: __libc_start_main
                            Jan 06 12:13:41 14: _start
                            Jan 06 12:13:41 1: std::panicking::panic_with_hook
                            Jan 06 12:13:41 2: std::panicking::panic_handler::{{closure}}
                            Jan 06 12:13:41 3: std::sys::backtrace::__rust_end_short_backtrace
                            Jan 06 12:13:41 4: __rustc::rust_begin_unwind
                            Jan 06 12:13:41 5: core::panicking::panic_fmt
                            Jan 06 12:13:41 6: core::result::unwrap_failed
                            Jan 06 12:13:41 7: vaultwarden::db::DbPool::from_config
                            Jan 06 12:13:41 8: vaultwarden::main::{{closure}}
                            Jan 06 12:13:41 9: vaultwarden::main
                            Jan 06 12:13:41 => Exporting env vars expected by Vaultwarden
                            Jan 06 12:13:41 => Starting Bitwarden
                            Jan 06 12:13:41 Please generate a secure Argon2 PHC string by using `vaultwarden hash` or `argon2`.
                            Jan 06 12:13:41 See: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token
                            Jan 06 12:13:41 [2026-01-06 12:13:41.691][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505
                            Jan 06 12:13:41 [INFO] Using saved config from `/app/data/config.json` for configuration.
                            Jan 06 12:13:41 [NOTICE] You are using a plain text `ADMIN_TOKEN` which is insecure.
                            Jan 06 12:13:41 \--------------------------------------------------------------------/
                            Jan 06 12:13:41 | Starting Vaultwarden |
                            Jan 06 12:13:41 | https://github.com/dani-garcia/vaultwarden/discussions or |
                            Jan 06 12:13:41 | https://github.com/dani-garcia/vaultwarden/issues/new |
                            Jan 06 12:13:41 | https://vaultwarden.discourse.group/ |
                            Jan 06 12:13:41 | Report suspected bugs/issues in the software itself at: |
                            Jan 06 12:13:41 | Send usage/configuration questions or feature requests to: |
                            Jan 06 12:13:41 | This is an *unofficial* Bitwarden implementation, DO NOT use the |
                            Jan 06 12:13:41 | official channels to report bugs/features, regardless of client. |
                            Jan 06 12:13:41 |--------------------------------------------------------------------|
                            Jan 06 12:13:52 => Healthcheck error: Error: connect EHOSTUNREACH 172.18.16.123:3000
                            

                            I then have to restore the 1.34.3 version for vaultwarden to work again. I have also had to disable auto update. Please note that I know there are two updates from 1.34.3, but both updates have the same connection issue.

                            jamesJ Offline
                            jamesJ Offline
                            james
                            Staff
                            wrote last edited by
                            #38

                            Hello @apesorguk

                            I have merged your new topic into this one, since it is a duplication.
                            The fix has already been provided, see above https://forum.cloudron.io/post/117779

                            apesorgukA 1 Reply Last reply
                            0
                            • jamesJ james

                              Hello @apesorguk

                              I have merged your new topic into this one, since it is a duplication.
                              The fix has already been provided, see above https://forum.cloudron.io/post/117779

                              apesorgukA Offline
                              apesorgukA Offline
                              apesorguk
                              wrote last edited by
                              #39

                              @james I get this problem.

                              root@bf8db951-7632-4ddf-bf9b-8b58cd65ffe5:/app/code# bash /app/data/fix_db.sh
                              /app/data/fix_db.sh: line 2: $'\r': command not found
                              => Checking if DEFAULT_CHARACTER_SET_NAME and DEFAULT_COLLATION_NAME are set to utf8mb4 and utf8mb4_unicode_ci
                              /app/data/fix_db.sh: line 4: $'\r': command not found
                              /app/data/fix_db.sh: line 8: $'\r': command not found
                              /app/data/fix_db.sh: line 22: syntax error near unexpected token `$'in\r''
                              'app/data/fix_db.sh: line 22: `    case $yn in
                              root@bf8db951-7632-4ddf-bf9b-8b58cd65ffe5:/app/code#
                              
                              1 Reply Last reply
                              0
                              • jamesJ james

                                Hello @factord
                                This looks like a copy-paste issue from Windows.
                                \r in line 2 is a blank line, so a line break.
                                When you copy and pasted, it pasted the line breaks windows style.

                                Please describe how you have copy and pasted the code into the /app/data/fix_db.sh file.

                                jdaviescoatesJ Offline
                                jdaviescoatesJ Offline
                                jdaviescoates
                                wrote last edited by
                                #40

                                @apesorguk looks like you've hit the same copy-paste issue @james described here:

                                @james said in Vaultwarden fails to start after update – DB migration error (SSO):

                                This looks like a copy-paste issue from Windows.
                                \r in line 2 is a blank line, so a line break.
                                When you copy and pasted, it pasted the line breaks windows style.

                                Please describe how you have copy and pasted the code into the /app/data/fix_db.sh file.

                                I use Cloudron with Gandi & Hetzner

                                1 Reply Last reply
                                0
                                • apesorgukA Offline
                                  apesorgukA Offline
                                  apesorguk
                                  wrote last edited by apesorguk
                                  #41

                                  Thanks all fixed now. I found this worked even with the line brake.

                                  I have run the command sed -i 's/\r$//g' /app/data/fix_db.sh to fix the new line characters and then run bash /app/data/fix_db.sh again and it ran as expected. Disabled recover mode and confirmed things are back to working as expected.
                                  
                                  1 Reply Last reply
                                  1
                                  • O Offline
                                    O Offline
                                    overholt
                                    wrote last edited by
                                    #42

                                    Vaultwarden not responding. Backup restore from December 29th, 2025 works. No backups after that are working. There is nothing in the Cloudron logs that show any error. There was only an update on Dec 31st that appears to be the start of the problem.

                                    1 Reply Last reply
                                    0
                                    • jdaviescoatesJ Offline
                                      jdaviescoatesJ Offline
                                      jdaviescoates
                                      wrote last edited by jdaviescoates
                                      #43

                                      @overholt Very likely you've hit the same thing as this thread. Solution here https://forum.cloudron.io/post/117779

                                      I use Cloudron with Gandi & Hetzner

                                      1 Reply Last reply
                                      1
                                      • marcusquinnM Offline
                                        marcusquinnM Offline
                                        marcusquinn
                                        wrote last edited by marcusquinn
                                        #44

                                        I used this issue to improve my aidevops cloudron subagent, and it managed to fix the issue on all instances. More info here for anyone interested to add this to your toolkit:

                                        • https://forum.cloudron.io/topic/14688/ai-devops

                                        Web Design & Development: https://www.evergreen.je
                                        Technology & Apps: https://www.marcusquinn.com

                                        1 Reply Last reply
                                        1
                                        • O Offline
                                          O Offline
                                          overholt
                                          wrote last edited by overholt
                                          #45

                                          Script fix works. Thank you!

                                          1 Reply Last reply
                                          3
                                          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