2

I like to use 2 monitors while I work. I did this with my first laptop that I dual booted with Ubuntu and never had any problems, but it did not have a Nvidia graphics card.

I recently bought a new laptop and this is my first one with an Nvidia graphics card. This has just been a mess.

When first tried my monitor on the new laptop, it wouldn't connect. Initially, I thought nothing of it. When I switched to Windows, it connected just fine, indicating there was nothing wrong with my monitor or my laptop physically. I checked this with a few monitors and found the problem was exclusively when I'm on Ubuntu.

I then tried following this question:

External monitor not detected on Ubuntu 18.04

The only solution that worked was

sudo apt-get purge 'nvidia*'
sudo ubuntu-drivers autoinstall

Now, here's the weird thing. Every month or every couple months, I would wake up and boot up my laptop, and I would find that suddenly my monitor didn't work again. I then would run that set of commands and I would find the monitor worked again.

Well, not this morning. This morning when I ran that set of commands, after running

sudo ubuntu-drivers autoinstall

I got the following error as seen on this thread

sudo ubuntu-drivers autoinstall: UnboundLocalError: local variable 'version' referenced before assignment

I tried following the answerer's advice

Had the same issue, fixed it by installing the driver from "Software & Updates" -> "Additional Drivers" & then the newest Nvidia Driver. After that running sudo ubuntu-driver autoinstall gave me "All the available drivers are already installed."

and it didn't work. My second monitor still doesn't work now.

I have two questions

  1. Does anyone have any idea what's going on?
  2. Is there a permanent way to fix this?

I know I haven't provided any background information on my laptop, so I'm happy to provide any information needed to answer the question. Just comment below and I'll add edits with screen shots of any info you might need.

Info on my system

  • Version of Ubuntu: Ubuntu 22.04.1 LTS
Stan Shunpike
  • 141
  • 1
  • 6

3 Answers3

2

I have booted today to this same issue, and apparently it is a freshly introduced bug, with multiple instances popping around here:

The solution posted at #3 here on the bug report worked for me:

I edited /usr/lib/python3/dist-packages/UbuntuDrivers/detect.py at line 835 from [-1] to [2], which will break ubuntu-drivers after the underlying issue gets fixed. I also had to poke Software & Updates > Additional Drivers options a few times before the driver started loading.

Zanna
  • 70,465
bobyor
  • 21
0

Had the same issues this morning after installing the following updates, and have had to revert to using Xorg to get both my desktop monitors working.

-linux-objects-nvidia-470-6.2.0-1005-oracle -linux-objects-nvidia-470-6.2.0-1007-lowlatency -linux-signatures-nvidia-6.2.0-1005-oracle -linux-signatures-nvidia-6.2.0-1007-lowlatency

0

I met a similar problem on my Ubuntu 22.04 with a GeForce GTX 1660 Ti graphics card. Here are the steps that worked for me:

  1. Purge all previous Nvidia packages, also including libraries
    sudo apt purge '*nvidia*'
    sudo apt autoremove
    dpkg -l | grep -i nvidia  # make sure there aren't any left and we start from scratch
    
  2. Blacklist the nouveau driver
    sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
    sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
    sudo update-initramfs -u
    
  3. Run sudo ubuntu-drivers install and reboot the PC.
    sudo ubuntu-drivers install
    sudo reboot
    
karel
  • 114,770