mintupdate-on-wakeup: an easy way of doing unattended upgrades

  1 year ago

One thing, Linux Mint is not very famous for are automatic updates! :( You know that kind of simple thing every Windows user never needs to care about!? By default, Windows just installs important updates! That's it!

Using Mint, the only thing you get is the info to do so! But it is not done automatically! :( Damned!

And for Xmas my mom got a new laptop from me. And she is over 80! Did you ever try to explain such computer stuff to a not even digital immigrant!? No way! So I needed a solution!

As result, I developed a tiny little script that will do this job! No need for her to click any button. No need for me to do it remote or real!

And because I think it could be helpful for more people here a small tutorial what it does and how to install it:


mintupdate-on-wakeup v1.0

It is just a kind of wrapper around mintupdate-tool that does the real stuff.

Nowerdays a normal user has a notebook, laptop, ultrabook or similar. You just use it. Take it, open it, close it, leave it, ... It will suspend and resume a couple of times a day.

And this is where my script hooks in. On every wakeup, it will be called. And with a quite intelligent neat algorythm *haha* it will check for new updates maybe 1-3 times a day. (Even if there are some hundred resumes.) Together with the ability to send some destop notifications.

What does it do?

It will be hooked into /lib/systemd/system-sleep. Thus it will be called on every suspend/resume.

Then it checks its last run and it that was too early ago, nothing will happen. Otherwise minteupdate-tool will be called to check for and install the updates (depending on your needs).

Sounds simple!? Yes! Using my script it (hopefully) is that simple.

mintupdate-tool (LM18)
mintupdate-cli (LM19)!?

As I discovered, in mint 19 mintupdate-tool was replaced by mintupdate-cli. Sorry, I am currently not on 19, so I currently can not port it there. But I guess this will be not very hard.

Maybe someone can show me the differences so that I can implement it?

(In about 2 weeks, I will install a laptop using 19, then I will definitly port it myself. :) )


How to install?

  • Download the script from the link below
  • Unzip and place it in $HOME/bin (or any folder you like)
  • Edit script to adjust some defaults (see top of script)
  • > chown 755  $HOME/bin/mintupdate-on-wakeup
  • > sudo ln -s $HOME/bin/mintupdate-on-wakeup /lib/systemd/system-sleep/
  • Enjoy! :D
  • ... and take a look at /var/log/mintupdate-on-wakeup.log for details.


Some challanges I had...

Well... Since the introduction of mintupdate-tool it is quite easy to start updating from a script.
But I can not ask my mom to launch a script! Even if I place it on desktop. No way!

So I needed an automatism. But damned, it was quite tricky to resolve some issues being called from systemd (root), launching a backround process and sending notifications from root to the desktop user...

Placing a script in /lib/systemd/system-sleep is quite easy.

  • But systemd will kill it, when it needs too long.
  • But pushing it in the backround was not so easy as I thought!
    (nohup/disown did not work, dunno why..)

Because I want to know when it is working, throwing some notifications would be nice, I thought.
By using notify-send, this is quite easy. Just do it!

  • But not, when you try to do that from a poor root shell!
  • But not, if you want to send the notification to a different user!
  • But not, if you need the correct DBUS_SESSION_BUS_ADDRESS!

So I needed a while to figure all that out. But I could solve all issues, i think. (I am not sure about DBUS, if this is waterproof. But anyway, the only thing that not happens, if there is a problem are notiifications. ;) )


So have fun and hopefully no pain with it.


I am open for any kind of feedback, credits, feature-requests, donations, praise, ... :D





Prerequisite: libnotify-bin (if you want to receive desktop notifications)
Downlod: (4275 bytes)

ghost123uk 1 year ago

Thanks for your work on this.
I eagerly await an LM19 version

Enkitux 1 year ago

@ZeckeSZ, as I already wrote in my text above, I have developed it on LM18 and there is no mintupdate-cli, only mintupdate-tool.
I will port it asap.

ZeckeSZ 1 year ago

Calling mintupdate-tool in terminal shows this hint:
"mintupdate-tool is depecrated, please use mintupdate-cli instead"

Enkitux 1 year ago

@remoulder, this is just a bash script, not a binary, dude.
You can take a look into it and will see, it does not do anything bad. (As long as you trust mintupdate-tool :D)

Very /helpful/ comment. Tnx. :(

It would have been more useful if you'd take a look into it, review it and give some real helpful comment on it.

remoulder 1 year ago

WARNING: Do not install software from unknown sources