I installed Ubuntu 16.04 on Raspberry pi 3 but when I edit /etc/network/interfaces to setup a static ip it gets replaced with default settings on startup. Looks like cloud-init is managing the network settings. How do you manage cloud-init?
Google rendered no help.

  • I found a workaround : "sudo apt remove cloud-init" -- problem solved! – Peter Quiring Sep 16 '16 at 21:27
  • Any other "official" way to do this? I ended up removing cloud-init, but am wondering whether there is way to configure it using cloud-init – redshift5 Nov 18 '16 at 6:44

I tried simply apt remove'ing cloud-init on the latest 16.04 server image from Pi Flavour Maker, and it rendered my system unbootable. This tip for a different Ubuntu (probably the official desktop 18.04) warns that there may be other processes that depend on cloud-init, and those dependencies aren't automatically cleared up by removing it: gotcha warning about 18.04

You just deployed yourself a fresh copy of Ubuntu Server 18.04 Bionic Beaver. It should be the latest and greatest, and you just need a virtual machine to do some web development or perhaps you just want to enable IP forwarding and use this machine as a router. That's great, except the latest Ubuntu assumes that you are part of the current trend to put everything in the cloud, and so ships with something called cloud-init.

No harm normally, but this wastes valuable seconds doing something you don't need if you're not in the cloud. It’s easy to remove this package by following the (modified) instructions here:

dpkg-reconfigure cloud-init

Then deselect all the options except None.

sudo apt-get purge cloud-init
sudo mv /etc/cloud/ ~/; sudo mv /var/lib/cloud/ ~/cloud-lib

I prefer to move, rather than delete, in case something goes wrong and you wish to restore the files.

When you remove cloud-init following those steps, your machine stops booting and there is apparently a service that is waiting for network to be up. This would normally be just an inconvenience, but the boot hangs indefinitely waiting for said network. Odd choice of configuration out of the box, but anyway, you can fix this by:

  • List the services which depend on network being online.

    sudo systemctl show -p WantedBy network-online.target

    This will list the culprits as some iscsi services that you probably don’t need.

  • Disable the services and remove the open-iscsi package

    systemctl disable <service name>
    sudo apt remove open-iscsi

That should do to get the system booting without some service waiting endlessly for a network connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.