# Problems after rollback database attempt

**URL:** <https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500>\
**Category:** Self-hosting\
**Created:** [February 6, 2019, 2:14pm UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500 "2019-02-06T14:14:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggurbet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ggurbet/32/120188_2.png) [@ggurbet](https://meta.discourse.org/u/ggurbet)\
**Post date:** [February 6, 2019, 2:14pm UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500/1 "2019-02-06T14:14:00Z")

</div>

Hi. I have tried to rollback database from the upgrade in admin panel but then my instance of discourse has failed.  
I tried to rebuild with `./launcher rebuild app` but it failed to build the bootstrap every time:

> **Bootstrap Error Output**
>
> ````plaintext
> ...
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in `&lt;top (required)&gt;'
> /usr/local/bin/bundle:23:in `load'
> /usr/local/bin/bundle:23:in `&lt;main&gt;'
> Tasks: TOP =&gt; assets:precompile
> (See full trace by running task with --trace)
> I, [2019-02-06T14:12:09.974132 #14] &#160;INFO -- : Purging temp files
> Bundling assets
> 
> I, [2019-02-06T14:12:09.976018 #14] &#160;INFO -- : Terminating async processes
> I, [2019-02-06T14:12:09.976263 #14] &#160;INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 185
> 185:signal-handler (1549462329) Received SIGTERM scheduling shutdown...
> 185:M 06 Feb 14:12:09.989 # User requested shutdown...
> 185:M 06 Feb 14:12:09.989 * Saving the final RDB snapshot before exiting.
> 185:M 06 Feb 14:12:10.019 * DB saved on disk
> 185:M 06 Feb 14:12:10.019 # Redis is now ready to exit, bye bye...
> 
> FAILED
> --------------------
> Pups::ExecError: cd /var/www/discourse &amp;&amp; su discourse -c 'bundle exec rake assets:precompile' failed with return #&lt;Process::Status: pid 17201 exit 1&gt;
> Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
> exec failed with the params {"cd"=&gt;"$home", "hook"=&gt;"bundle_exec", "cmd"=&gt;["su discourse -c 'bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4'",
> "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
> e2aa48ffcbcb1c7a4aa65b10ab13a03d2d8e0ab401ab9307bc5ea754f0634305
> **FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one```
> 
> ````

When I restarted it, I got a 502 error. I backed up the latest status with `discourse backup` after entering the app with `./launcher enter app`.  
Then tried to revert back to the last night’s backup with `discourse restore $backupfile`. It starts working but fails with some errors:

> **Restore Error Output**
>
> ```plaintext
> Starting restore: /var/discourse/shared/standalone/backups/default/pardus-forumlari-2019-02-06-023655-v20190130013015.tar.gz
> [STARTED]
> 'system' has started the restore!
> Marking restore as running...
> Making sure /var/www/discourse/tmp/restores/default/2019-02-06-135801 exists...
> Copying archive to tmp directory...
> EXCEPTION: /var/www/discourse/lib/backup_restore/local_backup_store.rb:43:in `download_file': Failed to copy archive to tmp directory.
> cp: cannot stat '/var/www/discourse/public/backups/default/var/discourse/shared/standalone/backups/default/pardus-forumlari-2019-02-06-023655-v20190130013015.tar.gz': No such file or direct
> ory
> /var/www/discourse/lib/discourse.rb:29:in `execute_command'
> /var/www/discourse/lib/backup_restore/local_backup_store.rb:43:in `download_file'
> /var/www/discourse/lib/backup_restore/restorer.rb:194:in `copy_archive_to_tmp_directory'
> /var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'
> script/discourse:136:in `restore'
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
> script/discourse:277:in `&lt;top (required)&gt;'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `load'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:28:in `run'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:463:in `exec'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:27:in `dispatch'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:18:in `start'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle:30:in `block in &lt;top (required)&gt;'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
> /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle:22:in `&lt;top (required)&gt;'
> /usr/local/bin/bundle:23:in `load'
> /usr/local/bin/bundle:23:in `&lt;main&gt;'
> Trying to rollback...
> There was no need to rollback
> Cleaning stuff up...
> Removing tmp '/var/www/discourse/tmp/restores/default/2019-02-06-135801' directory...
> Unpausing sidekiq...
> Marking restore as finished...
> Notifying 'system' of the end of the restore...
> Finished!
> [FAILED]
> Restore done.
> 
> ```

The interesting part of this output is  
`cp: cannot stat '/var/www/discourse/public/backups/default/var/discourse/shared/standalone/backups/default/pardus-forumlari-2019-02-06-023655-v20190130013015.tar.gz': No such file or directory`

The directory names are listed twice.  
Is there a solution to:

1. Restore the forum with its latest up and running state, without any restore.
2. If (1) does not work, a way to restore the latest backup without any problems.

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [February 6, 2019, 2:32pm UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500/2 "2019-02-06T14:32:28Z")

</div>

Did you do a [standard install](https://meta.discourse.org/t/142537?silent=true)?

---

<div class="post-metadata">

**Author:** ![ggurbet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ggurbet/32/120188_2.png) [@ggurbet](https://meta.discourse.org/u/ggurbet)\
**Post date:** [February 6, 2019, 2:37pm UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500/3 "2019-02-06T14:37:08Z")

</div>

I just renamed my old discourse folder (`/var/discourse`), created a new `discourse` folder and started a fresh install. After the installation I copied my latest backup into the new installation’s backup folder, then created a new user and I was able to enter the restore settings. I then restored my old backup from there and now the site is almost back to normal. Now my settings, custom [data explorer](https://meta.discourse.org/t/32566?silent=true) queries and probably some other things I missed are lost and I do not know how to get them back.

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [February 6, 2019, 2:51pm UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500/4 "2019-02-06T14:51:03Z")

</div>

All of those things should be in the backup of its up to date.

---

<div class="post-metadata">

**Author:** ![ggurbet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ggurbet/32/120188_2.png) [@ggurbet](https://meta.discourse.org/u/ggurbet)\
**Post date:** [February 6, 2019, 8:17pm UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500/5 "2019-02-06T20:17:02Z")

</div>

Reverting to backup finally worked and almost everything is back to normal. Only a not-viewable Default theme has appeared (which can only be seen with hamburget theme selector plugin). I have lost some data due to this, so leaving the topic open if something seems wrong.

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [February 7, 2019, 1:08pm UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500/6 "2019-02-07T13:08:44Z")

</div>

Were the new and old install the same version? You can’t downgrade versions.

---

<div class="post-metadata">

**Author:** ![ggurbet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ggurbet/32/120188_2.png) [@ggurbet](https://meta.discourse.org/u/ggurbet)\
**Post date:** [February 11, 2019, 9:35am UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500/7 "2019-02-11T09:35:11Z")

</div>

They were the same version. I had just run an upgrade beforehand.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [February 28, 2022, 10:23pm UTC](https://meta.discourse.org/t/problems-after-rollback-database-attempt/108500/8 "2022-02-28T22:23:18Z")

</div>


