Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Unexpected error message popup: The image does not contain userid, etc.
#1
Hi,

I installed 9.2.1 a couple of days ago without any issues. Installed from fresh image using the Pi imager with userid, password, wifi and ssh setup. Running Moode on Pi-3B+, 1GB, library on SMB share. I have been using Moode since day one (just about) so this is not my first installation. 
For the past few years I have installed some software after initial setup to add functionality, most recently for HQPlayer and Tidal, as well as a PiJuice UPS. I only mention this to be thorough, since everything is running fine, almost. 
While I was installing Docker, I got the impression that the system hanged, as it appeared unresponsive and nothing seemed to be happening in the terminal app. In short, I grew impatient and restarted Moode. Not ideal but I had done this before without any apparent issues. After restart, I completed my installations and everything works fine, as usual and as expected. 
The only problem is, and this came as a surprise and is now just an annoyance, every time I change menu windows, I get a pop up message: Error: The image does not contain a userid .....

   

Any way I can get rid of this without reinstalling from scratch? Like I mentioned everything is functioning correctly.

Thanks,

John
Reply
#2
Here's the function in inc/common.php that would have assigned NO_USERID_DEFINED.  This will give you a way to determine which of the conditions may not have been met.

Code:
// Assumes only one dir under /home, the one matching the userid entered into
// the Raspberry Pi Imager when making the image.
function getUserID() {
    // Delete '/home/pi' if no corresponding userid exists. The homedir pi is
    // created by the moode-player package install during in-place update.
    if (file_exists('/home/pi/') && empty(sysCmd('grep ":/home/pi:" /etc/passwd'))) {
        sysCmd('cp /home/pi/.xinitrc /tmp/xinitrc');
        sysCmd('rm -rf /home/pi/');
    }
    // Return empty string if locked password for userid pi. A locked password
    // is from the pi-gen build and remains unless a userid is set in Pi Imager.
    if (sysCmd('cat /etc/shadow | grep pi | cut -d ":" -f 2')[0] == '!') {
        // No userid set in Pi Imager
        $userId = NO_USERID_DEFINED;
    } else {
        // Return userid or empty string if no subdirs under /home/
        $userId = sysCmd('ls /home/')[0];
        if (strpos($userId, 'ls: cannot access') !== false) {
            $userId = NO_USERID_DEFINED;
        }
    }

    // Install xinitrc script
    if ($userId != NO_USERID_DEFINED) {
        if (file_exists('/tmp/xinitrc')) {
            sysCmd('cp -f /tmp/xinitrc /home/' . $userId . '/.xinitrc');
        }
    }

    return $userId;
}
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Thanks for getting back to me so quickly.

I think that this may be beyond my skillset. I looked at what you sent, and to the best of my understanding everything looks fine. No pi subdirectory under home, only the one that I set. Looked at /etc/shadow file and pi not there, only my username, and password is not locked. Not sure if I missed something. The only wild guess that I can make is that I have a user called pijuice, and the beginning of its /etc/shadow entry looks like this: "pijuice:!:". Probably not this as I had the pijuice software running under Moode 8.*.* without any issues.

Let me know what you think. I might just live with it until I can't and then reinstall. Do not want to waste our precious time.
Reply
#4
That could be it. Try the command below.
sudo cat /etc/shadow | grep pi | cut -d ":" -f 2

Moode 8 didn't have function getUserID().
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
Yes, that is it. Thanks.

   

Anything I can do about it?
Reply
#6
Sure, give this a try.

Code:
1. Edit the file: /var/www/inc/common.php
sudo nano /var/www/inc/common.php

2. Scroll down to: function getUserID()

3. Change the grep command:
From: grep pi
To:   grep "pi:"

4. Save the file
Ctrl-x
y
Return

5. Reboot

If you like you can save a copy of the file in your home directory before editing it, just in case.

Code:
sudo cp /var/www/inc/common.php ~/
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
I did what you suggested and got the same result, in other words no change.


After making a backup copy of /var/www/inc/common.php, I took a more drastic and expedient approach and commented out the lines that seemed to me to be causing my issue. Appears to have worked. I figured that since this was a fairly exceptional scenario, it might just be the easiest way, though most certainly overkill. Let me know what you think.

   

Thanks again for pointing me in the right direction.
Reply
#8
(Yesterday, 10:23 PM)hui13 Wrote: I did what you suggested and got the same result, in other words no change.


After making a backup copy of /var/www/inc/common.php, I took a more drastic and expedient approach and commented out the lines that seemed to me to be causing my issue. Appears to have worked. I figured that since this was a fairly exceptional scenario, it might just be the easiest way, though most certainly overkill. Let me know what you think.



Thanks again for pointing me in the right direction.

If the commented out code contains the changes suggested by Tim, I think you made them in the wrong place. I mean, in the wrong grep call.
Reply
#9
(Yesterday, 10:23 PM)hui13 Wrote: I did what you suggested and got the same result, in other words no change.


After making a backup copy of /var/www/inc/common.php, I took a more drastic and expedient approach and commented out the lines that seemed to me to be causing my issue. Appears to have worked. I figured that since this was a fairly exceptional scenario, it might just be the easiest way, though most certainly overkill. Let me know what you think.



Thanks again for pointing me in the right direction.

Interesting. That change should have worked but maybe I missed something. It would be best to fix it upstream in moode sources so you don't have to manually edit that file.

does your /etc/shadow contain

Code:
pijuice:

and

pi:
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#10
Just pijuice:
Reply


Forum Jump: