public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
* Debian unattended-upgrades
@ 2025-04-09 19:54 Chuck Lever
  2025-04-09 20:16 ` Chuck Lever
  2025-04-18 19:15 ` Luis Chamberlain
  0 siblings, 2 replies; 6+ messages in thread
From: Chuck Lever @ 2025-04-09 19:54 UTC (permalink / raw)
  To: kdevops

Hi -

While testing with Debian 12 on AWS, I ran into this:

---
- name: Check if unattended-upgrades is installed
  command: dpkg-query -W -f='${Status}' unattended-upgrades
  register: unattended_upgrade_status
  ignore_errors: true
  changed_when: false

- name: Set fact if unattended-upgrades is installed
  set_fact:
    unattended_upgrades_installed: "{{ 'install ok installed' in
unattended_upgrade_status.stdout }}"

- name: Verify unattended-upgrades is not installed
  fail:
    msg: |
      The unattended-upgrades package is installed on the base image, this
      can cause tons of issues with CIs. Fix this by running the following
      commands:

      make cleancache
      make bringup
  when:
    - unattended_upgrades_installed|bool

The Debian 12 image on AWS has the unattended-upgrades package
installed. I haven't checked Debian 11 or Debian on other cloud
providers.

- I did a "dpkg --purge unattended-upgrades" on each of the
  instances, and this failure went away

- "make cleancache" might be appropriate for a libvirt installation,
  but it definitely won't do anything for cloud; a fresh OS image
  will always have that package (unless we make a custom image)

- Even so, if the libvirt OS image provider installs that package,
  "make cleancache" won't eliminate the failure

Noting that later steps in
playbooks/roles/devconfig/tasks/install-deps/debian/main.yml disable and
uninstall unattended-upgrades anyway, what
is the purpose for the above logic? Can it be removed?

-- 
Chuck Lever


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debian unattended-upgrades
  2025-04-09 19:54 Debian unattended-upgrades Chuck Lever
@ 2025-04-09 20:16 ` Chuck Lever
  2025-04-10  8:29   ` Daniel Gomez
  2025-04-18 19:15 ` Luis Chamberlain
  1 sibling, 1 reply; 6+ messages in thread
From: Chuck Lever @ 2025-04-09 20:16 UTC (permalink / raw)
  To: kdevops

On 4/9/25 3:54 PM, Chuck Lever wrote:
> Hi -
> 
> While testing with Debian 12 on AWS, I ran into this:
> 
> ---
> - name: Check if unattended-upgrades is installed
>   command: dpkg-query -W -f='${Status}' unattended-upgrades
>   register: unattended_upgrade_status
>   ignore_errors: true
>   changed_when: false
> 
> - name: Set fact if unattended-upgrades is installed
>   set_fact:
>     unattended_upgrades_installed: "{{ 'install ok installed' in
> unattended_upgrade_status.stdout }}"
> 
> - name: Verify unattended-upgrades is not installed
>   fail:
>     msg: |
>       The unattended-upgrades package is installed on the base image, this
>       can cause tons of issues with CIs. Fix this by running the following
>       commands:
> 
>       make cleancache
>       make bringup
>   when:
>     - unattended_upgrades_installed|bool
> 
> The Debian 12 image on AWS has the unattended-upgrades package
> installed. I haven't checked Debian 11 or Debian on other cloud
> providers.
> 
> - I did a "dpkg --purge unattended-upgrades" on each of the
>   instances, and this failure went away
> 
> - "make cleancache" might be appropriate for a libvirt installation,
>   but it definitely won't do anything for cloud; a fresh OS image
>   will always have that package (unless we make a custom image)
> 
> - Even so, if the libvirt OS image provider installs that package,
>   "make cleancache" won't eliminate the failure
> 
> Noting that later steps in
> playbooks/roles/devconfig/tasks/install-deps/debian/main.yml disable and
> uninstall unattended-upgrades anyway, what
> is the purpose for the above logic? Can it be removed?
> 

This is a possible solution I found on StackOverflow:

https://stackoverflow.com/questions/45269225/ansible-playbook-fails-to-lock-apt/51919678#51919678

I see that bringup_guestfs.sh already attempts to uninstall
unattended-upgrades on new images. We'll want something that works
for cloud instances too.


-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debian unattended-upgrades
  2025-04-09 20:16 ` Chuck Lever
@ 2025-04-10  8:29   ` Daniel Gomez
  2025-04-10 13:49     ` Chuck Lever
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Gomez @ 2025-04-10  8:29 UTC (permalink / raw)
  To: Chuck Lever; +Cc: kdevops, Swarna Prabhu

On Wed, Apr 09, 2025 at 04:16:44PM +0100, Chuck Lever wrote:
> On 4/9/25 3:54 PM, Chuck Lever wrote:
> > 
> > - I did a "dpkg --purge unattended-upgrades" on each of the
> >   instances, and this failure went away
> > 
> > - "make cleancache" might be appropriate for a libvirt installation,
> >   but it definitely won't do anything for cloud; a fresh OS image
> >   will always have that package (unless we make a custom image)
> > 
> > - Even so, if the libvirt OS image provider installs that package,
> >   "make cleancache" won't eliminate the failure
> > 
> > Noting that later steps in
> > playbooks/roles/devconfig/tasks/install-deps/debian/main.yml disable and
> > uninstall unattended-upgrades anyway, what
> > is the purpose for the above logic? Can it be removed?

I was reviewing these tasks the other day with Swarna. My suggestion is to
reorganize the task order to the following:

- name: Check if unattended-upgrades is installed
- name: Set fact if unattended-upgrades is installed
- name: Stop and disable unattended-upgrades related services
- name: Remove unattended-upgrades package
- name: Remove optional unattended-upgrades configuration files if they exist
- name: Verify unattended-upgrades is not installed
- name: Upgrade Packages

I think the dpkg --purge should cleanup the unnatended-upgrades package files
as we do we do in "Remove optional...", right? In that case, we can replace this
task with the more appropiate dpkg command you have suggested above.

> > 
> 
> This is a possible solution I found on StackOverflow:
> 
> https://stackoverflow.com/questions/45269225/ansible-playbook-fails-to-lock-apt/51919678#51919678
> 
> I see that bringup_guestfs.sh already attempts to uninstall
> unattended-upgrades on new images. We'll want something that works
> for cloud instances too.

Agree. And I think that was the intention of that part of the playbook.

> 
> 
> -- 
> Chuck Lever

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debian unattended-upgrades
  2025-04-10  8:29   ` Daniel Gomez
@ 2025-04-10 13:49     ` Chuck Lever
  2025-04-14  7:55       ` Daniel Gomez
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Lever @ 2025-04-10 13:49 UTC (permalink / raw)
  To: Daniel Gomez; +Cc: kdevops, Swarna Prabhu

On 4/10/25 4:29 AM, Daniel Gomez wrote:
> On Wed, Apr 09, 2025 at 04:16:44PM +0100, Chuck Lever wrote:
>> On 4/9/25 3:54 PM, Chuck Lever wrote:
>>>
>>> - I did a "dpkg --purge unattended-upgrades" on each of the
>>>   instances, and this failure went away
>>>
>>> - "make cleancache" might be appropriate for a libvirt installation,
>>>   but it definitely won't do anything for cloud; a fresh OS image
>>>   will always have that package (unless we make a custom image)
>>>
>>> - Even so, if the libvirt OS image provider installs that package,
>>>   "make cleancache" won't eliminate the failure
>>>
>>> Noting that later steps in
>>> playbooks/roles/devconfig/tasks/install-deps/debian/main.yml disable and
>>> uninstall unattended-upgrades anyway, what
>>> is the purpose for the above logic? Can it be removed?
> 
> I was reviewing these tasks the other day with Swarna. My suggestion is to
> reorganize the task order to the following:
> 
> - name: Check if unattended-upgrades is installed
> - name: Set fact if unattended-upgrades is installed
> - name: Stop and disable unattended-upgrades related services
> - name: Remove unattended-upgrades package
> - name: Remove optional unattended-upgrades configuration files if they exist
> - name: Verify unattended-upgrades is not installed
> - name: Upgrade Packages
> 
> I think the dpkg --purge should cleanup the unnatended-upgrades package files
> as we do we do in "Remove optional...", right? In that case, we can replace this
> task with the more appropiate dpkg command you have suggested above.

I'm wondering about the repetition of "remove unattended-upgrades"
/after/ the full update in the current Ansible script. Is there a
possibility that the full update will reinstall unattended-upgrades? If
not, then your proposed order looks OK to me.


>> This is a possible solution I found on StackOverflow:
>>
>> https://stackoverflow.com/questions/45269225/ansible-playbook-fails-to-lock-apt/51919678#51919678
>>
>> I see that bringup_guestfs.sh already attempts to uninstall
>> unattended-upgrades on new images. We'll want something that works
>> for cloud instances too.
> 
> Agree. And I think that was the intention of that part of the playbook.
> 
>>
>>
>> -- 
>> Chuck Lever


-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debian unattended-upgrades
  2025-04-10 13:49     ` Chuck Lever
@ 2025-04-14  7:55       ` Daniel Gomez
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Gomez @ 2025-04-14  7:55 UTC (permalink / raw)
  To: Chuck Lever; +Cc: kdevops, Swarna Prabhu

On Thu, Apr 10, 2025 at 09:49:07AM +0100, Chuck Lever wrote:
> On 4/10/25 4:29 AM, Daniel Gomez wrote:
> > On Wed, Apr 09, 2025 at 04:16:44PM +0100, Chuck Lever wrote:
> >> On 4/9/25 3:54 PM, Chuck Lever wrote:
> >>>
> >>> - I did a "dpkg --purge unattended-upgrades" on each of the
> >>>   instances, and this failure went away
> >>>
> >>> - "make cleancache" might be appropriate for a libvirt installation,
> >>>   but it definitely won't do anything for cloud; a fresh OS image
> >>>   will always have that package (unless we make a custom image)
> >>>
> >>> - Even so, if the libvirt OS image provider installs that package,
> >>>   "make cleancache" won't eliminate the failure
> >>>
> >>> Noting that later steps in
> >>> playbooks/roles/devconfig/tasks/install-deps/debian/main.yml disable and
> >>> uninstall unattended-upgrades anyway, what
> >>> is the purpose for the above logic? Can it be removed?
> > 
> > I was reviewing these tasks the other day with Swarna. My suggestion is to
> > reorganize the task order to the following:
> > 
> > - name: Check if unattended-upgrades is installed
> > - name: Set fact if unattended-upgrades is installed
> > - name: Stop and disable unattended-upgrades related services
> > - name: Remove unattended-upgrades package
> > - name: Remove optional unattended-upgrades configuration files if they exist
> > - name: Verify unattended-upgrades is not installed
> > - name: Upgrade Packages
> > 
> > I think the dpkg --purge should cleanup the unnatended-upgrades package files
> > as we do we do in "Remove optional...", right? In that case, we can replace this
> > task with the more appropiate dpkg command you have suggested above.
> 
> I'm wondering about the repetition of "remove unattended-upgrades"
> /after/ the full update in the current Ansible script. Is there a

What repetition do you mean? These tasks?

- name: Remove unattended-upgrades package
- name: Remove optional unattended-upgrades configuration files if they exist

The first one removes the package. The second ensures that any remaining files
not cleaned up by the package removal task are also deleted. It'd simpler
enabling the purge option to the apt task.

> possibility that the full update will reinstall unattended-upgrades? If
> not, then your proposed order looks OK to me.

Not that I'm aware of.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debian unattended-upgrades
  2025-04-09 19:54 Debian unattended-upgrades Chuck Lever
  2025-04-09 20:16 ` Chuck Lever
@ 2025-04-18 19:15 ` Luis Chamberlain
  1 sibling, 0 replies; 6+ messages in thread
From: Luis Chamberlain @ 2025-04-18 19:15 UTC (permalink / raw)
  To: Chuck Lever; +Cc: kdevops

On Wed, Apr 09, 2025 at 03:54:22PM -0400, Chuck Lever wrote:
> what is the purpose for the above logic? Can it be removed?

guestfs images can be stale with the unattended-upgrades package still
installed, so we can just make this crap shoot check a guestfs specific
thing.

The actual removal is imprortant though, for cloud it makes sense to
still remove the package, and not bail out.

  Luis

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-18 19:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-09 19:54 Debian unattended-upgrades Chuck Lever
2025-04-09 20:16 ` Chuck Lever
2025-04-10  8:29   ` Daniel Gomez
2025-04-10 13:49     ` Chuck Lever
2025-04-14  7:55       ` Daniel Gomez
2025-04-18 19:15 ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox