8 Replies Latest reply on Feb 18, 2015 3:21 PM by AlexT_Intel

    Galileo G2 - can not become root?

    SAHER_MAQSOOD

      Hello,

      I am getting started with the intel galileo g2 board. I ran the basic arduino sketches using the following link:Intel Software Academic Program  (Course : Intel Arduino IDE Hello World ( PPTX - PDF ))
      I than tried running the basic on-board linux using the next PPTX from the same link (course : Networking ( PPTX - PDF ) ). Here i had the following problems:

      I AM USING THE WINDOWS ON MY LAPTOP, NOT LINUX WHICH IS USED IN THE PPTX


      1)

      I was not able to connect to my board using SSH with IPv4 or IPv6. I tried with putty and them also with tera term. I am sure that the ip and mac was given to the board as it was also displayed on the serial monitor. I used the following arduino sketch and the output of serial monitor is attached in image 1.

       

      void setup() {

      }

       

      void loop() {

      system("telnetd -l /bin/sh");

      system("ifconfig eth0 169.254.1.1 netmask 255.255.0.0 up");

      system("ifconfig eth0 > /dev/ttyGS0");

      delay(2000);

      }

       

      I was finally able to do it with telnet using ipv4 and port 23 on teraterm. I need to ask why ssh is not working for me?


      2)
      When i was finally able to connect, i could not become the root user as described in the networking PPTX on the above link. I see that i can enter the root directory but can't become root user. How can i do it? also what can i explore with this on board linux image? The image when i am logged in is attached as image 2.

       

       

      IMAGE 1:

       

      IMAGE 2 :image1.png

      image2.png

        • 1. Re: Galileo G2 - can not become root?
          CMata_Intel

          Hi SAHER_MAQSOOD

           

          Did you update the firmware in your board? If you haven't, go to the Arduino IDE->Help->Galileo Firmware Update

          Intel® Galileo Boards and Kits — Getting Started for Windows*

          Also, were you able to do the SSH connection using TeraTerm or only with ethernet? The default port for SSH, is 22 not 23. Did you tried with that one?

           

          Regards;

          CMata

          • 2. Re: Galileo G2 - can not become root?
            SAHER_MAQSOOD

            Hello,

            My firmware was update but in any case i updated it again on your suggestion.

            On the second part of ur reply, I was only able to do telnet with port 23 on tera term and i am using a LAN cable. Telnet on putty din't work for me.
            The SSH din't work for me at all.And yes I try SSH with port 22.

             

            This is how i give the IP address for both IPv4 and IPv6.(I have tried it with and without writing root)

             

            fe80::9a4f:eeff:fe01:ca16

            root@fe80::9a4f:eeff:fe01:ca16

             

            169.254.1.1

            root@169.254.1.1

             

            Also, can u tell me how I can become the root user when i am able to connect using telnet? and what functions of the on-board linux can i explore to check if everything is working fine?

             

            Regards
            Saher Maqsood


            • 3. Re: Galileo G2 - can not become root?
              AlexT_Intel

              You aren't able to connect via SSH because you only start telnet with your sketch Those presentations you referred to have different instructions on starting SSH - just follow them to the letter and you should be good. The key here is to boot from the SD card and have your DHCP server give out the IP (or you need to set the IP and enable the interface manually).

               

              When yo're connected via telnet you are root already. Out of the screeenshots you've posted, you are just trying to run command "root", which doesn't exist or to change the directory to "config",which doesn't exist either (and that's normal). To understand which user you're running under, just run "id" command or "whoami".

              1 of 1 people found this helpful
              • 4. Re: Galileo G2 - can not become root?
                SAHER_MAQSOOD

                Thank you for your guidance. Things make sense to me now. My main concern was to become the root user. I'll move to the bigger linux image part now. Have a nice weekend!

                • 5. Re: Galileo G2 - can not become root?
                  AlexT_Intel

                  You're welcome. I'd also suggest you to mark this question as answered, so that others looking for the same solution will find it more easily + Intel support folks looking for unanswered questions won't treat this one as such.

                  • 6. Re: Galileo G2 - can not become root?
                    SAHER_MAQSOOD

                    Hi AlexT_Intel,

                     

                    I want to try connecting through SSH once more. I your response above you write:

                    'or you need to set the IP and enable the interface manually'.

                     

                    Something similar is also written in the slides (Networking PPTX - slide 10):

                     

                    //the IP address for the Galileo: (will be used if there’s no DHCP server on your network)

                    byte ip[] = { ???, ???, ???, ??? };   

                     

                    Can you guide me which IP should I give here.

                    What fixed IP can I give? Will any random IP work?

                     

                    I tried to give the following random IP :

                    byte ip[] = { 169,254,251,18 };

                     

                    The problem is that if I give the above mentioned IP,

                     

                    1) I can't see any Serial.println outputs on my serial monitor.

                     

                    2) On slide 12, when it explain Whats My IP, I am unable to run the following commands:


                     

                    Display ifconfig output

                     

                    Run sketch from the following slide, it will :
                    > run the
                    ifconfig linux command
                    > output the result in a file
                    > display the file content

                     

                    I think they are linux based and I have windows on my system. They don't get verified by the IDE and give the errors shown in the attached image (P1).

                     

                    P1.png

                     

                    Now moving on when i try to connect through SSH, giving the same IP as above, it says 'Unable to connect, The host does not exists'. I am attaching it's Image too. The ping for it also says destination unreachable.(Image attached)

                     

                    P2.png

                     

                     

                    P3.png

                    Also I am sending you the response I get when I type ipconfig on cmd so that you could suggest me which ip should i use while networking with the board.(Image attached)

                     

                    P4.png

                     

                     

                    Regards

                    Saher Maqsood

                    • 7. Re: Galileo G2 - can not become root?
                      SAHER_MAQSOOD

                      Hi AlexT_Intel,

                       

                      I also wanted to know if there is any similar command for SSH like the one I used for telnet above(  system("telnetd -l /bin/sh");   ) ?

                      • 8. Re: Galileo G2 - can not become root?
                        AlexT_Intel

                        Are we talking about the SPI image or the SD card image here? For SD card image you don't need to start SSH - it's autostarted, for SPI image there's no SSH there at all (it's too big to fit into 8MB).

                         

                        You mean you don't have DHCP in your network or that you want to have a direct Ethernet connection to your board? Because if not, I'd rather suggest you to go with the DHCP way - that would be simpler to setup.

                         

                        If you want a direct connection, pretty much any valid IP will do (given that you don't have any other connections on the PC, otherwise use the address from link-local space, e.g. the one you saw in the example from 169.254.251 subnet), just don't forget to setup respective IP for your PC or laptop you are connecting from, that will require setting the IP and netmask manually for the interface. Make sure to use the same netmask and just pick the (board IP)+1 or -1.