MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    NPM process dies

    Scheduled Pinned Locked Moved Troubleshooting
    9 Posts 2 Posters 4.6k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      Sachin
      last edited by

      Everything is working fine but I have a persistent issue that I can’t seem to fix. Whether I start NPM manually from a terminal or NPM starting automatically with a script, it seems to die randomly. The RPI3 is still up, just NPM dies. Are there logs that I take a look at to see what’s causing it?

      For the time being, I’m using crontab to reboot every couple of hours but I’d like to avoid that if possible.

      Thanks

      1 Reply Last reply Reply Quote 0
      • KirAsh4K Offline
        KirAsh4 Moderator
        last edited by

        If you install PM2 per the instructions, it will automatically get restarted if/when it dies.

        As for why it dies, if you are running PM2, you might be able to see if anything gets logged with 'pm2 logs'. But I’m not sure if it does log anything to be honest. PM2 does, but the npm process itself … unsure.

        A Life? Cool! Where can I download one of those from?

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          Sachin
          last edited by

          Thanks, this helps!

          1 Reply Last reply Reply Quote 0
          • KirAsh4K Offline
            KirAsh4 Moderator
            last edited by

            Are you using a proper power supply for the rpi? You need something that can provide at least 2A … anything less will cause it to be unstable with random crashes of processes. Adafruit has both a 2A version as well as a 2.4A one.

            A Life? Cool! Where can I download one of those from?

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              Sachin @KirAsh4
              last edited by

              @KirAsh4 Yes, I bought the CanaKit 5V 2.5A Raspberry Pi 3 Power Supply

              1 Reply Last reply Reply Quote 0
              • KirAsh4K Offline
                KirAsh4 Moderator
                last edited by KirAsh4

                Other than a potential file system corruption, or faulty memory on the rpi itself, I can’t think of anything else that could be killing the process. While rather rare, I have seen brand new rpis have faulty memory. You’d have to install and run 'memtester' to check the memory. If that checks out, you can check the file system itself with 'fsck'. WARNING: doing this on a running system can cause issues. However, since the rpi runs off of the card, it’s unable to unmount the card, so you have two choices:

                a) schedule a file system check at the next reboot:

                $ sudo touch /forcefsck
                $ sudo reboot
                

                b) alternatively, you can force a file system check while it’s running:

                $ sudo fsck -fy /dev/mmcblk0p2 
                $ sudo reboot
                

                The 'mmcblk0p2' listed above you get by typing in 'mount' and looking at the line that shows the root file system on, denoted by a single '/':

                $ mount
                /dev/mmcblk0p2 on / type ext4 (rw,noatime,data=ordered)  <============================= THAT LINE
                devtmpfs on /dev type devtmpfs (rw,relatime,size=469540k,nr_inodes=117385,mode=755)
                sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
                proc on /proc type proc (rw,relatime)
                ...
                

                And if it found errors, you can only hope that the fsck fixed them, otherwise you’re looking at either a system rebuild (where you start fresh, by burning a new image to the card and go through all the steps to configure the rpi and reinstall everything), or possibly even replacing the card as well (in which case you’re going to go through a rebuild anyways, so you may as well do that.)

                A Life? Cool! Where can I download one of those from?

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  Sachin @KirAsh4
                  last edited by

                  @KirAsh4 Thanks again. I ran memtester and everything was reported ok. I’m now going to use forcefsck and see what it finds.

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    Sachin @KirAsh4
                    last edited by

                    @KirAsh4 Deployed PM2, and works as described. Thanks!

                    1 Reply Last reply Reply Quote 0
                    • KirAsh4K Offline
                      KirAsh4 Moderator
                      last edited by

                      Glad that’s working. It still doesn’t solve the fact that it’s dying on you, but at least it will restart it automatically for you. I think my process dies at least once a week or so … totally random, with the pi doing nothing.

                      A Life? Cool! Where can I download one of those from?

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy