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
Reboot broken on Ubuntu 16.04 hosts #1488
Comments
It is exactly the same with run('reboot') |
It being the same with a manual Nothing obvious springs to mind, but See Line 1244 in c0224a5
Also try enabling Paramiko's logging (see bottom of our troubleshooting page - http://www.fabfile.org/troubleshooting.html) as it might yield a clue. |
Actually, on second thought, it sounds like Ubuntu's If you look at the The fact that, on Fabric's end, execution is just hanging out within the Offhand thought - we could perhaps set Only downside would be the case where |
An other really strange, changed behaviour in Ubuntu 16.04 is the following. When I run I'm really not into the deep pockets of SSH connection handling, but this might be the exactly the same issue as with reboot. |
I've just run into broken reboot (fresh up-to-date Ubuntu 16.04 on AWS, Fabric==1.12.0) but in a different way. For me it just throws:
Running |
May be worth noting:
|
And another weird thing. I've changed the rebooting code to use aws-cli and after its call (which takes ~1sec, seems like it's asynchronous) I run
Then I tried to make fabric to reconnect by adding
And it started to work only after I added e.g. |
The problem seems to be that "reboot" is now sometimes "too fast", before the status of the command gets back over the ssh connection. (Tip: If you're at a frozen ssh connection as a result: type One solution is to use A hacky thing to try: |
this is probably a dup of #1444 |
If the init daemon is switched to upstart reboot works as expected. It looks like systemd is killing sshd immediately. |
There was a bug on the Debian/Ubuntu's package of systemd that, on shutdown, killed the network service before the SSH one so everything hang. |
Reported the bug for Ubuntu: |
I also had issues regarding the usage of reboot() in some of my scripts. I found out that when connecting with a password, the reboot was working correctly, but when using keyfile-authentication, the connection hung up (an the reboot was done). |
The ubuntu bug https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1645002 is marked as fixed in 16.10, but not yet in 16.04, and unclear when it will be. The current behavior for me is that paramiko/fabric instantly detect that the ssh connection was closed, but it's before paramiko/fabric sees the reboot command to have completed. At least it doesn't hang indefinitely as in the original report.
Plain I've found a short and elegant workaround, as I suggested without as much detail above: reboot(command="shutdown -r +0") That worked as expected for me (in my handful of tests against AWS EC2 and local virtualbox VM, all running up-to-date ubuntu 16.04). Note that "shutdown -r now" behaved like "reboot" and did not seem to work. I took a quick look at the freebsd and openbsd man pages, and it looks they have a shutdown command that supports those parameters. I suspect that the command "shutdown -r +0" would work for pretty much any unix system which "reboot" worked on. So it could be considered for changing the default command, or updating the documentation. (But I'd be interested to see a report of a test on a BSD system first.) |
Despite all of this hand waving, the next command hangs indefinitely. Is it possible that the connection pool is holding onto (and using) the dead connection? If so, is there a workaround? Can I temporarily reduce the connection-level timeout? |
Indeed, you need to replace the existing connection, the way https://github.com/fabric/fabric/blob/1.13.2/fabric/operations.py#L1289-L1294 |
Apologies to revive an old issue, I can also confirm that this problem happens when attempting to reboot a LXC container. @ploxiln's suggestion of using |
Confirming this error on a fresh install of FreeBSD 11.1 with bash installed:
|
I ended up needing this to get things going after reeding @ambsw-technology and @ploxiln comments. I'm running against an ubuntu 16.04 LTS server (from a windows client).
|
FYI, I still see this against 18.04.2 LTS servers. |
Any fix for this? also getting issue with 16.04 |
The built in
reboot()
function, which has been working perfectly both on Ubuntu 14.04 and FreeBSD 10.x hosts, but is broken on Ubuntu 16.04 hosts.What is happening on Ubuntu 14.04:
I receive an output like this and the system reboots, after the reboot Fabric reconnects.
What is happening on Ubuntu 16.04:
If I press the enter key in this state, Fabric actually continues, but shows this message before:
I am using this code for reboot:
The text was updated successfully, but these errors were encountered: