The problem is quite general (not specific of Ubuntu, but affecting also Ubuntu, and not specific of Dell hardware either, see below a few related web pages, none reporting a convincing solution). What I describe is completely reproducible under both 6.08 and 6.11 kernels (like in the attached output).
My Dell XPS 13 9340 detects the external monitor correctly only when [condition 1] I power on the laptop, hit F2 and start the UEFI BIOS, exit from BIOS (with of without changing it) and boot with the HDMI cable already connected. Hardware and software details are below. Grub selecting Windows boot the external monitor is always recognized like this.
If I disconnect the cable and connect it again, or suspend the pc (to S3 state), and thereafter, any time I reboot the laptop with or without connected cable, the external monitor is not recognized any more [condition 2]. This is particularly crippling since it practically prevents the use of external monitors and overhead projectors.
I show below the output of a few diagnostics in the two conditions.
In condition I
> xrandr --listactivemonitors
Monitors: 2
0: +*eDP-1 1920/290x1200/180+0+1440 eDP-1
1: +DP-6 2560/700x1440/390+0+0 DP-6
,
> inxi -GSaz --vs
inxi 3.3.34-00 (2024-04-13)
System:
Kernel: 6.11.0-17-generic arch: x86_64 bits: 64 compiler: gcc v: 13.3.0
clocksource: tsc avail: acpi_pm
parameters: BOOT_IMAGE=/boot/vmlinuz-6.11.0-17-generic
root=UUID=19de882b-011d-46dc-bb01-3fa016e2504a ro
resume=UUID=4aab95f5-8481-4a4e-b7ce-dcdcec31ee83
Desktop: GNOME v: 46.0 tk: GTK v: 3.24.41 wm: gnome-shell
tools: gsd-screensaver-proxy dm: GDM3 v: 46.2 Distro: Ubuntu 24.04.2 LTS
(Noble Numbat)
Graphics:
Device-1: Intel Meteor Lake-P [Intel Arc Graphics] vendor: Dell driver: i915
v: kernel alternate: xe arch: Gen-13 process: Intel 4 (7nm+) built: 2023+
ports: active: DP-6,eDP-1 empty: DP-1, DP-2, DP-3, DP-4, DP-5
bus-ID: 00:02.0 chip-ID: 8086:7d55 class-ID: 0300
Display: wayland server: X.org v: 1.21.1.11 with: Xwayland v: 23.2.6
compositor: gnome-shell driver: gpu: i915 display-ID: 0
Monitor-1: DP-6 model: Lenovo LEN T32q-27 serial: <filter> built: 2022
res: 2560x1440 dpi: 93 gamma: 1.2 size: 698x393mm (27.48x15.47")
diag: 801mm (31.5") ratio: 16:9 modes: max: 2560x1440 min: 720x400
Monitor-2: eDP-1 model: Sharp 0x1593 built: 2023 res: 1920x1200 dpi: 169
gamma: 1.2 size: 288x180mm (11.34x7.09") diag: 340mm (13.4") ratio: 16:10
modes: 1920x1200
API: EGL v: 1.5 hw: drv: intel iris platforms: device: 0 drv: iris
device: 1 drv: swrast gbm: drv: iris surfaceless: drv: iris wayland:
drv: iris x11: drv: iris
API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel v: N/A glx-v: 1.4
direct-render: yes renderer: Mesa Intel Arc Graphics (MTL)
device-ID: 8086:7d55 memory: 15.04 GiB unified: yes display-ID: :0.0
,
cat /sys/class/drm/card1/card1-eDP-1/status
connected
cat /sys/class/drm/card1/card1-DP-6/status
connected
cat /sys/class/drm/card1/card1-DP-1/status
...
cat /sys/class/drm/card1/card1-DP-5/status
disconnected
The Menu button of the LG external monitor is active and reports
Input Signal:HDMI Resolution: 2560x1440 Refresh: 60Hz
In [condition 2]
> xrandr --listactivemonitors
Monitors: 1
0: +*eDP-1 1920/290x1200/180+0+1440 eDP-1
,
cat /sys/class/drm/card1/card1-eDP-1/status
connected
cat /sys/class/drm/card1/card1-DP-1/status
...
cat /sys/class/drm/card1/card1-DP-4/status
disconnected
while
cat /sys/class/drm/card1/card1-DP-5/
cat: /sys/class/drm/card1/card1-DP-5/status: No such file or directory
cat /sys/class/drm/card1/card1-DP-6/
cat: /sys/class/drm/card1/card1-DP-6/status: No such file or directory
The Menu button of the LG external monitor hungs, it is not possible to move the cursor in the menu display and the report is incomplete
Input Signal:HDMI [no Resolution and Refresh]
Partially overlapping situations are described in [https://askubuntu.com/questions/1256377/external-monitor-not-working][1], [https://askubuntu.com/questions/1421990/new-lenovo-ubuntu-22-04-hdmi-output-not-detected][2],and several Arch linux pages , e.g. as [https://bbs.archlinux.org/viewtopic.php?id=295553][3], with non universal patches, working maybe only for a single well known external monitor.