4

I have firewalld working following the answer Firewalld does not start at boot.

I have hybrid-sleep working following How do I use pm-suspend-hybrid by default instead of pm-suspend?

However, if firewalld is active and I close the lid to initiate hybrid-sleep, then the system freezes with black screen. If I initiate normal sleep via power cog menu > Suspend then the computer suspends fine. I can also get the computer to hybrid-sleep if I stop the firewalld service before putting the computer to hybrid-sleep.

My computer is running Ubuntu 16.04.2 LTE with HWE.

My question is how do I prevent the conflict between firewallD and hybrid-sleep?

Thanks

user68186
  • 33,360

1 Answers1

4

Update April 23, 2018: Fixing the root cause solves this problem

Root Cause

The service file - /lib/systemd/system/firewalld.service says firewalld conflict with ebtables.service which is enabled by default in Ubuntu 16.04.

Solution

Disable and mask ebtables.service with the following two commands:

sudo systemctl disable ebtables
sudo systemctl mask ebtables

This resolves the issue with FirewallD and hybrid-sleep and the associated problem of Firewalld does not start at boot

Thanks to alfred's answer to the above question

Original answer:

Stop firewalld before hybrid-sleep and start it at resume

Background

Put a bash script file in /lib/systemd/system-sleep/. Immediately before entering system suspend, hibernate, or hybrid-sleep the systemd-suspend.service (and the respective equivalents) will run the bash script in /lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be pre, the second either suspend, hibernate, or hybrid-sleep depending on the chosen action.

Immediately after leaving system suspend, hibernate or hybrid-sleep the same bash script is run, but the first argument is now post.

Source: https://www.freedesktop.org/software/systemd/man/systemd-suspend.service.html

How to do it:

Create a text file: /lib/systemd/system-sleep/firewalld-sleep.sh with the following content:

#!/bin/bash
case $1/$2 in
    pre/*)
    # Disable firewalld before hybrid-sleep
    systemctl stop firewalld.service    
    ;;
    post/*)
    # Enable firewalld after hybrid-sleep
    systemctl start firewalld.service
    ;;
esac

Make the file executable. See http://askubuntu.com/questions/484718/how-to-make-a-file-executable for details.

Note, the script stops the firewalld before any of the three types of sleep/hybernate/hybrid-sleep and starts it again at resume.

Now firewalld and hybrid-sleep will coexist and system will not freeze if you close the lid while firewalld is running.

Hope this helps

user68186
  • 33,360