raspberrypi-ui / piwiz

First-run startup wizard
11 stars 15 forks source link

Segfaults upon run #23

Closed NoozAbooz closed 3 years ago

NoozAbooz commented 3 years ago

I get a segfault when I run piwiz with root/without root. I didn't get this issue last week, but now all of a sudden this issue appears on both my RPI OS and TwisterOS installs. I've attached a Valgrind log below just in case. log.txt

spl237 commented 3 years ago

The only thing we have changed recently is some of the internationalisation support, and the wizard runs fine for me.

First - are you trying to run it on an already-installed system? It is not designed to be used in that configuration and errors may occur - it should only be run on a clean image at first run. The fact that you specify that you ran it "with / without root" suggests you are running it manually rather than only doing so on a first boot.

Second - what language setting (if any) did you make in the wizard, and what language and locale was your system set to before you ran it?

NoozAbooz commented 3 years ago

The only thing we have changed recently is some of the internationalisation support, and the wizard runs fine for me.

First - are you trying to run it on an already-installed system? It is not designed to be used in that configuration and errors may occur - it should only be run on a clean image at first run. The fact that you specify that you ran it "with / without root" suggests you are running it manually rather than only doing so on a first boot.

Second - what language setting (if any) did you make in the wizard, and what language and locale was your system set to before you ran it?

Ohhh, I'm making a RPI OS mod so some settings are already customized and set. The locale is currently set to US.

spl237 commented 3 years ago

Ohhh, I'm making a RPI OS mod so some settings are already customized and set. The locale is currently set to US.

OK, it's not guaranteed to work correctly under those conditions - it really shouldn't be used on an already-initialised system.

At what point does it crash? Immediately on startup, or on transition to a particular page?

NoozAbooz commented 3 years ago

Ohhh, I'm making a RPI OS mod so some settings are already customized and set. The locale is currently set to US.

OK, it's not guaranteed to work correctly under those conditions - it really shouldn't be used on an already-initialised system.

At what point does it crash? Immediately on startup, or on transition to a particular page?

Immediately on startup.

spl237 commented 3 years ago

I've just tried setting an already-installed Pi to US locale and running piwiz both with and without sudo; no crash for me, works fine.

So something you are doing to that image before you run piwiz is not compatible with it. Unfortunately, a valgrind log won't tell me that. I think you are going to need to rebuild from source and run it through a debugger to find where the crash is, I'm afraid - I'd just be blindly guessing as to what is causing the problem otherwise.

NoozAbooz commented 3 years ago

IMG_20210603_100605.jpg

NoozAbooz commented 3 years ago

Here's raw text output if the SS is hard to read.

Starting program: /usr/local/bin/piwiz 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[Detaching after fork from child process 12110]
[Detaching after fork from child process 12117]
sudo: unknown user: XDG_RUNTIME_DIR=/run/user/
sudo: unable to initialize policy plugin
sudo: unknown user: XDG_RUNTIME_DIR=/run/user/
sudo: unable to initialize policy plugin
[Detaching after fork from child process 12121]
[Detaching after fork from child process 12123]
[Detaching after fork from child process 12128]
[Detaching after fork from child process 12133]
[Detaching after fork from child process 12135]
[Detaching after fork from child process 12139]
[Detaching after fork from child process 12143]
[Detaching after fork from child process 12146]
[Detaching after fork from child process 12148]
sed: couldn't open temporary file /usr/lib/chromium-browser/sedAs4TO1: Permission denied

Program received signal SIGSEGV, Segmentation fault.
0x00014044 in read_locales () at piwiz.c:804
804                     cname[0] = g_ascii_toupper (cname[0]);
(gdb) bt
#0  0x00014044 in read_locales () at piwiz.c:804
#1  0x00014044 in main (argc=<optimized out>, argv=<optimized out>) at piwiz.c:1868
spl237 commented 3 years ago

OK, it looks to me as if your locale database has become corrupted. This isn't code which has changed recently, so I don't think the change to piwiz is likely to be causing your problem.

The code here reads /usr/share/i18n/SUPPORTED line-by-line, and then looks up the individual locale files /usr/share/i18n/locales/lc_CC, where lc and CC are the language and country codes from the line in SUPPORTED. It then searches the locale files for the strings labelled territory and language - it looks as if you have a locale file in which one or another of those strings is null or otherwise undefined.

You could try inspecting some variables at the crash point - it would be interesting to see the values of buffer, cptr1, cptr2, cname and lname, which might help narrow down exactly what is not as expected at this point.

NoozAbooz commented 3 years ago

OK, it looks to me as if your locale database has become corrupted. This isn't code which has changed recently, so I don't think the change to piwiz is likely to be causing your problem.

The code here reads /usr/share/i18n/SUPPORTED line-by-line, and then looks up the individual locale files /usr/share/i18n/locales/lc_CC, where lc and CC are the language and country codes from the line in SUPPORTED. It then searches the locale files for the strings labelled territory and language - it looks as if you have a locale file in which one or another of those strings is null or otherwise undefined.

You could try inspecting some variables at the crash point - it would be interesting to see the values of buffer, cptr1, cptr2, cname and lname, which might help narrow down exactly what is not as expected at this point.

Oh about that... I may have run localepurge in a attempt to clear some space. Is there a way to regenerate them then?

spl237 commented 3 years ago

Purging the locale database will definitely be causing this problem!

You'll probably need to reinstall the localisation package - sorry, no idea what it is called; have a search on Debian's package site.

Closing this as it's not a bug in the wizard...