5 Replies Latest reply on Jan 31, 2019 2:50 AM by jomoenginer

    Run at boot time


      I'm having some trouble getting my Ethernet port to stay static.  I have edited the /esc/network/interfaces file to have the correct info and when I do an ifdown then ifup eth0 everything is all fine.


      I had written a script that was supposed to do this at boot along with starting the VNC server but it does not seem to be executing @ boot but it I run it independently it works fine.

        • Re: Run at boot time

          I'm not sure why that is happening but I had similar issues with a script running @reboot in /etc/crontab that didn't seem to work and adding a delay to the beginning of the script helped. It could be because the Ethernet interface had not been enumerated or come up with a proper address by the time you are trying to start the VNC server that is causing the issue. Sprinkle a few delays in the script to ensure the start-up has been completed and it might work. Other times it could be because of differences in user privileges in how the script is run.


          - Gough

          2 of 2 people found this helpful
          • Re: Run at boot time
            Christopher Stanton

            > I'm having some trouble getting my Ethernet port to stay static


            There's actually two ways to approach this.


            One is to edit the configuration of your DHCP server to setup a 'reservation' for the IP address for your device, so that when it asks for an IP address, it's always given the same details. This is typically the 'best' way to do it.


            The alternative is to edit the network configuration as you're doing, and Debian has documentation on this https://wiki.debian.org/NetworkConfiguration - you shouldn't need to have a script running on startup to set this in place, and unless you're using a package such as 'NetworkManager' that alters or reconfigures the interface it shouldn't really change.


            There are many different ways to run a script at boot time, and this has become confusing with the introduction of System-V:






            And also it depends at what point in the boot you want the script to run



            2 of 2 people found this helpful
              • Re: Run at boot time

                Thanks for all the helpful links.  Ill try them out in the next day or two. 


                I'd prefer the script to run later in the boot process so that the other boot up functions don't override it.



                  • Re: Run at boot time

                    The other thing is that if you find /etc/network/interfaces method not to work, you should probably revert it to the original one as your interface may be configured with dhcpcd and you will instead need to edit /etc/dhcpcd.conf instead. I know the Raspberry Pi has moved to this ever since the move to systemd


                    - Gough

                    • Re: Run at boot time

                      Putting something in the crontab to run at start-up is not the right place to do this.  You should consider using /etc/rc.local before exit 0 or create a startup script in something like /etc/rc4.d.  With the newer Debian images for the BBB, connmanctl is used for WiFi config instead of the old way with /etc/network/interfaces.  This is spelled out in the interfaces file.

                      ##connman: WiFi
                      #connmanctl> tether wifi off
                      #connmanctl> enable wifi
                      #connmanctl> scan wifi
                      #connmanctl> services
                      #connmanctl> agent on
                      #connmanctl> connect wifi_*_managed_psk
                      #connmanctl> quit


                      You may still run into an issue with permissions in which case you may have to look at adding the user to sudoers.

                      3 of 3 people found this helpful