Skip to content

How do you properly shutdown your computer?

Removed before it was archived.

14 points27 comments
Open on Reddit
About this post
Posted
Archived
Deleted on
Score
14 · 100% up
Kind
Text
ID
dk2rol

30 comments

poweroff is a symlink provided by systemd-sysvcompat that does nothing more than execute systemctl, which is exactly the same as calling systemctl poweroff. This also goes for the other power management binaries.

25 points
unknown author1 hidden

Deleted before we saved it.

2 points

It is advised because the direct commands like poweroff are only available for compatibility reasons. Red Hat wants to migrate its users away from those, so that they don't need to provide those forever. You also can't know whether Arch will keep shipping those, but I think it's safe to say that they'll be around for a while.

7 points
$ ls -lh /usr/bin/power*
lrwxrwxrwx 1 root root 9 Sep 22 20:35 /usr/bin/poweroff -> systemctl

Does that answer your question?

7 points
unknown author2 hidden

Deleted before we saved it.

3 points

When systemctl gets executed via that symlink it recognizes that the original link is named poweroff and performs poweroff.

12 points

I have no idea what is the best way, but i use this alias:

alias fim='sync && sudo systemctl poweroff'

I am using it have more than 5 years, without any problem.

2 points

This is dangerous, if someone gets access to your $HOME they can replace the systemctl poweroff with literally anything else and you'd blindly type out your root password into it, easiest privilege escalation exploit I've ever seen.

I'm assuming it does ask for the root password though since you don't usually need it for personal computers.

0 points

I'm not sure the alias changes much about that attack vector. With access to $HOME you can prepend things to $PATH, so you can inject a script called pacman (for example) that checks if it has root and if so does Bad Things, and then in either case forwards to the real one.

10 points

This attack vector will be present for every single alias that you use in your shell rc files. Does that mean we should just stop using aliases? No! Just don't allow randos to access your home directory if you're so worried about malicious activities.

/u/semeionic: If you have polkit installed and running, then you don't even need sudo in your alias. systemctl poweroff should work just fine (EDIT: Doesn't work if you're not an admin or if another user is logged onto the system).

3 points

Hum... Never thought of that.

I guess alias docker='sudo docker' is not good either.

But, what if I was putting my special sudo aliases in a file owned by root. It should be safe, right ?

1 points

What the egg? Systemd is responsible for powering off my computer too? It really has its claws and flaws in everything these days.

1 points

init has more or less always been in control of shutdown/reboot, see 1, so this may be the least controversial function systemd could have taken over

the only thing in that domain that systemd took on that wasn't in SysV is control of suspension/hibernation, in lieu of pm-utils et al.

2 points

Disclaimer: Personal experience

So I use i3wm with Arch Linux. I had a key binding with 'systemctl poweroff' and a button on polybar with 'shutdown now'. I used to use the keybinding but everytime I used to boot up, the internet would go away after a few minutes. Then after using 'shutdown now', it doesn't. I have had uptime of more than a few days now with no internet downtime.

https://www.reddit.com/r/archlinux/comments/cylrvs/the_internet_seems_to_go_down_after_sometime/

0 points
unknown author5 hidden

Deleted before we saved it.

2 points

This is what confuses me. Also, systemctl suspend never seems to work. My laptop gets overheated and it freezes on trying to resume from it.

1 points

Both invoke the same thing under a systemd system.

systemctl isolate poweroff.target has the shorthands:

shutdown -P now

telinit 0

shutdown now

systemctl poweroff

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.