-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NixOS Azure image #3986
Comments
I'm interested in working on this later this week |
Azure usually works with an agent: https://github.com/Azure/WALinuxAgent |
The agent gets the password (that is entered in the console) from a file on the filesystem:
I think it is being written by the hypervisor on the root filesystem. Personally, I don't like agents like this which create users and change system configuration. |
@wmertens do you mean next week, or this weekend? |
@rbvermaa from Tuesday onwards I don't like agents like that either but I assume they can be configured to only do what's needed to allow access to NixOS... (eg ssh key for root, which gets reset on the next run? |
@rgardler Trying to run a generated NixOS image on Azure. However, it seems to be stuck in provisioning stage. Any way to e.g. get console output or more logging?
|
@rgardler No technical support for 'Free Trial' accounts? Seriously? |
Progressing... I can SSH into a NixOS machine that is in provisioning status, but only from another machine that has been provisioned on Azure. |
@rbvermaa I'm here what more do you need in the way of technical support ;-) (probably someone with more technical skills than me, but at least I know who to ask) You can use a working Linux machine in Azure (for example standard Ubuntu machine based on azure gallery image) and attach the OS disk of failed NixOS as a data disk to this Ubuntu VM. Once you checked the log, you can detach and delete the data disk. |
@rbvermaa what is the state of this? |
@wmertens See my latest comment. Also, the image build function currently needs to have a ssh-pub-key in the NIX_PATH, which hardcodes the SSH public key for root. The metadata 'cdrom' is mounted at /metadata. Next step should be to parse the info there and process SSH public key that is passed to the instance, and make it appear in /root/.ssh/authorized_keys. This would eliminate the need to hardcode the SSH public key in the image. Then we need to figure out why the machine does not get into 'running' state, which seems to prevent the Azure firewall from applying the firewall rules. They seem to be passing some API endpoint address via 'option 245' in DHCP (https://github.com/Azure/WALinuxAgent/blob/2.0/waagent#L4094), which is then used to pass some status information to the API. This is done in the agent somewhere I think. |
…available via "custom data"; see #3986
The current status is: if you provide the right custom data, the image boots,
obtains IPs and otherwise works.
Agent is still a todo item and without it, the vm is going to be permanently
"provisioning" and will fail load balancer health checks.
Unfortunately, the agent is a mess. It insists on rewriting files, making
substantial config changes. It isn't that hard to stub/comment out the unwanted
things, but it's a very flaky solution because there are many of them and an
agent update can arrive at any time. Reimplementing the relevant functionality
also doesn't look very feasible either :(
Luckily, we still have basic functionality working without it, so at least the
chance of bricking hundreds of vms is low.
|
Couldn't we just package https://github.com/Azure/WALinuxAgent ourselves? |
The problem is not about packaging it, but that it needs heavy patching in so
many places. Thus, not only it's a headache, but everytime there's a new
release, there's quite some work to do review the patch.
I have opted for now for a dumb solution which at least ensures the image
boots and is reachable.
Of course this isn't the final decision or anything. This is a bare minimum
which doesn't look too ugly and unblocks the development.
|
+1, was just offered free Azure and thought of playing with NixOS first |
@Phreedom whats the dumb solution? |
no agent, ssh keys are
provided via metadata and
fetched by a simple systemd
job
|
@Phreedom any chance you could walk through that in a bit more detail? |
Hi all, I'm from the team that owns the WALinuxAgent, we would like to enable the agent to support NixOS and enable NixOS running in Azure. I was learning NixOS but not much familiar yet, so it's great to see the discussion here. |
@lizzha : I will be doing some azure-related work in @*ericbmerritt[1] Sorry for not replying sooner. I |
On Thursday, November 26, 2015 21:59:31 lizzha wrote:
I have patched WALinuxAgent and added support for it in NixOS azure image. See The image can now be correctly provisioned by azure-cli and its status ends up being Feedback and testing are welcome. This is a sample script to build the image: Unfortunately, at this moment you are likely to encounter bugs To work around them, you may have to revert qemu to 2.2.0, and in azure-image.nix add |
@Phreedom I will attempt to give this a test in the next few days. |
@Phreedom
If I install it by this command |
Sorry for the delay. Packaging azure-cli took some effort. You can get a shell with azure-cli by running Also, I have pushed a temporary branch with the qemu patches reverts and other workarounds: https://github.com/Phreedom/nixpkgs/commits/revert-qemu This is how you could build the image(tested on a nixos machine): cd $TEMP
git clone https://github.com/Phreedom/nixpkgs.git
cd nixpkgs
#checkout the workaround branch
git checkout revert-qemu
#build the image
NIXOS_CONFIG=$TEMP/nixpkgs/nixos/modules/virtualisation/azure-image.nix NIX_PATH=$TEMP nix-build '<nixpkgs/nixos>' -A config.system.build.azureImage --argstr system x86_64-linux -o azure --option extra-binary-caches https://hydra.nixos.org -j 4
# the image hopefully ends up in $TEMP/nixpkgs/azure//disk.vhd
# get azure-cli running
NIX_PATH=$TEMP nix-shell -p azure-cli
# azure-cli becomes available in this shell only
azure login An image built using this branch is available at https://nixos.blob.core.windows.net/images/nixos-unstable-standalone.vhd |
I have removed the distinction between nixops and "standalone" images, packaged azure-vhd-tools-for-go, updated image generation and upload scripts for maintainers, pushed this into nixos master, regenerated the default image and tested it. The base commit for the current image is 158d723 . |
cherry-picked all the relevant commits into 16.03 and tested |
The text was updated successfully, but these errors were encountered: