关机和重启按钮

关机和重启按钮

我是 Ubuntu 的新手,刚刚安装。问题是关机和重启按钮不起作用。我通过长按笔记本电脑上的电源按钮关闭电脑。如何解决这个问题?

答案1

1)要关机,请输入以下命令:

sudo poweroff

或者:

sudo shutdown -h now 

重新启动类型:

sudo reboot

2)编辑/etc/acpi/events/powerbtn

打开终端并输入:

nano /etc/acpi/events/powerbtn

它将是这样的:

# /etc/acpi/events/powerbtn
# This is called when the user presses the power button and calls
# /etc/acpi/powerbtn.sh for further processing.

# Optionally you can specify the placeholder %e. It will pass
# through the whole kernel event message to the program you've
# specified.

# We need to react on "button power.*" and "button/power.*" because
# of kernel changes.

event=button[ /]power
action=/etc/acpi/powerbtn.sh

要保存,请键入Ctrl+O并点击enter 要退出,请键入Ctrl+X

编辑/etc/acpi/powerbtn.sh并添加以下行:

# If all else failed, just initiate a plain shutdown.
/sbin/shutdown -h now "Power button pressed"

保存,退出并输入:

sudo service acpid restart

相关内容