Ubuntu: Disable IPv6

After an auto-update of ubuntu starting with 18.04 and through 19.10, tvheadend didn't seem to work reliably. Rebooting showed everything to be running as expected but after 20 minutes of inactivity the system would go to sleep or hibernate. I ran the following commands recommended by this link:

$ gsettings set org.gnome.desktop.session idle-delay 0

$ sudo systemctl mask sleep.target suspend.target hibernate.tar

I am not quite sue what happened. The system would shut off at random times during the day. The changes above didn't fix the issue. Disk utilities didn't find any corruption. dmesg didn't show anything wrong. I edited the file to find when it stopped logging, and looked at last process running:

$ sudo nano /var/log/syslog

One of the last lines referred to:

Started Network Manager Script Dispatcher Service

and the following were trying to use ipv6. Since I don't use ipv6, I edited the file:

$ sudo nano /etc/sysctl.conf

and added the following lines at the end:

#Disable IPv6

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

net.ipv6.conf.eth0.disable_ipv6 = 1

This seems to work, but I am not enough of an expert in ubuntu or TVheadend to know why this works.