Xorg reliably crashes when I launch multiple containers in a loop

I’ve just stumbled upon a reliable way to crash Xorg while attempting to launch multiple LXC containers. It’s as simple as:

for i in {1..4}; do lxc launch ubuntu:f c${i} --profile k8s; done

Within a few seconds (or minutes if the image wasn’t fresh) of running that command, Xorg will crash and I’ll have to log in again and of course, all previously opened apps will have been closed unceremoniously and then several crash reports popup and I obediently them off somewhere via whoopsie. I’ve repeated this process 3 times with 100% repeatability on the Lenovo and 33% on the Dell - both are on Ubuntu 22.04. It actually might be 100% on the Dell, but I forgot to attach the k8s profile on the first 2 tries.

So, it appears like the k8s profile I’m using might not be correct for Ubuntu 22.04???

Let me know what you’d like me to provide to help troubleshoot this issue.

I’m not using Wayland as it causes glitching towards the lower 3rd of the monitor whereby the mouse pointer jumps all over the place.

System spec: Lenono ThinkPad X1 Extreme Gen 5
$ sudo inxi -CGMSmsz
System:
  Kernel: 5.17.0-1030-oem x86_64 bits: 64 Desktop: GNOME 42.5
    Distro: Ubuntu 22.04.2 LTS (Jammy Jellyfish)
Machine:
  Type: Laptop System: LENOVO product: 21DE000KAU
    v: ThinkPad X1 Extreme Gen 5 serial: <filter>
  Mobo: LENOVO model: 21DE000KAU v: SDK0T76538 WIN serial: <filter>
    UEFI: LENOVO v: N3JET32W (1.16 ) date: 03/02/2023
Memory:
  RAM: total: 62.51 GiB used: 4.63 GiB (7.4%)
  Array-1: capacity: 64 GiB slots: 2 EC: None
  Device-1: Controller0-ChannelA/B-DIMM0 size: 32 GiB speed: 4800 MT/s
  Device-2: Controller1-ChannelA/B-DIMM0 size: 32 GiB speed: 4800 MT/s
CPU:
  Info: 14-core (6-mt/8-st) model: 12th Gen Intel Core i7-12700H bits: 64
    type: MST AMCP cache: L2: 11.5 MiB
  Speed (MHz): avg: 600 min/max: 400/3459:3517:3500 cores: 1: 510 2: 474
    3: 466 4: 492 5: 732 6: 792 7: 565 8: 480 9: 578 10: 685 11: 562 12: 829
    13: 593 14: 591 15: 816 16: 613 17: 619 18: 531 19: 528 20: 551
Graphics:
  Device-1: Intel Alder Lake-P Integrated Graphics driver: i915 v: kernel
  Device-2: NVIDIA GA107M [GeForce RTX 3050 Ti Mobile] driver: nvidia
    v: 525.105.17
  Device-3: Chicony Integrated Camera type: USB driver: uvcvideo
  Display: server: X.Org v: 1.21.1.3 driver: X: loaded: modesetting,nvidia
    unloaded: fbdev,nouveau,vesa gpu: i915 resolution: 1: 1920x1080~60Hz
    2: 1920x1200~60Hz
  OpenGL: renderer: Mesa Intel Graphics (ADL GT2) v: 4.6 Mesa 22.2.5
Sensors:
  System Temperatures: cpu: 56.0 C mobo: N/A
  Fan Speeds (RPM): fan-1: 0 fan-2: 0
System spec: Dell Precision m6700
$ sudo inxi -CGMSmsz
System:
  Kernel: 5.19.0-41-generic x86_64 bits: 64 Desktop: GNOME 42.5
    Distro: Ubuntu 22.04.2 LTS (Jammy Jellyfish)
Machine:
  Type: Laptop System: Dell product: Precision M6700 v: 01 serial: <filter>
  Mobo: Dell model: 0JWMFY v: A00 serial: <filter> UEFI: Dell v: A20
    date: 11/30/2018
Memory:
  RAM: total: 31.26 GiB used: 2.24 GiB (7.2%)
  Array-1: capacity: 32 GiB slots: 4 EC: None
  Device-1: Memory Module A size: 8 GiB speed: 1600 MT/s
  Device-2: Memory Module C size: 8 GiB speed: 1600 MT/s
  Device-3: Memory Module B size: 8 GiB speed: 1600 MT/s
  Device-4: Memory Module D size: 8 GiB speed: 1600 MT/s
CPU:
  Info: quad core model: Intel Core i7-3840QM bits: 64 type: MT MCP cache:
    L2: 1024 KiB
  Speed (MHz): avg: 1646 min/max: 1200/3800 cores: 1: 1200 2: 1200 3: 1774
    4: 1603 5: 3800 6: 1196 7: 1196 8: 1200
Graphics:
  Device-1: Intel 3rd Gen Core processor Graphics driver: i915 v: kernel
  Device-2: NVIDIA GK104GLM [Quadro K3000M] driver: nvidia v: 390.157
  Device-3: Microdia Dell Integrated HD Webcam type: USB driver: uvcvideo
  Display: server: X.org v: 1.21.1.4 driver: X: loaded: modesetting,nvidia
    unloaded: fbdev,nouveau,vesa gpu: i915 resolution: 1920x1080
  Message: GL data unavailable for root.
Sensors:
  System Temperatures: cpu: 56.0 C mobo: 50.0 C sodimm: SODIMM C
  Fan Speeds (RPM): cpu: 0

Turns out there was some formatting error with the raw.lxc line. I noticed that when I saved the profile and went back in, it still had literal \n characters and the entire line was still enclosed in "". After substituting the literal \n characters with new lines but leaving the multi-line stanza in quotes, on saving and returning to the profile, I noticed it had a different coloring. After that, no more Xorg crash.

Here’s what it looked like when it reliably crashed Xorg:

I edited it to look like this
Selection_059

And here’s how it looks after saving the changes above and editing it again:
Selection_057

And now I don’t have any more Xorg crashes.