We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
sleepyeyesvince · 735 views · 23 likes
Analysis Summary
Worth Noting
Positive elements
- This video provides a practical, real-world application of a specific Linux utility (systemd-inhibit) and demonstrates how to automate it using bash aliases.
Influence Dimensions
How are these scored?About this analysis
Knowing about these techniques makes them visible, not powerless. The ones that work best on you are the ones that match beliefs you already hold.
This analysis is a tool for your own thinking — what you do with it is up to you.
Related content covering similar topics.
The 'fortune' Command in Linux (Hidden Terminal Fun!)
Learn Linux TV
ButterTodo 🧈 - I Made a Todo App Nobody Asked For
JustAGuy Linux
How to Automate Linux Backups Using rsync and systemd
Learn Linux TV
Build a Custom Linux MOTD with Bash and systemd!
Learn Linux TV
A Very UNIX Christmas w/ tony-btw
Joshua Blais
Transcript
hello everyone i know it's been a little while since i've made my last video but yeah life happens today i'm going to be talking about a terrible lesson that i learned the hard way by making a huge mistake and i'd like to thank a wonderfully generous community member shikel whose channels i've posted in the description below and he pointed me in the direction of this functionality within systemd so systemd is an init system that is used by most of the major linux distributions like ubuntu and all its derivatives fedora debian arch open souza and so forth it's the first program that your computer starts when you boot it up and it subsequently is responsible for loading everything else like your services your desktop environment your login manager etc now i'm not going to go into system d in detail here nor am i going to be debating the merits of it over other choices what i will acknowledge is that it is by far the most widely used in its system across all linux distributions so picture this there i was applying a ton of updates to my arco linux system whilst watching some classic star trek deep space nine episodes in the kodi media player software somehow through some insane clumsiness as i was quitting the kodi program i managed to accidentally hit the reboot option in its exit menu whilst these system updates were still running in the background now on most occasions you'll probably get away with accidentally rebooting your system during updates as the update process should be smart enough to recover however in my case i can only surmise that what went on to occur was a perfect storm of events where i must have rebooted just as a new linux kernel was being updated the first rebit was fine but when i tried to rerun updates the system locked up and i had to hard power it off that's when i got this dreaded error screen so i think that it means that i had no valid links kernel moral of the story is that there are occasions where you absolutely do not want your computer to have power related events which include things like shut down sleep suspend or hibernate in my example system updates would be one of those examples but another could be if you were running backups or if you were running your system as some kind of media server this is where the systemd inhibit function comes in handy and i'll show you the main page here let's have a look at it you can read most of it for yourself but essentially if you run system d inhibit as part of your command so you what you would do is you put it before the command that you want to run in the terminal that opens the program that you intend to want to protect against computer power events it will lock out the ability of these events to occur until your program finishes and exits as you can see here there are other options to systemd inhibit and you can be specific about which particular power event you want to protect your system against right here in its simplest form if you run systemd inhibit without any options it will block all system power events in this list until your own program finishes and exits let's have a look at how this might work if i bring up a terminal and we'll enlarge the font a little bit so as a simple example let's try running systemd inhibit and h stop so as you can see here i've got h top running and everything looks normal but look what happens if i try and open another terminal and i try to reboot the system you'll see here it gives me a message that says the operation has been inhibited by uh systemd inhibit it says the reasoning is unknown and one of the options you can actually input here is the reasoning behind it with your own little reason there so now it won't let me reboot until i quit hate stop there is still a way that this can be overridden if you attempt to reboot your system by elevating your privileges with sudo so if i was to go sudo reboot and hit enter my system would still reboot and override this system d inhibit functionality i'm not going to do this right now of course since i'm recording this video so you can see how useful this functionality can be for preventing clumsy folk like me from accidentally rebooting my system when doing something critical like running updates and potentially balking my system like i did i don't quote me on this but i do recall some distributions like ubuntu debian and another apt based package manager distros where if you use the gui interface for doing system updates there is a similar functionality here now let's now let's quit out of this and we'll get out of htop as well the next thing i did was to bake this functionality into my desktop so i wouldn't have to think about it too much whenever i tried to run system updates and i did this by adding an alias to my bash rc file so if i open up my bashrc file so i would go nano dot rc and now if i scroll down to the bottom which is where i think i put it you'll see all these aliases they're actually provided by the arc linux team and some of them are really useful if i continue scrolling down you'll see my own ones so what i've done here is modify some of the aliases that arca linux already provides and simply i just added system d inhibit to the front of each of these commands so most of the time if i'm doing installs of the software from pacman or if i'm updating my system then it will cause my computer to avoid power events until the process is actually finished if you want more information about how to add alias shortcuts to your dot bash rc file i've made a video about that as well and i'll link it in the cards above and in the description down below that's all i've got for you today very simple one if you want to stay informed of future content consider subscribing to this channel as always if you have any other comments questions or suggestions leave them down below for me and i will have a look at them when time permits thank you again for watching and bye bye for now
Video description
I want to share some love for the Linux Terminal. It's fun to learn and use. Here we will be discussing how to use systemd-inhibit to prevent power related events when you are running critical applications. If you are a new user and need a great terminal tutorial: https://tutorials.ubuntu.com/tutorial/command-line-for-beginners Information about systemd-inhibit: In terminal, type: man systemd-inhibit Or: https://sarata.com/manpages/systemd-inhibit.1.html Schykle on YouTube: https://www.youtube.com/channel/UC7CVRfla-wJSGGBP8_d-_PQ https://www.youtube.com/channel/UCFStADq-kOi8S0a0-toX6Rg My video on bash aliases: https://www.youtube.com/watch?v=iRvMMsZoYQc Contact me: Twitter: @sleepyeyesvince MeWe: https://mewe.com/i/sleepyeyesvince