I've just invested some hours struggling to get my PC not to Wake from Suspend. My hope in writing this, is that it may help others wanting the same thing to easily achieve it too. I've searched the web extensively to find this fix, and was happy to find it right here in the Mate Community, thanks to a post by karnemelk. By the time you read this, I hope the amazing Ubuntu & Mate teams will have created a simple point and click solution sparing you from even these three simple steps.
There are two reasons I'm writing this, rather than just link to that post. First, some newbies might appreciate the more basic 3-Step copy & paste process I'll outline. Secondly, I'll only briefly mention the other more complex main approach I found online and tried unsuccessfully as described in more detail with these posts.
The Problem:
I use Suspend on a PC to save the state of my work, and don't want the USB keyboard or USB Bluetooth mouse to wake the PC if they're bumped during Suspend. Instead I use the Power Button to wake the PC. I had set this with a Disable USB Wakeup setting in the PC BIOS and it worked fine until a couple of weeks ago when Software Updater (perhaps for security reasons) apparently did something that made Mate start ignoring my BIOS setting. While trying to get it working again, I updated my BIOS but it made no difference to this problem.
What Didn't Work:
Countless websites (and some posts here in the Mate Community) suggest using an echo command to send the USB device name(s) to a file named
/proc/acpi/wakeup
but no variation of that worked. PCs differ, so those approaches might work for you if this one doesn't. I'll outline my PC details below in case that's helpful.
Three Simple Steps to Success:
Step 1. Create a /etc/systemd/system/acpi-wake.service file and copy several lines of specific variables and a command line into it.
*NOTE: You'll need to input your Password for each of these three steps, so be sure you have it handy before starting.
A. Open the Mate Teminal app. In my Ubuntu Mate 20.04.1 it's in the Panel Menu under System Tools.
B. Launch the Nano command line app by highlighting and copying the line below, then pulling down Edit at the top of the Terminal window and clicking Paste. Once the line in the Terminal window matches the one below, tap the Enter key and then input your Password at the prompt, to run it. Here then, is the command to copy/paste into the Terminal:
sudo nano /etc/systemd/system/acpi-wake.service
C. Highlight, Copy, and Paste all of the text in the box below, into the Nano window that's now running in your Terminal app:
[Unit]
Description=ACPI Wake Service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "for i in $(cat /proc/acpi/wakeup|grep enabled|awk '{print $1}'|xargs); do [ $i != PBTN ] && echo $i|tee /proc/acpi/wakeup;done"
[Install]
WantedBy=multi-user.target
Note that the command line in the middle of the box is long and may extend beyond the edge of the box above, and of the Nano window when you paste it in. You may have scrollbars at the side, bottom or top of your web browser, Terminal and/or Nano window(s) that enable you to see the whole thing during copy and paste if you're curious. But if you start your mouse inside the top-left of the box above and drag to the bottom inside of the box, all of the text will be highlighted even if it extends beyond the right margin. Here's how it looks after pasting into Nano on my PC:
D. Save the file and Exit the Nano app. To do that, first hold down the Ctrl key and tap the letter "O" key (lower or UPPER case works fine) to "Write Out" (Save) the file. It's already named by the "sudo..." command line you pasted into the Terminal app to launch Nano in Step 1.B above. Now you can Exit the Nano app by holding down the Ctrl key and tapping the letter "x" key.
Step 2. Launch the file with the Start command. Copy the line in the box below, and paste it into the Terminal window, tap the Enter key, and input your Password at the prompt.
systemctl start acpi-wake.service
Step 3. Activate the file with the Enable command. Copy the line in the box below, and paste it into the Terminal window, tap the Enter key, and input your Password at the prompt.
systemctl enable acpi-wake.service
You're done. Now to test whether this method works on your PC, just Suspend it using your normal method and then try tapping keys and mouse buttons. If it doesn't work, you could try the methods that didn't work for me or post a Help request to see if someone can come up with a way to do it.
If you want to only disable one or more specific input devices from waking your PC, it's more complex because you'll need to find the code(s) for such device(s) and either change the long command you put into the
/etc/systemd/system/acpi-wake.service
file with Nano above, or do that using one of the more complex methods that didn't work for me. If that's your goal, post a followup question and maybe someone can help. Good luck!
System Details:
I strongly suspect this will work on most if not all PCs running Ubuntu Mate 20.04.1 with all Updates applied. As mentioned above, simply setting the BIOS to disable USB from waking the PC used to work fine with this Mate version and the Mate wizards may already be working on an easy way to do it somewhere in the System Settings apps or elsewhere. Here then are my system details:
Kernel Linux 5.4.0-56-generic x86_64
MATE 1.24.0
Dell Desktop
BIOS version 2.13.0
Mfg. 11/2019
RAM 12GB
CPI Core i5-9400 2.9GHz