# aptitude safe-upgrade

**URL:** <https://forum.ansible.com/t/aptitude-safe-upgrade/12608>\
**Category:** Ansible Project\
**Created:** [March 30, 2013, 9:20pm UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608 "2013-03-30T21:20:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lorin\_Hochstein1](https://avatars.discourse-cdn.com/v4/letter/l/ce73a5/32.png) [@Lorin\_Hochstein1](https://forum.ansible.com/u/Lorin_Hochstein1)\
**Post date:** [March 30, 2013, 9:20pm UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/1 "2013-03-30T21:20:01Z")

</div>

I’d like to add support for the “aptitude safe-upgrade” command in an ansible module. I was thinking of one of two options for implementing it:

Option 1: Modifying the apt module so that the “upgrade” parameter can take a new argument, e.g. “safe”: (apt: upgrade=safe). In this case, it would do “aptitude safe-upgrade -y”

Option 2: Adding a new “aptitude” module.

I’d prefer option #1, but I wanted to hear if others felt differently.

Note that the difference between “apt-get upgrade” (apt: upgrade=yes) and “aptitude safe-upgrade” is that “aptitude safe-upgrade” will install missing dependencies.

Lorin

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [March 31, 2013, 9:53am UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/2 "2013-03-31T09:53:28Z")

</div>

​Shouldn't this

Note that the difference between "apt-get upgrade" (apt: upgrade=yes) and

> "aptitude safe-upgrade" is that "aptitude safe-upgrade" will install  
> missing dependencies.

be "​.. will not install new dependencies"​?

&nbsp;&nbsp;Serge

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 31, 2013, 2:13pm UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/3 "2013-03-31T14:13:10Z")

</div>

Why would you ever not want to install new dependencies added by a  
package upgrade?

Seems like if you wanted to, you could just use the command module for  
this, but it also seems very strange.

If a package goes from v1 to v2 and now requires X, it seems not  
installing X is not safe in the least 🙂

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [March 31, 2013, 5:41pm UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/4 "2013-03-31T17:41:47Z")

</div>

​safe-upgrade should be the default. regular upgrade is more of what is  
used for distribution upgrades.

as per:  
[http://askubuntu.com/questions/117088/aptitude-safe-upgrade-equivalence-with-apt-get](http://askubuntu.com/questions/117088/aptitude-safe-upgrade-equivalence-with-apt-get)

The apt-get command closer to aptitude safe-upgrade is upgrade, but there  
is a difference.

aptitude safe-upgrade upgrades currently installed packages and can install  
new packages to resolve new dependencies, but never removes packages.

apt-get upgrade upgrades currently installed packages, but never installs  
or removes packages.  
So apt-get upgrade is comparable to aptitude --no-new-installs safe-upgrade.  
​

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 31, 2013, 9:05pm UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/5 "2013-03-31T21:05:46Z")

</div>

Ok, make it so please!

---

<div class="post-metadata">

**Author:** ![Lorin\_Hochstein1](https://avatars.discourse-cdn.com/v4/letter/l/ce73a5/32.png) [@Lorin\_Hochstein1](https://forum.ansible.com/u/Lorin_Hochstein1)\
**Post date:** [March 31, 2013, 9:08pm UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/6 "2013-03-31T21:08:55Z")

</div>

OK, I will modify the behavior of “apt: upgrade=yes” to use “aptitude safe-upgrade” instead of “apt-get upgrade”

Lorin

---

<div class="post-metadata">

**Author:** ![Lorin\_Hochstein1](https://avatars.discourse-cdn.com/v4/letter/l/ce73a5/32.png) [@Lorin\_Hochstein1](https://forum.ansible.com/u/Lorin_Hochstein1)\
**Post date:** [April 1, 2013, 12:54am UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/7 "2013-04-01T00:54:03Z")

</div>

> Shouldn't this
> 
> Note that the difference between "apt-get upgrade" (apt: upgrade=yes) and
> 
> > "aptitude safe-upgrade" is that "aptitude safe-upgrade" will install  
> > missing dependencies.
> 
> be ".. will not install new dependencies"?

No, it's correct. "aptitude safe-upgrade" installs missing dependencies,  
and "apt-get upgrade" doesn't. You pretty much always want to install  
missing dependencies if an updated package requires a new dependency, so  
"aptitude safe-upgrade" is the common case.

Lorin

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [April 1, 2013, 12:50pm UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/8 "2013-04-01T12:50:56Z")

</div>

This is merged now.

As we are scheduled to release 1.1 tomorrow, if everyone can test the  
app module today that would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![TextEditor](https://avatars.discourse-cdn.com/v4/letter/t/a88e57/32.png) [@TextEditor](https://forum.ansible.com/u/TextEditor)\
**Post date:** [April 2, 2013, 7:34am UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/9 "2013-04-02T07:34:29Z")

</div>

How would this run for systems which only have apt-get installed and not aptitude?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [April 2, 2013, 11:51am UTC](https://forum.ansible.com/t/aptitude-safe-upgrade/12608/10 "2013-04-02T11:51:33Z")

</div>

(A) You could of course install aptitude.

(B) I think the real question you meant to ask was 'can we do this  
with apt instead', which is my question.

Though it will need to wait until 1.2.
