Massive startup lag of "VueScan" after removal of optimus-manager and non-free nvidia driver re-install

Hi folks, I ran into some issues after the removal of optimus-manager from my laptop with intel/nvidia dual graphics. I did that, because nvidia-prime seems to be the way to handle optimus-switching in the future.
Because my system did some unexpected things in steam games after the optimus-manager removal, I deleted and re-installed the non-free nvidia drivers. I also removed the intel-, nvidia- and mhwd-config-files in /etc/X11/xorg.conf.d . After that I ran mhwd -lh.
Right now most things seem to work, but my scanner software VueScan has a massive startup lag - even after re-installing it several times from the AUR or as a flatpack. When I start it (with or without prime-run), it freezes at the small startup-window, but the actual program starts after around 7 minutes. And I still have some quirks in certain games.
Probably I broke a config somewhere, but I don’t know where to look at… Any suggestions?

  1. Please read this:
    How to provide good information
    and post some more information so we can see what’s really going on. Now we know the symptom of the disease, but we need some more probing to know where the origin lies… :grin:
  2. An inxi --admin --verbosity=7 --filter --no-host --width would be the minimum required information for us to be able to help you. (Personally Identifiable Information like serial numbers and MAC addresses will be filtered out by the above command)
    Also, please copy-paste that output in-between 3 backticks ``` at the beginning and end of the code/text.
  3. Executing VueScan in a terminal and providing the output would be helpful as well.

:+1:

P.S. If you enter a bit more details in your profile, we can also see which Desktop Environment you’re using, which exact CPU/GPU or Kernel, … you have without typing it every time

System:
  Kernel: 5.13.5-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.13-x86_64 
  root=UUID=9e744c1a-ec40-4c90-b092-da43ca14110d rw quiet 
  cryptdevice=UUID=3352fb98-8855-4902-9528-db429256c07d:luks-3352fb98-8855-4902-9528-db429256c07d 
  root=/dev/mapper/luks-3352fb98-8855-4902-9528-db429256c07d 
  resume=/dev/mapper/luks-3352fb98-8855-4902-9528-db429256c07d apparmor=1 
  security=apparmor udev.log_priority=3 
  Desktop: Xfce 4.16.0 tk: Gtk 3.24.29 info: xfce4-panel wm: xfwm 4.16.1 
  dm: LightDM 1.30.0 Distro: Manjaro Linux base: Arch Linux 
Machine:
  Type: Laptop System: Micro-Star product: GE73 Raider RGB 8RF v: REV:1.0 
  serial: <filter> Chassis: type: 10 serial: <filter> 
  Mobo: Micro-Star model: MS-17C5 v: REV:1.0 serial: <filter> 
  UEFI: American Megatrends v: E17C5IMS.10F date: 05/20/2019 
Battery:
  ID-1: BAT1 charge: 39.3 Wh (97.3%) condition: 40.4/53.4 Wh (75.6%) 
  volts: 11.9 min: 10.9 model: MSI BIF0_9 type: Li-ion serial: N/A 
  status: Unknown 
Memory:
  RAM: total: 15.48 GiB used: 2.08 GiB (13.4%) 
  Array-1: capacity: 32 GiB slots: 2 EC: None max-module-size: 16 GiB 
  note: est. 
  Device-1: ChannelA-DIMM0 size: 16 GiB speed: 2667 MT/s type: DDR4 
  detail: synchronous bus-width: 64 bits total: 64 bits manufacturer: Samsung 
  part-no: M471A2K43CB1-CTD serial: <filter> 
  Device-2: ChannelB-DIMM0 size: No Module Installed 
CPU:
  Info: 6-Core model: Intel Core i7-8750H socket: U3E1 bits: 64 type: MT MCP 
  arch: Kaby Lake note: check family: 6 model-id: 9E (158) stepping: A (10) 
  microcode: EA cache: L1: 384 KiB L2: 9 MiB L3: 9 MiB bogomips: 52815 
  Speed: 4095 MHz min/max: 800/4100 MHz base/boost: 2100/8300 volts: 0.8 V 
  ext-clock: 100 MHz Core speeds (MHz): 1: 4095 2: 4057 3: 4102 4: 4100 
  5: 4101 6: 4100 7: 4098 8: 4086 9: 4001 10: 4099 11: 4092 12: 4000 
  Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat arch_perfmon art 
  avx avx2 bmi1 bmi2 bts clflush clflushopt cmov constant_tsc cpuid 
  cpuid_fault cx16 cx8 de ds_cpl dtes64 dtherm dts epb ept ept_ad erms est 
  f16c flexpriority flush_l1d fma fpu fsgsbase fxsr ht hwp hwp_act_window 
  hwp_epp hwp_notify ibpb ibrs ida intel_pt invpcid invpcid_single lahf_lm lm 
  mca mce md_clear mmx monitor movbe mpx msr mtrr nonstop_tsc nopl nx pae pat 
  pbe pcid pclmulqdq pdcm pdpe1gb pebs pge pln pni popcnt pse pse36 pti pts 
  rdrand rdseed rdtscp rep_good sdbg sep smap smep ss ssbd sse sse2 sse4_1 
  sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc tsc_adjust 
  tsc_deadline_timer vme vmx vnmi vpid x2apic xgetbv1 xsave xsavec xsaveopt 
  xsaves xtopology xtpr 
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
  Type: l1tf 
  mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, 
  IBRS_FW, STIBP: conditional, RSB filling 
  Type: srbds mitigation: Microcode 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] vendor: Micro-Star MSI 
  driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:3e9b class-ID: 0300 
  Device-2: NVIDIA GP104M [GeForce GTX 1070 Mobile] vendor: Micro-Star MSI 
  driver: nvidia v: 470.57.02 alternate: nouveau,nvidia_drm bus-ID: 01:00.0 
  chip-ID: 10de:1ba1 class-ID: 0300 
  Device-3: Acer HD Webcam type: USB driver: uvcvideo bus-ID: 1-13:13 
  chip-ID: 5986:1140 class-ID: 0e02 serial: <filter> 
  Device-4: Logitech HD Pro Webcam C920 type: USB 
  driver: snd-usb-audio,uvcvideo bus-ID: 1-4.1:8 chip-ID: 046d:082d 
  class-ID: 0102 serial: <filter> 
  Display: server: X.Org 1.20.11 compositor: xfwm4 v: 4.16.1 driver: 
  loaded: modesetting,nvidia alternate: fbdev,intel,nouveau,nv,vesa 
  display-ID: :0.0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") 
  s-diag: 582mm (22.9") 
  Monitor-1: eDP-1 res: 1920x1080 dpi: 128 size: 381x214mm (15.0x8.4") 
  diag: 437mm (17.2") 
  Monitor-2: HDMI-1-0 res: 1920x1080 hz: 60 dpi: 92 
  size: 531x298mm (20.9x11.7") diag: 609mm (24") 
  OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 21.1.5 
  direct render: Yes 
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Micro-Star MSI 
  driver: snd_hda_intel v: kernel alternate: snd_soc_skl,snd_sof_pci_intel_cnl 
  bus-ID: 00:1f.3 chip-ID: 8086:a348 class-ID: 0403 
  Device-2: Logitech HD Pro Webcam C920 type: USB 
  driver: snd-usb-audio,uvcvideo bus-ID: 1-4.1:8 chip-ID: 046d:082d 
  class-ID: 0102 serial: <filter> 
  Sound Server-1: ALSA v: k5.13.5-1-MANJARO running: yes 
  Sound Server-2: sndio v: N/A running: no 
  Sound Server-3: JACK v: 1.9.19 running: no 
  Sound Server-4: PulseAudio v: 14.2 running: no 
  Sound Server-5: PipeWire v: 0.3.32 running: yes 
Network:
  Device-1: Intel Cannon Lake PCH CNVi WiFi driver: iwlwifi v: kernel 
  port: 6000 bus-ID: 00:14.3 chip-ID: 8086:a370 class-ID: 0280 
  IF: wlo1 state: down mac: <filter> 
  Device-2: Qualcomm Atheros Killer E2500 Gigabit Ethernet 
  vendor: Micro-Star MSI driver: alx v: kernel port: 3000 bus-ID: 03:00.0 
  chip-ID: 1969:e0b1 class-ID: 0200 
  IF: enp3s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
  IP v4: <filter> type: dynamic noprefixroute scope: global 
  broadcast: <filter> 
  IP v6: <filter> type: dynamic noprefixroute scope: global 
  IP v6: <filter> type: dynamic noprefixroute scope: global 
  IP v6: <filter> type: noprefixroute scope: link 
  Device-3: Realtek RTL8153 Gigabit Ethernet Adapter type: USB driver: r8152 
  bus-ID: 2-3.4.4:5 chip-ID: 0bda:8153 class-ID: 0000 serial: <filter> 
  IF: enp0s20f0u3u4u4 state: down mac: <filter> 
  IF-ID-1: virbr0 state: down mac: <filter> 
  IP v4: <filter> scope: global broadcast: <filter> 
  WAN IP: <filter> 
Bluetooth:
  Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) type: USB 
  driver: btusb v: 0.8 bus-ID: 1-14:15 chip-ID: 8087:0aaa class-ID: e001 
  Report: bt-adapter ID: hci0 rfk-id: 1 state: up address: <filter> 
Logical:
  Message: No logical block device data found. 
  Device-1: luks-654e7435-e8ca-4b13-8abb-18733a64eff7 maj-min: 254:1 
  type: LUKS dm: dm-1 size: 1.82 TiB 
  Components: 
  p-1: sda1 maj-min: 8:1 size: 1.82 TiB 
  Device-2: luks-3352fb98-8855-4902-9528-db429256c07d maj-min: 254:0 
  type: LUKS dm: dm-0 size: 237.47 GiB 
  Components: 
  p-1: nvme0n1p2 maj-min: 259:2 size: 237.47 GiB 
RAID:
  Message: No RAID data found. 
Drives:
  Local Storage: total: 2.05 TiB used: 1.26 TiB (61.5%) 
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Kingston model: RBUSNS8154P3256GJ 
  size: 238.47 GiB block-size: physical: 512 B logical: 512 B speed: 15.8 Gb/s 
  lanes: 2 type: SSD serial: <filter> rev: E8FK11.C temp: 41.9 C scheme: GPT 
  SMART: yes health: PASSED on: 30d 6h cycles: 1,127 
  read-units: 13,241,884 [6.77 TB] written-units: 11,227,076 [5.74 TB] 
  ID-2: /dev/sda maj-min: 8:0 vendor: Crucial model: CT2000MX500SSD1 
  family: Micron Client SSDs size: 1.82 TiB block-size: physical: 512 B 
  logical: 512 B sata: 3.3 speed: 6.0 Gb/s type: SSD serial: <filter> rev: 023 
  temp: 31 C scheme: GPT 
  SMART: yes state: enabled health: PASSED on: 122d 16h cycles: 1047 
  written: 7.4 TiB 
  Message: No optical or floppy data found. 
Partition:
  ID-1: / raw-size: 237.47 GiB size: 232.74 GiB (98.01%) 
  used: 136.37 GiB (58.6%) fs: ext4 block-size: 4096 B dev: /dev/dm-0 
  maj-min: 254:0 mapped: luks-3352fb98-8855-4902-9528-db429256c07d label: N/A 
  uuid: 9e744c1a-ec40-4c90-b092-da43ca14110d 
  ID-2: /boot/efi raw-size: 1024 MiB size: 1022 MiB (99.80%) 
  used: 444 KiB (0.0%) fs: vfat block-size: 512 B dev: /dev/nvme0n1p1 
  maj-min: 259:1 label: N/A uuid: 6C3E-CC70 
  ID-3: /home raw-size: 1.82 TiB size: 1.79 TiB (98.38%) 
  used: 1.13 TiB (63.1%) fs: ext4 block-size: 4096 B dev: /dev/dm-1 
  maj-min: 254:1 mapped: luks-654e7435-e8ca-4b13-8abb-18733a64eff7 label: N/A 
  uuid: eebc0eac-242a-49fb-b6d2-968d79f5c330 
Swap:
  Alert: No swap data was found. 
Unmounted:
  Message: No unmounted partitions found. 
USB:
  Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 16 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Device-1: 1-1:2 info: Razer USA BlackWidow Lite (2018) type: Keyboard,Mouse 
  driver: razerkbd,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s power: 500mA 
  chip-ID: 1532:0235 class-ID: 0300 
  Device-2: 1-2:3 info: Razer USA DeathAdder Elite type: Mouse,Keyboard 
  driver: razermouse,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s power: 500mA 
  chip-ID: 1532:005c class-ID: 0300 
  Hub-2: 1-3:4 info: Realtek RTS5411 Hub ports: 4 rev: 2.1 speed: 480 Mb/s 
  chip-ID: 0bda:5411 class-ID: 0900 
  Hub-3: 1-3.4:16 info: Realtek RTS5411 Hub ports: 4 rev: 2.1 speed: 480 Mb/s 
  chip-ID: 0bda:5411 class-ID: 0900 
  Hub-4: 1-4:5 info: VIA Labs USB2.0 Hub ports: 4 rev: 2.1 speed: 480 Mb/s 
  chip-ID: 2109:2815 class-ID: 0900 
  Device-1: 1-4.1:8 info: Logitech HD Pro Webcam C920 type: Video,Audio 
  driver: snd-usb-audio,uvcvideo interfaces: 4 rev: 2.0 speed: 480 Mb/s 
  power: 500mA chip-ID: 046d:082d class-ID: 0102 serial: <filter> 
  Device-2: 1-6:7 info: SteelSeries ApS SteelSeries ALC type: HID 
  driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s 
  power: 300mA chip-ID: 1038:1124 class-ID: 0300 
  Device-3: 1-7:10 info: Realtek RTS5129 Card Reader Controller 
  type: <vendor specific> driver: rtsx_usb,rtsx_usb_ms,rtsx_usb_sdmmc 
  interfaces: 1 rev: 2.0 speed: 480 Mb/s power: 500mA chip-ID: 0bda:0129 
  class-ID: ff00 serial: <filter> 
  Device-4: 1-9:11 info: SteelSeries ApS SteelSeries KLC type: HID 
  driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s 
  power: 300mA chip-ID: 1038:1122 class-ID: 0300 
  Device-5: 1-13:13 info: Acer HD Webcam type: Video driver: uvcvideo 
  interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 500mA chip-ID: 5986:1140 
  class-ID: 0e02 serial: <filter> 
  Device-6: 1-14:15 info: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) 
  type: Bluetooth driver: btusb interfaces: 2 rev: 2.0 speed: 12 Mb/s 
  power: 100mA chip-ID: 8087:0aaa class-ID: e001 
  Hub-5: 2-0:1 info: Full speed (or root) Hub ports: 8 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
  Hub-6: 2-3:2 info: Realtek Hub ports: 4 rev: 3.0 speed: 5 Gb/s 
  chip-ID: 0bda:0411 class-ID: 0900 
  Hub-7: 2-3.4:4 info: Realtek Hub ports: 4 rev: 3.0 speed: 5 Gb/s 
  chip-ID: 0bda:0411 class-ID: 0900 
  Device-1: 2-3.4.4:5 info: Realtek RTL8153 Gigabit Ethernet Adapter 
  type: Network driver: r8152 interfaces: 1 rev: 3.0 speed: 5 Gb/s 
  power: 256mA chip-ID: 0bda:8153 class-ID: 0000 serial: <filter> 
  Hub-8: 2-4:3 info: VIA Labs USB3.0 Hub ports: 4 rev: 3.2 speed: 5 Gb/s 
  chip-ID: 2109:0815 class-ID: 0900 
Sensors:
  System Temperatures: cpu: 48.0 C mobo: N/A 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 351 Uptime: 4m wakeups: 1 Init: systemd v: 248 tool: systemctl 
  Compilers: gcc: 11.1.0 alt: 10 clang: 12.0.1 Packages: 1961 note: see --pkg 
  pacman: 1933 lib: 483 flatpak: 25 snap: 3 Shell: Zsh (sudo) v: 5.8 
  default: Bash v: 5.1.8 running-in: terminator inxi: 3.3.06 

Executing vuescan via terminal generates no output at all. I presume, that it is scanning for hardware (i.e. available scanners/cameras) during the startup every time.

Another oddity after removing optimus-manager and the mentioned files in xorg.conf.d is, that mouse and external keyboard (both Razer products) are available when I have to enter the disk encryption password, than are not available at the xfce password screen (I have to use the laptop keyboard) and than also need some time (~1-2min) to be detected when the desktop is already booted. Keyboard and mouse become available, when the bluetooth icon is appearing. So could it probably be a USB config issue?

please install both 5.4 and 5.10 LTS (Long Time Support) and see which one of the two troubles you least.

Does this also happen when you create a new user and log in there? (E.G. fumum_vendidi2)

:thinking:

Well, I don’t think it is a kernel issue, because I was on 5.13.5-1 before and did not have any trouble until removing the mentioned program/config files. I already tried a fallback on 5.10 LTS and the issues were the same.

edit:

  1. Same VueScan behaviour with different user.
  2. Meanwhile I did some more testing and it seams to be an issue with messed up hardware detection. I ran VueScan via terminal an tried to run mhwd and inxi in other terminal windows during the lag phase. Both inxi and mhwd stalled. Other operations in terminal windows (i.e. nano, etc.) worked normally.
    How do I fix a messed up mhwd / hardware detection config? Uninstalling and re-installing mhwd made no difference.

I still couldn’t fix my issues, but now I am quite convinced it has something to do with hardware detection. The detection of external mouse and keyboard takes much longer than before the mentioned removal of optimus-manager and config files. The slow startup of VueScan also seems to be an issue of laggy hardware detection. Maybe it has something to do with Xorg and/or Lightdm.
Does nobody have an idea how to find the issue and fix it? I really don’t want to re-install the whole system from scratch.

gscan2pdf is available from the community repository and works fine here in infrequent use. Maybe give that one a try?

Well, VueScan does work fine after about 7 or so minutes. My intention is to fix the underlying problem.