Errors on Shutdown & Kernel Panic

I've noticed some errors on shutdown and what looks like a brief kernel panic as the machine shutdowns. I looked in journalctl and think it is NVIDIA related. I'm using MSI Raider GE67HX and Zorin 16.3 Pro. Kernel 5.15.0-83-generic and dual booting with Windows 11 Pro. Just wondering if anyone can shed any light on this. Would a kernel upgrade help? Ive had some fun times configuring this the last 12 months and had to manually hunt down and install most of the drivers as the hardware is so new. Other than this screen on shutdown everything else is running pretty smoothly...


It looks (based on your post) like you are using Nvidia Graphics. The modules are failing to unload at shutdown.
Can you please confirm two things:

  • Are you using Snap packages?
  • Are you using Nvidia graphics?

Yep, I'm using both Nvidia and Snap.

Which kernel are you on?

uname -r

and which Nvidia driver are you using?

sudo lshw -C video

I'm on kernel 5.15.0-83-generic and I'm using 525 proprietary for Nvidia. I was on 515 and then the last update that vanished and became 525 which is where the issue may be. I read that 515 has become 525. I did try to reinstall 515 but it still shows 525 :slight_smile:

I'm still researching oldroot won't unmount. Most posts suggest possible old kernel versions. Thanks for your help by the way.

*-display
description: VGA compatible controller
product: NVIDIA Corporation
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:01:00.0
logical name: /dev/fb0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vga_controller bus_master cap_list rom fb
configuration: depth=32 driver=nvidia latency=0 mode=2560x1440 visual=truecolor xres=2560 yres=1440
resources: iomemory:600-5ff iomemory:640-63f irq:212 memory:53000000-53ffffff memory:6000000000-63ffffffff memory:6400000000-6401ffffff ioport:8000(size=128) memory:54000000-5407ffff
*-display
description: VGA compatible controller
product: Intel Corporation
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 0c
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: iomemory:640-63f iomemory:400-3ff irq:207 memory:6433000000-6433ffffff memory:4000000000-400fffffff ioport:9000(size=64) memory:c0000-dffff memory:4010000000-4016ffffff memory:4020000000-40ffffffff

Those are both stable...

You might try purging your Nvidia drivers completely.

sudo apt remove --purge '^nvidia-.*'

Then run (Without restarting)

sudo ubuntu-drivers install

(you may want the XSwat team updates for graphics:

sudo add-apt-repository ppa:ubuntu-x-swat/updates

sudo apt update && sudo apt full-upgrade

)
Launch Software & Updates > Additional Drivers tab and select the 525 (proprietary) driver.

If this does not help, elevate to Root:

sudo -i

Launch File manager:

nautilus

Navigate to /etc/systemd/system
Right click an open area and create a new document. Name it nvidia-unload-shutdown.service

Paste the following contents into the file:

# /etc/systemd/system/nvidia-unload-shutdown.service

[Unit]
Description=Remove nvidia modules before shutdown
DefaultDependencies=no
After=gdm.service

[Service]
Type=oneshot
ExecStart=/usr/bin/modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia

[Install]
WantedBy=shutdown.target

Save the file. Exit the elevated file manager and terminal and restart once.
Then, reboot again and test.

Awesome....thanks so much. Will give this a go!!

1 Like

Well unfortunately that completely killed my system. It crashed half-way through the ubuntu drivers update and now won't boot.:cold_face:...will try recovery mode. Luckily I backed everything up yesterday with Timeshift.

Are you running solely on a Nvidia card? That's unusual.

Yes, grub menu > Advanced Options for Zorin - Select Recovery.
Once in recovery, enable networking. Then Root - drop to prompt

sudo ubuntu-drivers install

If you haven't already, then run

sudo add-apt-repository ppa:ubuntu-x-swat/updates

sudo apt update && sudo apt full-upgrade

Proceed to normal boot...

In recovery. No not solely Nvidia card but I've noticed that nearly everything to do with Nvidia has issues :joy:.

It's crashed now as well in recovery mode.

I've got Intel and Nvidia

Things were weird... Then you said this even weirder thing.

I've never seen that happen before... Crashed in recovery? That is not even using any Nvidia graphics.

Are you able to boot normally in a previous kernel than the 5.15.0-83?

Just booted into the previous kernel. Attempting to sort the drivers as per your advice. I've had lots of issues with my MSI. I think it's mostly down to the new hardware. Been using Linux for 15 years so fairly used to fixing things.

You have me beat by at least 12.8 years, there...

I wonder if you need a later kernel than the current Zorin Provided one?

If you want to test it, I recommend the Tuxinvader patch as the most (By far) stable one.

Yeah I was thinking about Tuxinvader. Just got it back to normal boot by the way :wink: but still have same panic on shutdown :rofl: will add file in /etc/systemd

Going to explore Tux as ive added the nvidia shutdown file amd still receive "Can't unmount oldroot" and kernel panic. Journalctl and kernel logs point to nomodeset nvidia error :wink:

You also can try replacing the contents of:

With

[Unit]
Description=rm nvidia modules
After=umount.target
DefaultDependencies=false


[Service]
Type=oneshot
ExecStart=/usr/sbin/rmmod nvidia_uvm
ExecStart=/usr/sbin/rmmod nvidia_drm
ExecStart=/usr/sbin/rmmod nvidia_modeset
ExecStart=/usr/sbin/rmmod nvidia
ExecStart=/usr/sbin/rmmod i2c_nvidia_gpu


[Install]
WantedBy=final.target

IF that fails, try replacing the previous with:

for MODULE in nvidia_drm nvidia_modeset nvidia_uvm nvidia
   do
       if lsmod | grep "$MODULE" &> /dev/null ; then
          rmmod $MODULE
       fi
   done  

Make sure that nvidia-unload-shutdown.service is executable, by the way...

1 Like

That didn’t fix it unfortunately. Tried both file contents and made executable but still receive the same screen in shutdown. It's definitely Nvidia issue as the kernel log shows "error drm Nvidia nomodset"

The system runs fine otherwise :sweat_smile:. Will make sure I clean it up, back it up and address newer kernel and go from there. Hopefuly Zorin 17 is out soon and that might fix a lot of outstanding issues for everyone. Ive been using Zorin since Zorin 12 :wink: I use others as well. Kali, Arch but Zorin is my daily driver.

Are you logging in on Wayland or Xorg?

Xorg- X11. Spent the day on and off attempting to reconfigure nvidia. It's definitely the issue. Checked nvidia site and says 535 proprietary so switched to that but still receive same message on shutdown :rofl:. I'm running RTX 3080 card. Re-added nvidia shutdown file in /etc/systemd/system made executable but still no joy :upside_down_face:

I've resorted to using 525 proprietary driver. Still can't fix the error message on shutdown. No broken packages, synaptic shows none, cmd shows none. Made sure that persistent mode for nvidia is turned on. Biggest problem is anytime i run sudo ubuntu-drivers install the system crashes as it tries to install nvidia drivers even with sudo -i privelage. Extremely odd indeed.