Live data from Hacker News

Waiting for apt locks without hacky Bash scripts

blog.sinjakli.co.uk

21–30 of 30 posts

Re: Waiting for apt locks without hacky Bash scripts

#21

I run large datacenters with thousands of boxes. I have a little app (written in golang) installed on each box that effectively is a task runner. Tasks can be written to do anything, including apt-get installing software. If apt-get fails to run, the task fails (context.WithTimeout) and is run again at a later date. No random hacks needed. Everything is built to be idempotent, self-healing and eventually consistent.

Would you be interested in sharing this tool with the world?

Re: Waiting for apt locks without hacky Bash scripts

#22
post #4

Those darned apt locks have to be the second biggest PITA of my Linux development experience. Who in their right mind thought it was a good idea for an automatic system maintenance process to entirely block the user from doing their using for the first couple minutes after startup? As if that wasn’t enough they have the nerve to log this line: > Be aware that removing the lock file is not a solution and may break you…

You can disable automatic updates and instead run them when you want.

Re: Waiting for apt locks without hacky Bash scripts

#23

I run large datacenters with thousands of boxes. I have a little app (written in golang) installed on each box that effectively is a task runner. Tasks can be written to do anything, including apt-get installing software. If apt-get fails to run, the task fails (context.WithTimeout) and is run again at a later date. No random hacks needed. Everything is built to be idempotent, self-healing and eventually consistent.

Might be a dumb question, but would systemd not be able to do this? Do your boxes not run systemd?

Re: Waiting for apt locks without hacky Bash scripts

#24

I run large datacenters with thousands of boxes. I have a little app (written in golang) installed on each box that effectively is a task runner. Tasks can be written to do anything, including apt-get installing software. If apt-get fails to run, the task fails (context.WithTimeout) and is run again at a later date. No random hacks needed. Everything is built to be idempotent, self-healing and eventually consistent.

Might be a dumb question, but would systemd not be able to do this? Do your boxes not run systemd?

Not a dumb question. My process runs from systemd. But the process itself needs to do all sorts of custom stuff, which is baked into it.

Re: Waiting for apt locks without hacky Bash scripts

#25
post #21

I run large datacenters with thousands of boxes. I have a little app (written in golang) installed on each box that effectively is a task runner. Tasks can be written to do anything, including apt-get installing software. If apt-get fails to run, the task fails (context.WithTimeout) and is run again at a later date. No random hacks needed. Everything is built to be idempotent, self-healing and eventually consistent.

Would you be interested in sharing this tool with the world?

Thanks for asking. This is a huge amount of IP for my business. It is also very custom for our use case. I'm not trying to create a general purpose DSL or anything.

Re: Waiting for apt locks without hacky Bash scripts

#26
post #22
post #4

Those darned apt locks have to be the second biggest PITA of my Linux development experience. Who in their right mind thought it was a good idea for an automatic system maintenance process to entirely block the user from doing their using for the first couple minutes after startup? As if that wasn’t enough they have the nerve to log this line: > Be aware that removing the lock file is not a solution and may break you…

You can disable automatic updates and instead run them when you want.

Funny thing is I click “not now” or whatever it is when they pop up asking if I want updates, yet it still gets locked.

Re: Waiting for apt locks without hacky Bash scripts

#28
post #12
post #11

Earlier quoted context omitted.

cfengine3 does that (and much more) form me.

cron does that for me, and it's already installed

Cron is not a very good task runner on its own if you have lots of hosts, care that your tasks actually run, care that they succeed, need sequencing or need to ensure that multiple instances don't conflict.

cron is fine as part of a task scheduler, but even for very basic use cases you'll hit its limitations and will have to work around them.

Re: Waiting for apt locks without hacky Bash scripts

#29
post #26
post #22

Earlier quoted context omitted.

You can disable automatic updates and instead run them when you want.

Funny thing is I click “not now” or whatever it is when they pop up asking if I want updates, yet it still gets locked.

If this is an Ubuntu flavor, you can run the "software and updates" program and set "Updates -> Automatically check for updates" to Never.

https://media.howtofix.io/full/images/posts/2020/11/13/16052...

Other distros may vary :)

Re: Waiting for apt locks without hacky Bash scripts

#30
post #29
post #26

Earlier quoted context omitted.

Funny thing is I click “not now” or whatever it is when they pop up asking if I want updates, yet it still gets locked.

If this is an Ubuntu flavor, you can run the "software and updates" program and set "Updates -> Automatically check for updates" to Never. https://media.howtofix.io/full/images/posts/2020/11/13/16052... Other distros may vary :)

Thanks, looks like it was set to auto-install security updates and prompt for the others.
Post reply on HN