Thank you for your donation!


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


Problem: Local UI does not start after software update
#1
After doing an in place update to 8.3.9, the local UI does not start (leaving the bootup console output on the screen)

I have traced the issue to the file /lib/systemd/system/localui.service

localui.service:

[Unit]

Description=Start Chromium Browser
After=nginx.service php7.4-fpm.service mpd.service

[Service]
Type=simple

# start xserver
ExecStart=/usr/bin/xinit

User=pi

[Install]
WantedBy=multi-user.target

Note that User=pi   This is NOT the correct user.

The file localui.service is generated by the code in worker.php.  Worker.php gets the username via a system call, and so it seems that the incorrect name is setup elsewhere.

Any thoughts?

P.S.
 This also happened the previous time that I did an inplace update, but I just reflashed the system.
This time I think it requires a fix.

Thanks
 -Wally
Reply
#2
(02-29-2024, 08:11 PM)NHWally Wrote: After doing an in place update to 8.3.9, the local UI does not start (leaving the bootup console output on the screen)

I have traced the issue to the file /lib/systemd/system/localui.service

localui.service:

[Unit]

Description=Start Chromium Browser
After=nginx.service php7.4-fpm.service mpd.service

[Service]
Type=simple

# start xserver
ExecStart=/usr/bin/xinit

User=pi

[Install]
WantedBy=multi-user.target

Note that User=pi   This is NOT the correct user.

The file localui.service is generated by the code in worker.php.  Worker.php gets the username via a system call, and so it seems that the incorrect name is setup elsewhere.

Any thoughts?

P.S.
 This also happened the previous time that I did an inplace update, but I just reflashed the system.
This time I think it requires a fix.

Thanks
 -Wally

What happens if you replace "pi" with the correct user name?
Reply
#3
[quote pid='52598' dateline='1709238165']



What happens if you replace "pi" with the correct user name?
[/quote]

Still doesn't work ...  The file is re-edited in the code worker.php ! 

<snip>
//----------------------------------------------------------------------------//
workerLog('worker: --');
workerLog('worker: -- Peripherals');
workerLog('worker: --');
//----------------------------------------------------------------------------//

// Start local display
sysCmd("sed -i '/User=/c \User=" . $_SESSION['user_id'] . "' /lib/systemd/system/localui.service");
sysCmd('systemctl daemon-reload');
if ($_SESSION['localui'] == '1') {
    startLocalUI();
}
workerLog('worker: Local display:   ' . ($_SESSION['localui'] == '1' ? 'on' : 'off'));
// On-screen keyboard (Enable is text on the button)
if (!isset($_SESSION['on_screen_kbd'])) {
    $_SESSION['on_screen_kbd'] = 'Enable';
}
Reply
#4
After an in-place update?
can you ssh into it? what user do you specify? what password?

P.S.
you can write them here, we cannot get into your machine...
Reply
#5
(02-29-2024, 09:01 PM)Nutul Wrote: After an in-place update?
can you ssh into it? what user do you specify? what password?

P.S.
you can write them here, we cannot get into your machine...

I can ssh to the machine with the username/password that I setup (long ago) with pi-imager.

The syslog shows chrome not starting:

Feb 29 14:53:14 Moode bluealsa[1235]: bluealsa: [1235] D: bluez.c:796: BlueZ battery provider support not available
Feb 29 14:53:15 Moode systemd[1]: Reloading.
Feb 29 14:53:15 Moode systemd[1317]: localui.service: Failed to determine user credentials: No such process
Feb 29 14:53:15 Moode systemd[1317]: localui.service: Failed at step USER spawning /usr/bin/xinit: No such process
Feb 29 14:53:15 Moode systemd[1]: Started Start Chromium Browser.
Feb 29 14:53:15 Moode systemd[1]: localui.service: Main process exited, code=exited, status=217/USER
Feb 29 14:53:15 Moode systemd[1]: localui.service: Failed with result 'exit-code'.
Feb 29 14:53:30 Moode systemd-timesyncd[308]: Initial synchronization to time server 45.79.35.159:123 (2.debian.pool.ntp.org).
Feb 29 14:53:34 Moode systemd[1]: systemd-rfkill.service: Succeeded.
Feb 29 14:53:34 Moode bthelper[1347]: Changing power off succeeded



The question is where did worker.php get the 'pi' username from with this code:

$_SESSION['user_id'] = getUserID();   // line 343 in worker.php
Reply
#6
(02-29-2024, 09:12 PM)NHWally Wrote: $_SESSION['user_id'] = getUserID();   // line 343 in worker.php

Can you "ls" the file in question? In particular, owner and permissions.
Reply
#7
Which file did you have in mind?
It seems to me that neither X11 or Chrome are starting because they are trying to run as user 'pi' (which does not actually exist)
Reply
#8
(02-29-2024, 08:11 PM)NHWally Wrote: After doing an in place update to 8.3.9, the local UI does not start (leaving the bootup console output on the screen)

I have traced the issue to the file /lib/systemd/system/localui.service

localui.service:

[Unit]

Description=Start Chromium Browser
After=nginx.service php7.4-fpm.service mpd.service

[Service]
Type=simple

# start xserver
ExecStart=/usr/bin/xinit

User=pi

[Install]
WantedBy=multi-user.target

Note that User=pi   This is NOT the correct user.

The file localui.service is generated by the code in worker.php.  Worker.php gets the username via a system call, and so it seems that the incorrect name is setup elsewhere.

Any thoughts?

P.S.
 This also happened the previous time that I did an inplace update, but I just reflashed the system.
This time I think it requires a fix.

Thanks
 -Wally


What userid did you specify when you made the < 8.3.9 image using the Raspberry Pi Imager?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#9
PROBLEM SOLVED !!

The issue is caused by a less than robust implementation of the PHP method genUserID() (in the file common.php)

unction getUserID() {
$result = sysCmd('ls /home/');
return $result[0];
}

This will return the first item in the /home folder. It seems that on my PI, there is a /home/pi folder in addition to the default user one.
Deleting pi's home folder fixes the problem. (I have no idea how this got there, but it appears to be a complete home directory with all of the config files).

Thanks for your (instant!) help and encouragement !

-W
Reply
#10
Why do you think its not robust given that images are to be created with the Pi imager which only allows one userid?

For example if there are multiple userid's in /home each populated with the usual files then what logic during startup would be used to determine which one to use?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: