Just to understand the steps above and try to apply them to Ubuntu Server 20.20. So far it is not yet working for me, but hoping with the summary, we can identify what needs to be adjusted.
Add dtoverlay=dwc2 to the /boot/config.txt
Add modules-load=dwc2 to the end of /boot/cmdline.txt
Replaced by 1) in your `/boot/firmware/usercfg.txt` file, you'll want to add `dtoverlay=dwc2,dr_mode=peripheral`. (I haven't tested it w/o the dr_mode=peripheral argument, so this might still work).
But does this really cover the modules-load bit?
If you have not already enabled ssh then create a empty file called ssh in /boot
Add libcomposite to /etc/modules
Install dnsmasq with sudo apt-get install dnsmasq
Remains the same
Create /etc/dnsmasq.d/usb with following content
Remains the same but add "port 0" at the end
Add denyinterfaces usb0 to /etc/dhcpcd.conf
Create /etc/network/interfaces.d/usb0 with the following content
Replaced by 3) Instead of using the traditional `/etc/network/interfaces.d/usb0`, you can also use the default netplan setup for Ubuntu. Here is an example what what mine looks like (stored as /etc/netplan/99-custom.yaml):
Make /root/usb.sh executable with chmod +x /root/usb.sh
Remains the same, though potentially the last 2 lines can be disabled
Add /root/usb.sh to /etc/rc.local before exit 0 (I really should add a systemd startup script here at some point)
Remains the same once rc.local has been setup https://www.linuxbabe.com/linux-server/ ... th-systemd
*Update* Managed to fix the " For now it hangs for several minutes at "A start job is running .."." bit .. was due to not cleaning up the "/etc/netplan/99-custom.yaml" example. Also note one should run "sudo netplan generate; sudo netplan apply" after making changes to the netplan configs.