Sithuk / ubuntu-server-zfsbootmenu

Ubuntu zfsbootmenu install script
123 stars 28 forks source link

Delete /etc/netplan/*.yaml config for desktop installs #6

Closed w194 closed 2 years ago

w194 commented 2 years ago

The config in /etc/netplan/*.yaml needs to be deleted and netplan apply needs to be executed when a desktop is installed, else the network config becomes a unstable because it conflicts with NetworkManager and the Desktop

Sithuk commented 2 years ago

Sounds like a sensible change, thank you. I'll look into this next time I test.

Sithuk commented 2 years ago

I'm not sure deleting the yaml file is necessary according to the Ubuntu documentation (I've linked an extract from the documentation below). I'll test further to see what happens when leaving the yaml in place. Which desktop install did you experience a conflict between the yaml created by the script and NetworkManager?

https://ubuntu.com/core/docs/networkmanager/networkmanager-and-netplan "The default netplan configuration files in Ubuntu Core leave management of networking devices to networkd. But, when network-manager is installed, it creates new netplan configuration files, setting itself as the default network renderer and taking control of all devices."

w194 commented 2 years ago

Not sure how relevant the extract is because Ubuntu Core usually doesn't has a desktop like GNOME or KDE Plasma. It's used to build embedded Linux systems.

I installed the kubuntu variant via ethernet. When I had the desktop running I switched to Wi-Fi but it was unstable and lost DNS all the time despite me not having ethernet cable connected. Then I deleted the file and ran netplan apply and it worked.

Sithuk commented 2 years ago

You make a valid point about Ubuntu Core. My testing shows that installing NetworkManager doesn't seem to cause NetworkManager to be set as the default renderer. The fix seems to be to set the renderer to NetworkManager in the yaml. Works for the "xubuntu" and "desktop" variants. I'm going to test a little more then roll out the fix.

Sithuk commented 2 years ago

I've updated the script to set NetworkManager as the netplan renderer when installed. It works with a xubuntu VM install and a gnome3 VM install. Are you able to test it with your kubuntu install?

w194 commented 2 years ago

Thanks the fix seems to work with the DNS bug. But now the problem is I can't change the ethernet settings from GUI without them being overridden at next boot. I think the file shouldn't exist on desktop installs, so I will keep it deleted. I don't think the file is necessary because NetworkManager will automatically detect that there is an ethernet cable plugged in and will automatically use DHCP or failback to link local address.

w194 commented 2 years ago

I guess there can be a netplan config but it should look like this (without additional configuration)

# cat /etc/netplan/networkmanager.yaml 
network:
  version: 2
  renderer: NetworkManager

Then

sudo netplan generate
sudo netplan apply
sudo reboot

This seems to be the best config so far, for me. I even have WireGuard working now in NetworkManager. So you are right the renderer: NetworkManager part is absolutely necessary. But I would keep the network config in the GUI (or configured using nmcli when CLI is needed) to have it all in one place, Wi-Fi, ethernet, VPN....

Sithuk commented 2 years ago

Thank you for the feedback, particularly the conflict with the ethernet settings. I'll test the changes you've suggested.

Does wifi auto configure ok with NetworkManager or did you have to install additional packages? I'm aware that an ethernet connection is needed to continue the install following the first reboot. Ideally, if the user is using wifi for the initial install, then the wifi connection should be able to be used for the post reboot install too. I do my testing in a VM, and I'm not sure how I can emulate a WiFi connection with the VM. So I haven't done any testing for WiFi setups. So an ethernet connection is currently the only way to fully run the script.

w194 commented 2 years ago

For the first script run I had WiFi because I booted into Kubuntu Live and connected there via GUI. But after reboot I had no connection any more. But since my device has ethernet I could continue the installation there. I don't think NetworkManager is installed in this step, so I wouldn't be able to connect to Wifi from here I guess.

Maybe the second script run should detect if there is an internet connection and exit before any changes are made because you can't easily repeat the script on failures.

I also had the problem that the initial (GUI-less) installation wanted to use a huge amount of different apt mirrors at the same time and not every mirror worked. This made the script fail and since it's not easily repeatable I had to comment out several steps. For my next try I adapted my /etc/apt/sources.list to one single close by mirror. The Ubuntu default URL seems to be a bad choice for running this script.

Sithuk commented 2 years ago

The suggestion to check for internet connectivity for the "postreboot" part of the script is a good one.

It might also make sense to install NetworkManager in the first part of the script and somehow copy the wifi settings used in the live iso. I'm not likely to try any code for WiFi until I can test it easily though.

I'd like to keep as close to the default Ubuntu design choices as I can for the script. Users can then adapt it to their own specific needs. I'll keep the default sources for now.

I pushed revised code earlier that should resolve the NetworkManager ethernet conflict. Thank you again for the feedback.

Sithuk commented 2 years ago

I noticed an issue with a conflict between NetworkManager and systemd-networkd. I've tweaked the code today to disable systemd-networkd when NetworkManager is installed. The approach should now reflect the main Ubuntu Live cd.

I also noticed an error at startup relating to a SSSD dependency. It's a known bug and the fix is reported here. Did you experience it too with your Kubuntu install? https://askubuntu.com/questions/1288626/ubuntu-20-10-sssd-system-security-services-daemon-failure

Sithuk commented 2 years ago

I've also added the internet connectivity check before the postreboot part of the script.

w194 commented 2 years ago

I also noticed an error at startup relating to a SSSD dependency. It's a known bug and the fix is reported here. Did you experience it too with your Kubuntu install?

No, it looks like a GNOME problem.