Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu Desktop 16.04: apt-get can't get lock #86

Closed
hdave opened this issue Nov 23, 2016 · 6 comments · Fixed by #108
Closed

Ubuntu Desktop 16.04: apt-get can't get lock #86

hdave opened this issue Nov 23, 2016 · 6 comments · Fixed by #108

Comments

@hdave
Copy link

hdave commented Nov 23, 2016

I have a Vagrant that install a large number of packages into Xenial desktop using version 2.0.24 from here:

https://atlas.hashicorp.com/boxcutter/boxes/ubuntu1604-desktop/versions/2.0.24

I see from the configuration here that the background check for updates should not be happening, but I am regularly getting apt-get errors about an inability to get a lock.

As a work-around, I inserted the following into my provisioning script right before every call to apt-get:

while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1; do sleep 1 done

It would be nice if the box came with all the background checking and notification disabled. Thank you.

@annawake
Copy link
Contributor

I don't know of a reliable way to automatically disable the updates/notifications for the ubuntu 16.04 desktop. If you ever figure it out, please submit a PR.

It should be easy, but it doesn't appear to be. Disappointing because it's straightforward when you do it manually.

@hdave
Copy link
Author

hdave commented Nov 26, 2016

I realize this is very ham fisted, but this has been working for me:

apt-get remove -y unattended-upgrades update-notifier update-manager update-notifier-common update-manager-core
killall update-manager
killall update-notifier
killall dpkg
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

However, I find that sometimes I still need my work-around list above. I am not certain, but I think certain apt operations have a lingering after effect that delays the removal of the lock file for short, but non-zero time.

@annawake
Copy link
Contributor

annawake commented Nov 26, 2016

Yes, that is exactly the issue - I don't yet know how to completely disable updates.

The best I know of is what is being done for the new series of "Learning Chef" videos - where a box was manually created, updates were disabled in the GUI and they should now not have any issues with updates being done in the background: https://atlas.hashicorp.com/learningchef/boxes/ubuntu1604-desktop
The resultant VM was then captured via packer, but the creation process was manual.

But I don't know how yet to replicate these action via automation on the command line.

@tknerr
Copy link
Contributor

tknerr commented Apr 7, 2017

Running into this too.

Seems this is caused by /etc/apt/apt.conf.d/20auto-upgrades which enables periodic unattended upgrades:

vagrant@linus-kitchen:~$ cat /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

@tknerr
Copy link
Contributor

tknerr commented Apr 7, 2017

Just saw that it's still the same issue as reported in #73

PR #74 was created to fix this, but was not merged as another approach was suggested. However, that other approach fixed it only for the Ubuntu Server variants, not for Ubuntu Desktop.

See my latest comment in #74 (comment)

@annawake I verified that the changes in #74 are still a valid fix for the issue. Let's reconsider merging this PR?

@tknerr
Copy link
Contributor

tknerr commented Apr 10, 2017

@annawake @hdave found a more appropriate solution, see PR #108 (but still want to verify it)

@tas50 tas50 closed this as completed in #108 Jul 4, 2017
tas50 added a commit that referenced this issue Jul 4, 2017
byplayer pushed a commit to byplayer/ubuntu that referenced this issue Nov 1, 2017
…ed-upgrades

Disable periodic APT updates to fix boxcutter#86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants