Lxpanel crashes when creating new devterm CM4 image

I’m following this guide:

To build a CM4 OS image from scratch.

Most of it works fine, but when reaching the desktop, lxpanel crashes.

If you do “Ctrl-Alt-T” to get a terminal and then manually run “lxpanel -p LXDE-pi”, you can see it crashing:

** Message: 00:14:17.372: x-terminal-emulator has very limited support, consider choosing another terminal
grep: /home/lion/.config/lxpanel/LXDE-pi/panels/*: No such file or directory
** Message: 00:14:17.756: netman: network manager service not running; plugin hidden
** Message: 00:14:17.786: Connecting ...
** Message: 00:14:17.787: Status changed to down
** Message: 00:14:17.787: Status changed to opened
** Message: 00:14:17.787: Connected to dhcpcd-8.1.2
** Message: 00:14:17.788: Status changed to connected
** Message: 00:14:17.789: eth0: Link is down
** Message: 00:14:17.789: wlan0: Not associated
** Message: 00:14:17.789: eth1: CARRIER
** Message: 00:14:17.789: eth1: Configured 172.16.221.230/16
** Message: 00:14:17.789: eth1: ROUTERADVERT
** Message: 00:14:17.790: eth1: Configured 2601:647:4c01:4690:0:d:0:76bd/128
** Message: 00:14:17.791: wlan0: WPA status connected

** (lxpanel:4907): WARNING **: 00:14:17.852: init context: err:6 Connection refused


** (lxpanel:4907): WARNING **: 00:14:17.855: init context: err:6 Connection refused

** Message: 00:14:17.962: ptbatt: battery entry BAT0 not found, using axp20x-battery
Segmentation fault

This isn’t the “no battery” bug. I have batteries installed and in fact no external power.

Any ideas?

OK, it’s something to do with “.config” in your home directory not getting populated. All the lxpanel configuration is missing.

I think it’s something to do with preloading monitors.xml in there. If you skip that step, lxpanel doesn’t crash, but of course the screen is now sideways.

Still investigating.

OK! I figured it out.

To put monitors.xml into the .config directory, you have to make the .config directory. I did this as root, and since that directory was now owned by root, the setup wizard thing could not dump the lxpanel configuration in there. It didn’t have permission.

Setting the owner to be the same as the parent directory solved the problem.