Code Monkey home page Code Monkey logo

Comments (7)

butjar avatar butjar commented on June 28, 2024

Do the logs help or should I step in with pdb ?

from ipmininet.

jadinm avatar jadinm commented on June 28, 2024

It seems to be in the Mininet cleanup code but I really don't see why it would be blocked so long there.
I guess that doing mn -c doesn't block?

I can try to install the same Mininet version as yours.
Maybe it will help to reproduce the bug on my VM.
Which one is it?

Otherwise, yes, using pdb might give better information on the issue.

from ipmininet.

jadinm avatar jadinm commented on June 28, 2024

If you replace the cleanup() call in ipmininet/test/test_sshd.py by pass, does the test succeed?

Afterwards, you might need to call sudo python -m ipmininet.clean, the equivalent of mn -c for IPMininet to clean remaining processes.

from ipmininet.

jadinm avatar jadinm commented on June 28, 2024

@butjar Actually I might have a lead...

Could you check your /etc/shadow file and tell me if there is the line with the root user of your VM starts with "root:!" or with "root:*"?
If you see the first string, it means that the root account is locked and by default sshd won't allow you to login to the account (unless UsePAM is set to 'yes').

Moreover, there is an issue in the test that makes it loop forever if the ssh command fails.

So this could explain why the test takes forever in your VM while it does not in mine.

from ipmininet.

butjar avatar butjar commented on June 28, 2024

If you replace the cleanup() call in ipmininet/test/test_sshd.py by pass, does the test succeed?

Afterwards, you might need to call sudo python -m ipmininet.clean, the equivalent of mn -c for IPMininet to clean remaining processes.

Seems not to be in cleanup. After removing the cleanup,

--- a/ipmininet/tests/test_sshd.py
+++ b/ipmininet/tests/test_sshd.py
@@ -32,4 +32,5 @@ def test_sshd_example():

         net.stop()
     finally:
-        cleanup()
+       pass
+        #cleanup()

the test didn't come back either (should be finished roughly in about 1.5 min).

I guess the test does not come back because you are not incrementing t:

diff --git a/ipmininet/tests/test_sshd.py b/ipmininet/tests/test_sshd.py
index ece2e6e..f57844c 100644
--- a/ipmininet/tests/test_sshd.py
+++ b/ipmininet/tests/test_sshd.py
@@ -27,6 +27,7 @@ def test_sshd_example():
         t = 0
         while t < 60 and net["r1"].popen(cmd.split(" ")).wait() != 0:
             time.sleep(0.5)
+            t=t+1
         p = net["r1"].popen(cmd.split(" "))
         assert p.wait() == 0, "Cannot connect with SSH to the router"

The test fails with:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    @require_root
    def test_sshd_example():
        try:
            net = IPNet(topo=SSHTopo())
            net.start()

            ssh_key = None
            with open("/tmp/sshd_r2.cfg") as fileobj:
                for line in fileobj:
                    if "AuthorizedKeysFile" in line:
                        ssh_key = line.split(" ")[1].split(".")[0]
            assert ssh_key is not None, "No authorized SSH key found in the configuration"
            assert os.path.isfile(ssh_key), "Cannot find key file at %s" % ssh_key

        import pdb; pdb.set_trace()
            ip = net["r2"].intf("r2-eth0").ip
            cmd = "ssh -oStrictHostKeyChecking=no -oConnectTimeout=1 -i %s %s ls" % (ssh_key, ip)
            t = 0
            while t < 60 and net["r1"].popen(cmd.split(" ")).wait() != 0:
>               time.sleep(0.5)
E               AssertionError: Cannot connect with SSH to the router
E               assert 255 == 0
E                +  where 255 = <bound method Popen.wait of <subprocess.Popen object at 0x7f68eb7a1690>>()
E                +    where <bound method Popen.wait of <subprocess.Popen object at 0x7f68eb7a1690>> = <subprocess.Popen object at 0x7f68eb7a1690>.wait

ipmininet/tests/test_sshd.py:30: AssertionError

I will check now if /etc/shadow is the root cause.

from ipmininet.

butjar avatar butjar commented on June 28, 2024

@butjar Actually I might have a lead...

Could you check your /etc/shadow file and tell me if there is the line with the root user of your VM starts with "root:!" or with "root:*"?
If you see the first string, it means that the root account is locked and by default sshd won't allow you to login to the account (unless UsePAM is set to 'yes').

Moreover, there is an issue in the test that makes it loop forever if the ssh command fails.

So this could explain why the test takes forever in your VM while it does not in mine.

Yes, thats the issue. After changing:

1c1
< root:!:17999:0:99999:7:::
---
> root:*:17999:0:99999:7:::

The test passes.

from ipmininet.

jadinm avatar jadinm commented on June 28, 2024

Thanks a lot!

I will update that when I have some time.

from ipmininet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.