{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixops/issues/286","labels_url":"https://api.github.com/repos/NixOS/nixops/issues/286/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixops/issues/286/comments","events_url":"https://api.github.com/repos/NixOS/nixops/issues/286/events","html_url":"https://github.com/NixOS/nixops/issues/286","id":70379288,"number":286,"title":"Nixops locks itself out of virtualbox guests","user":{"login":"berdario","id":752835,"avatar_url":"https://avatars.githubusercontent.com/u/752835?v=3","gravatar_id":"","url":"https://api.github.com/users/berdario","html_url":"https://github.com/berdario","followers_url":"https://api.github.com/users/berdario/followers","following_url":"https://api.github.com/users/berdario/following{/other_user}","gists_url":"https://api.github.com/users/berdario/gists{/gist_id}","starred_url":"https://api.github.com/users/berdario/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/berdario/subscriptions","organizations_url":"https://api.github.com/users/berdario/orgs","repos_url":"https://api.github.com/users/berdario/repos","events_url":"https://api.github.com/users/berdario/events{/privacy}","received_events_url":"https://api.github.com/users/berdario/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-23T10:56:26Z","updated_at":"2015-04-23T12:10:46Z","closed_at":null,"body":"I guess this could be related to [this issue](https://www.virtualbox.org/ticket/8796), still it'd be nice if there was an easy way to work around this.\r\n\r\nFailing that, this should at least be documented in the manual, so that the suggested example configuration for deployments on VirtualBox will statically specify ip addresses.\r\n\r\nthis is the `dev.nix` of (which is pretty much the example trivial-vbox.nix from the manual):\r\n\r\n```\r\n{\r\n    network.description = \"dev\";\r\n\r\n    devmachine = { config, pkgs, ... }:\r\n    {\r\n        environment.systemPackages = with pkgs; [\r\n          socat\r\n        ];\r\n        deployment.targetEnv = \"virtualbox\";\r\n        deployment.virtualbox.memorySize = 2000; # megabytes\r\n    } ;\r\n}\r\n\r\n```\r\n\r\nThe machine was originally deployed just fine, on 192.168.56.102, this is the partial output of `nixops export -d dev`:\r\n\r\n```\r\n{\r\n  \"72421978-e769-11e4-a07e-34e6d704a2e9\": {\r\n    \"configsPath\": \"/nix/store/khfc6iqvgps30lx3nlw6j6rpna41xma1-nixops-machines\", \r\n    \"description\": \"dev\", \r\n    \"name\": \"dev\", \r\n    \"nixExprs\": \"[\\\"/home/dario/Projects/nixmachines/dev.nix\\\"]\", \r\n    \"resources\": {\r\n      \"devmachine\": {\r\n        \"configsPath\": \"/nix/store/khfc6iqvgps30lx3nlw6j6rpna41xma1-nixops-machines\", \r\n        \"index\": \"0\", \r\n        \"keys\": \"{}\", \r\n        \"privateIpv4\": \"192.168.56.102\", \r\n        \"publicVpnKey\": \"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFEGIBeQMwuDyHYL7V+2fJSWgAXr8NaPgvbdP4kfLojVzlTYWnUxcg/VNvbbNhsH68/uCLhly5hPkbQoUM/cy2Q= NixOps VPN key of devmachine\", \r\n        \"sshPinged\": \"1\", \r\n        \"state\": \"3\", \r\n        \"storeKeysOnMachine\": \"0\", \r\n        \"toplevel\": \"/nix/store/kvj6vak0jpykp22dr9icqia8ca7v62ny-nixos-15.05pre59184.e07ea5c\", \r\n        \"type\": \"virtualbox\", \r\n        \"virtualbox.disks\": \"{\\\"disk1\\\": {\\\"path\\\": \\\"/home/dario/.VirtualBoxVMs/nixops-72421978-e769-11e4-a07e-34e6d704a2e9-devmachine/disk1.vdi\\\", \\\"attached\\\": true, \\\"port\\\": 0, \\\"created\\\": true}}\", \r\n        \"virtualbox.sataControllerCreated\": \"1\", \r\n        \"vmId\": \"nixops-72421978-e769-11e4-a07e-34e6d704a2e9-devmachine\"\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n```\r\n\r\nand this is the output of `VBoxManage guestproperty get nixops-72421978-e769-11e4-a07e-34e6d704a2e9-devmachine /VirtualBox/GuestInfo/Net/1/V4/IP`:\r\n\r\n    Value: 192.168.56.101\r\n\r\nIf I manually connect with ssh, add 192.168.56.102 as another address, redeploy and then reboot I keep getting the new 192.168.56.101 address.\r\n\r\nEven if I add `deployment.targetHost = \"192.168.56.101\";` to the machine configuration, it'll get ignored since nixops still thinks that the machine is accessible on the old address...\r\n\r\nI now worked around this by manually ssh into it, adding the old address, add the following to the configuration:\r\n\r\n    networking.interfaces.eth1.ip4 = [ { address = \"192.168.56.101\"; prefixLength = 24; } ];\r\n\r\nredeploying, and now even after reboot it sticks...\r\n\r\nWeirdly, if I try to change it back with \r\n\r\n    networking.interfaces.eth1.ip4 = [ { address = \"192.168.56.102\"; prefixLength = 24; } ];\r\n\r\nThe change is not picked up correctly by nixops, even after the successfull deploy, and will thus locks itself out again"},"comment":{"url":"https://api.github.com/repos/NixOS/nixops/issues/comments/95562838","html_url":"https://github.com/NixOS/nixops/issues/286#issuecomment-95562838","issue_url":"https://api.github.com/repos/NixOS/nixops/issues/286","id":95562838,"user":{"login":"edolstra","id":1148549,"avatar_url":"https://avatars.githubusercontent.com/u/1148549?v=3","gravatar_id":"","url":"https://api.github.com/users/edolstra","html_url":"https://github.com/edolstra","followers_url":"https://api.github.com/users/edolstra/followers","following_url":"https://api.github.com/users/edolstra/following{/other_user}","gists_url":"https://api.github.com/users/edolstra/gists{/gist_id}","starred_url":"https://api.github.com/users/edolstra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edolstra/subscriptions","organizations_url":"https://api.github.com/users/edolstra/orgs","repos_url":"https://api.github.com/users/edolstra/repos","events_url":"https://api.github.com/users/edolstra/events{/privacy}","received_events_url":"https://api.github.com/users/edolstra/received_events","type":"User","site_admin":false},"created_at":"2015-04-23T12:10:46Z","updated_at":"2015-04-23T12:10:46Z","body":"Yeah, it's very annoying that the IP addresses assigned by VirtualBox's DHCP server changes so quickly. The only workaround at the moment is to run \"nixops deploy --check\" - that should detect the new IP address."}}