this post was submitted on 04 Jul 2026
41 points (100.0% liked)

Linux

14257 readers
449 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 3 years ago
MODERATORS
 

I don't want the system to shutdown in the middle of the upgrade, but I've already started the upgrade in the GUI.

Is there a better way, maybe involving the apt lock?

EDIT: Thank you for all the helpful suggestions. Hopefully this helps the next person. My upgrade actually finished on its own while I was posting. ๐Ÿ˜‚

you are viewing a single comment's thread
view the rest of the comments
[โ€“] azimir@lemmy.ml 21 points 6 days ago (16 children)

If you can run sudo without a password, you could do something like:

sudo apt update && sudo shutdown -h 5

The && operator will only execute the next instruction if the first returns a zero (no error) code upon completion.

Then just run that command about every 5 minutes and it'll shut down once the install dishes, which releases the lock so apt upgrade can go (presuming apt upgrade needs the lock - I don't remember if it does.)

Alternatively, you could ps auxw | grep for the pid of the upgrade. Then keep running a ps for that pid, and once you don't see it, shutdown.

[โ€“] SayJess@lemmy.blahaj.zone 10 points 6 days ago* (last edited 6 days ago) (5 children)

I was today years old when I learned that && on the command line is not just a after this do this shortcut, but rather how it is used literally everywhere else sort of thing. I am not a very bright knife in the shed.

[โ€“] jtrek@startrek.website 6 points 6 days ago (1 children)

|| has a similar "oh that's how it works in other places" behavior. I didn't realize that for a while.

[โ€“] SayJess@lemmy.blahaj.zone 7 points 6 days ago

Yeah I feel pretty silly. I have a good amount of programming experience too, which certainly amplifies the whoosh lol

load more comments (3 replies)
load more comments (13 replies)