MagicMirror² v2.7.0 is available! For more information about this release, check out this topic.

Settings in config.js aren't loaded after reboot of RasPi

  • @morozgrafix Thanks for the feedback. I did a re-install without the all the sudo commands. However I am running into a new problem now. After some other installations earlier I turned my raspberry off. When I turned it on again, and did a npm start from /MagicMirror MM started but it doesn’t seem to get the config.js file from /MagicMirror/Config. I have changed the file to match my local weather etc. When I start MM now after a full shutdown, I get the standard info displayed on MM. I did a sudo halt before I unplugged my raspberry.

    Edit: Getting the following errors:

  • Moderator

    @LincolnClay before reinstalling did you delete MagicMirror directory from /home/pi directory? I just want to make sure that your pi user has full access to files inside of MagicMirror directory. You can check who owns MagicMirror directory by running following command in the terminal:

    ls -l /home/$USER

    which will give you output similar to this:

    drwxr-xr-x  2 pi       4.0K Jan 21 14:30 foo/
    drwxr-xr-x  2 root     4.0K Jan 21 14:31 foo1/
    drwxr-xr-x 14 pi       4.0K Jan  8 14:52 MagicMirror/

    as you can see in the example above directory foo and MagicMirror are owned by pi user and foo1 is owned by root. To change ownership from root to pi this command needs to be executed (in the example below it will change ownership of foo1 directory from root to currently logged in user):

    sudo chown -R $USER /home/$USER/foo1/

    basically it does translates to this: Running as root user (one who currently owns foo1 directory and has write permissions) change owner (‘chown’) recursively (-R) to currently logged in user ($USER which is pi in our case) for directory foo1. After running this command foo1 will belong to pi and running ls -l /home/$USER should produce results similar to this:

    drwxr-xr-x  2 pi       4.0K Jan 21 14:30 foo/
    drwxr-xr-x  2 pi       4.0K Jan 21 14:31 foo1/
    drwxr-xr-x 14 pi       4.0K Jan  8 14:52 MagicMirror/

    QUESTION: When you changed /home/pi/MagicMirror/config/config.js did you actually save that file? I’m trying to understand what you mean by “I get the standard info displayed on MM” Does it show default settings? Did it ever show info with your local weather?

    I also see some Xlib: errors or warnings in your logs and I have no idea where that coming from.

    P.S. It maybe worth opening your own thread with exact steps that you already did for easier troubleshooting and not to highjack another thread.

  • @morozgrafix I really appreciate in depth answer. I am sorry for hijacking this thread, I had no intention to do so. I in fact closed my thread because I thought your last suggestion resolved my issues permanently. This was before I realized I got a new issue after rebooting my raspberry.

    Regarding your questions:

    Yes, I deleted the MagicMirror directory from /home/pi, before the re-install.

    I checked if pi had full access and it did.

    drwxr-xr-x  15 pi   pi   4096 Jan 21 23:10 MagicMirror
    -rwxr-xr-x   1 pi   pi     38 Jan 21 14:37
    -rwxr-xr-x   1 pi   pi     38 Jan 21 14:43
    drwxr-xr-x 154 root root 4096 Jan 19 18:18 node_modules

    Regarding if I saved the /config folder files: Yes, I copied the edited text from /home/pi/MagicMirror/config.js and pasted it in config.js.sample both where saved. What I meant was after I have edited these files, MM starts with my desired weather and news info, which I input in the /config files. So before reboot, MM is not displaying any default settings.

    When the raspberry is rebooted, MM now starts with default settings, even though the files in /config is exactly the same as before the reboot. (still in /home/pi/MagicMirror/config with edited text as before).

  • Moderator

    @LincolnClay I’m not really sure why MM code is not picking up your /home/pi/MagicMirror/config/config.js after restart.

    By the way config.js.sample is just a sample config that can be copied into config.js and it comes along with MM code and doesn’t really play any role when MM starts up, so there is no need to modify that file in any way.

    If your /home/pi/MagicMirror/config/config.js keeps your desired changes, I wonder if you somehow have 2 different locations where MM is installed and configured. (I noticed that you have node_modules directory in /home/pi which seems a bit odd.)

    I’m assuming you are starting MM with pm2 on a startup. Can you please show post contents of your /home/pi/ file (you can run cat /home/pi/ and copy/paste contents of the output) and also run pm2 list and pm2 show mm and copy/paste output here?

    Sorry I’m kind of running out of ideas without knowing more information.


    P.S. I’ve forked our conversation into a separate topic, this way we will not highjack original topic.

  • @morozgrafix sorry for the late reply, I didn’t want to waste your troubleshooting the MagicMirror files, my suspicion was that these problems where caused by my autoboot fix for vnc-server. Which indeed was the issue. After a new clean install NOOBS install with a lot of less sudo's than the first time. Everything now works perfectly. I am definitely not the right person to talk about this stuff, but I think the problem was caused by a " No session for PID XXXX" error at every launch.
    Anyways, I really appreciate you taking your time to help. I wouldn’t have found all my problems and fixes without it 🙂

  • Moderator

    cool, glad you managed to get it resolved and up and running.