<blockquote>
  <p>Error: file_put_contents(/var/www/html/craftcms/composer.lock): failed to open stream: Permission denied</p>
</blockquote>

<p>Whatever user:group PHP is running as on your server doesn't have the permissions to write to <code>/car/www/html/craftcms</code></p>

<blockquote>
  <p>It also looks like Craft didn't take a backup, as my most recent backup is from RC4, back in January.</p>
</blockquote>

<p>Craft will only do a backup during updating if <code>mysqldump</code> or <code>pg_dump</code> is available to PHP (by default), or if your custom <a href="https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#$backupCommand-detail" rel="nofollow noreferrer">backupCommand</a> config setting executes successfully.</p>

<p>If Craft can't make a backup during updating, it will halt the update process and prompt you asking what you'd like to do with one of the options being to continue without making a backup.</p>

<blockquote>
  <p>I'm not sure how to recover from this,</p>
</blockquote>

<p>To restore the Craft files to the previous version, you can open your project's <code>composer.json</code> file, find the <code>craftcms/cms</code> line, set the version to the pre-update attempt version, then run <code>composer update</code> from the command line.</p>

<p>If there were no database migrations that ran during the update attempt, that should be all you need to do.</p>

<p>If there <em>were</em> database migrations that ran, you'll probably get an message when you try to access the Control Panel saying that you can't backtrack to that version of Craft because now the database is out of sync with the files.</p>

<p>The only practical way around that is to restore from a pre-update attempt database backup.</p>

CC BY-SA 3.0
2018-04-13T23:31:23.900Z
Thanks Brad, I figured there had to be a way to roll back but couldn't find anything in the docs. I still don't have it working (see update in my original post), but at least some progress!
UnknownDeveloper
CC BY-SA 3.0
2018-04-13T04:54:23.073Z
2018-04-13T04:54:23.073Z
Brad Bell
<p>Just tried to run the auto-update to v3.0.0 and it failed catastrophically with the message:</p>

<blockquote>
  <p>Error: file_put_contents(/var/www/html/craftcms/composer.lock): failed to open stream: Permission denied</p>
</blockquote>

<p>Now my control panel page has a "Finish Up" button that doesn't seem to do anything (the styling on the page is completely broken).</p>

<p>It also looks like Craft didn't take a backup, as my most recent backup is from RC4, back in January.</p>

<p>I'm not sure how to recover from this, if it's even possible, as the docs don't seem to have any useful information.</p>

<p>Any help would be appreciated.</p>

<p><strong>UPDATE</strong></p>

<p>Following Brad's instructions below (thanks Brad!), I found that my composer.json file had the version set to 3.0.0-RC5 (I guess the RC4 backup is the most recent after all--I thought I was on a later version).</p>

<p>I tried running <code>composer update</code> but now I'm getting the following error:</p>

<p><code>Problem 1</code>
<code>
- Installation request for craftcms/cms 3.0.0-RC5 -&gt; satisfiable by craftcms/cms[3.0.0-RC5].
- Conclusion: remove roave/security-advisories dev-master
- craftcms/cms 3.0.0-RC5 requires yiisoft/yii2 ~2.0.13.0 -&gt; satisfiable by yiisoft/yii2[2.0.13, 2.0.13.1, 2.0.13.2, 2.0.13.3].
- yiisoft/yii2 2.0.13 conflicts with roave/security-advisories[dev-master].
- yiisoft/yii2 2.0.13.1 conflicts with roave/security-advisories[dev-master].
- yiisoft/yii2 2.0.13.2 conflicts with roave/security-advisories[dev-master].
- yiisoft/yii2 2.0.13.3 conflicts with roave/security-advisories[dev-master].
- Installation request for roave/security-advisories dev-master -&gt; satisfiable by roave/security-advisories[dev-master].</code></p>

<p>I also tried setting my version to RC4 in <code>composer.json</code> but got the same result.</p>

<p>Should I just remove <code>roave/security-advisories</code> from composer.json and try again?</p>

<p>Please excuse my ignorance--I have approximately zero experience with Composer.</p>

CC BY-SA 3.0
2018-04-14T23:42:16.887Z
You can remove `roave-security-advisories` and try again (we actually removed it from the default Craft starter project as well) https://github.com/craftcms/craft/blob/master/composer.json
Brad Bell
<craft3><updating>
Failed upgrade to 3.0.0
# Failed upgrade to 3.0.0

(Asked by: username_0 on 2018-04-13)

Just tried to run the auto-update to v3.0.0 and it failed catastrophically with the message:

> Error: file\_put\_contents(/var/www/html/craftcms/composer.lock): failed to open stream: Permission denied

Now my control panel page has a "Finish Up" button that doesn't seem to do anything (the styling on the page is completely broken).

It also looks like Craft didn't take a backup, as my most recent backup is from RC4, back in January.

I'm not sure how to recover from this, if it's even possible, as the docs don't seem to have any useful information.

Any help would be appreciated.

**UPDATE**

Following Brad's instructions below (thanks Brad!), I found that my composer.json file had the version set to 3.0.0-RC5 (I guess the RC4 backup is the most recent after all--I thought I was on a later version).

I tried running `composer update` but now I'm getting the following error:

`Problem 1`
`- Installation request for craftcms/cms 3.0.0-RC5 -> satisfiable by craftcms/cms[3.0.0-RC5].
- Conclusion: remove roave/security-advisories dev-master
- craftcms/cms 3.0.0-RC5 requires yiisoft/yii2 ~2.0.13.0 -> satisfiable by yiisoft/yii2[2.0.13, 2.0.13.1, 2.0.13.2, 2.0.13.3].
- yiisoft/yii2 2.0.13 conflicts with roave/security-advisories[dev-master].
- yiisoft/yii2 2.0.13.1 conflicts with roave/security-advisories[dev-master].
- yiisoft/yii2 2.0.13.2 conflicts with roave/security-advisories[dev-master].
- yiisoft/yii2 2.0.13.3 conflicts with roave/security-advisories[dev-master].
- Installation request for roave/security-advisories dev-master -> satisfiable by roave/security-advisories[dev-master].`

I also tried setting my version to RC4 in `composer.json` but got the same result.

Should I just remove `roave/security-advisories` from composer.json and try again?

Please excuse my ignorance--I have approximately zero experience with Composer.

**Tags:** craft3, updating

> **Comments:**
> **username_1**: You can remove `roave-security-advisories` and try again (we actually removed it from the default Craft starter project as well) https://github.com/craftcms/craft/blob/master/composer.json  

---

## 1 answers

### Answer by username_1 on 2018-04-13. Score: 0 | Accepted answer

> Error: file\_put\_contents(/var/www/html/craftcms/composer.lock): failed to open stream: Permission denied

Whatever user:group PHP is running as on your server doesn't have the permissions to write to `/car/www/html/craftcms`

> It also looks like Craft didn't take a backup, as my most recent backup is from RC4, back in January.

Craft will only do a backup during updating if `mysqldump` or `pg_dump` is available to PHP (by default), or if your custom [backupCommand](https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#$backupCommand-detail) config setting executes successfully.

If Craft can't make a backup during updating, it will halt the update process and prompt you asking what you'd like to do with one of the options being to continue without making a backup.

> I'm not sure how to recover from this,

To restore the Craft files to the previous version, you can open your project's `composer.json` file, find the `craftcms/cms` line, set the version to the pre-update attempt version, then run `composer update` from the command line.

If there were no database migrations that ran during the update attempt, that should be all you need to do.

If there *were* database migrations that ran, you'll probably get an message when you try to access the Control Panel saying that you can't backtrack to that version of Craft because now the database is out of sync with the files.

The only practical way around that is to restore from a pre-update attempt database backup.

> **Comments:**
> **username_0**: Thanks Brad, I figured there had to be a way to roll back but couldn't find anything in the docs. I still don't have it working (see update in my original post), but at least some progress!  

---

