We would like to restart the crond service after installing our application and we find that it does not run on the RPi reference platform. Upon inspecting the service_crond.sh script, we found that the file /nvram/ETHWAN_ENABLE is expected, but not created on the RPi. However, sysevent get ethwan-initialized returns 1 indicating that the service has started correctly (also, it is our understanding that /usr/ccsp/gw_prov_ethwan is the trigger for the startup sequence). 

Questions

  1. How is ETHWAN_ENABLE created (perhaps cosa_ethernet_apis.c) and why isn't it created in the RPi reference platform?
  2. Is there any workaround other than creating the file manually?
  • No labels

5 Comments

  1. HI Nitin Patet,

    Currently the RPI supports ETHWAN. The flag ETHWAN_ENABLE is created in RPI when we try to switch between the different wan modes, like docsis to ethwan  or gpon to ethwan etc . Since RPI doesnt have dual mode support it won't switch between the modes and the flag won't be created.

    If the flag is the blocker for your application, then let us know your requirement, we will try to enable the flag in /nvram

    Thanks and Regards

    Srinivas 

    1. Hi Srinivas,

      We use cronjob to schedule some actions from our application and need the crond service to be running for that. Shouldn't crond be independent of ETHWAN_ENABLE? Today, the crond service simply doesn't run on the RPi!

      Here's an excerpt from service_crond.sh:

      service_crond.sh
      service_start ()                                                                    
      {                                                                                   
         if [ -f "/nvram/ETHWAN_ENABLE" ];then                                            
           if [ "x1" != "x`sysevent get ethwan-initialized`" ]; then                      
               echo "SERVICE_CROND : register_ethwan_init_handler"  
               register_docsis_init_handler                         
               return                                                      
           fi                                                             
         else                                                       
           if [ "x1" != "x`sysevent get docsis-initialized`" ]; then
               echo "SERVICE_CROND : register_docsis_init_handler"  
               register_docsis_init_handler                         
               return                                                        
           fi                                                                
         fi        
      ...
      }


      Also, we've noticed that the crond service cannot execute "opkg upgrade" if the following sequence of steps is executed:

      1. /crontab/root is updated with a new job that runs "opkg upgrade"
      2. crond is restarted using "sysevent set crond-restart"

      Oddly, we see that the "opkg upgrade" works if the crond is restarted using "killall crond && crond -l 9" instead. Please advice on how we can fix!

  2. HI Nithin Patet,

    Add the below code changes in gw_prov_ethwan_sm.c  to enable the Ethan flag in /nvram partition.

    static int GWP_act_ProvEntry_callback()
    {
        GWPROVETHWANLOG( "Entering into %s\n",__FUNCTION__);    system("mkdir -p /nvram");
    #if defined(_PLATFORM_TURRIS_)
        system("mount /dev/mmcblk0p6 /nvram");
    #endif
        system("rm -f /nvram/dnsmasq.leases");
        system("syslogd -f /etc/syslog.conf");    //copy files that are needed by CCSP modules
        system("cp /usr/ccsp/ccsp_msg.cfg /tmp");
        system("touch /tmp/cp_subsys_ert");    /* Below link is created because crond is expecting /crontabs/ dir instead of /var/spool/cron/crontabs */
        system("ln -s /var/spool/cron/crontabs /");
        /* directory /var/run/firewall because crond is expecting this dir to execute time specific blocking of firewall*/
        system("mkdir -p /var/run/firewall");    system("/etc/utopia/utopia_init.sh");
    #if defined(_PLATFORM_RASPBERRYPI_)
        system("touch /nvram/ETHWAN_ENABLE");
    #endif



    Please find below procedure to restart the crond.

    before restarting:
    root@RaspberryPi-Gateway:~# ps | grep crond
    6004 root 0:00 crond -l 9
    19613 root 0:00 grep crond

    After restarting:
    root@RaspberryPi-Gateway:~#
    root@RaspberryPi-Gateway:~# sysevent set crond-restart 1
    root@RaspberryPi-Gateway:~# ps | grep crond
    19895 root 0:00 crond -l 9
    19898 root 0:00 grep crond


    Thanks and Regards
    Srinivas

    1. Hi Srinivas,

      Thanks for the suggestion. Will you be submitting this to the RDK-B codebase since it affects the startup of cronjobs on the RPi reference platform?

  3. Hi Nitin Patet,

    Please find the below code changes for enabling the ETHWAN_ENABLE flag in rpi builds.
    https://code.rdkcentral.com/r/c/components/generic/rdk-oe/meta-cmf-raspberrypi/+/39328


    Thanks and Regards

    Srinivas