title: How can I rollback a failed update in apt-get?
body: <p>I am working on an embedded device running Ubuntu 14. The main application, let's call it <strong>A</strong>, can automatically update itself through apt-get. We've created a private apt repository where we publish our releases.</p>
  
  <p>This main application, <strong>A</strong>, has some dependencies (also published in our repository), declared with Pre-Depends in the debian package.</p>
  
  <p>Let's say <strong>A</strong> version 1.1 has the following:</p>
  
  <pre><code>Pre-Depends: B (= 1.0.2), C (= 2.1)
  </code></pre>
  
  <p>With this, <strong>A</strong> won't be updated if any of the dependencies installation fails. But the other dependencies will be updated and installed.</p>
  
  <p>Let's assume dependency <strong>B</strong> can't be installed, for whatever reason. <strong>C</strong> will be updated to 2.1 and <strong>A</strong> won't be updated.</p>
  
  <p>Since dependencies of <strong>A</strong>'s previous version were:</p>
  
  <pre><code>Pre-Depends: B (= 1.0.0), C (= 2.0)
  </code></pre>
  
  <p>the current state of <strong>A</strong>, and thus of the device, is broken.</p>
  
  <p>Which would be the best approach in order to rollback this failed update? Or what other actions would be recommended in such scenarios?</p>
  
  <p>I've found this post: <a href="https://www.cyberciti.biz/howto/debian-linux/ubuntu-linux-rollback-an-apt-get-upgrade/" rel="nofollow noreferrer">https://www.cyberciti.biz/howto/debian-linux/ubuntu-linux-rollback-an-apt-get-upgrade/</a> where it's explained how to do a rollback, but I'd like to explore other options, if possible, since it has to be done automatically on the device.</p>