I had the exact same issue. It actual problem is stated here by someone else, with a solution:
https://devtalk.nvidia.com/default/topic/1036167/linux/stuck-trying-to- intall-nvidia-390-ubuntu-18-04-lts-/ The problem is a dialogue requesting to set a password (for secureboot stuff) never pops up. I think the password must be 8 or more characters (not sure if there's an upper limit). A workaround given was when the update gets stuck, type a password in the terminal blindly and press return twice (using the same password both times). This worked for me, except I had to type the password in about 4 times. (This is not necessary in theory, but I think maybe you're supposed to press "return" at other occasions to pass "ok" checkpoints. Therefore, you have to type the password unnecessarily and press return because you don't know where the checkpoints are.) -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1775526 Title: package linux-image-4.15.0-22-generic 4.15.0-22.24 failed to install/upgrade: installed linux-image-4.15.0-22-generic package pre- removal script subprocess returned error exit status 1 Status in linux package in Ubuntu: Confirmed Bug description: Failed to build package when installing nvidia drivers. Every time `Building initial module for 4.15.0-22-generic` is stuck. There is no antivirus on my machine. ProblemType: Package DistroRelease: Ubuntu 18.04 Package: linux-image-4.15.0-22-generic 4.15.0-22.24 ProcVersionSignature: Ubuntu 4.15.0-22.24-generic 4.15.17 Uname: Linux 4.15.0-22-generic x86_64 NonfreeKernelModules: rfcomm bnep nouveau asus_nb_wmi asus_wmi sparse_keymap mxm_wmi intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core ath3k btusb btrtl ath9k ath9k_common btbcm ath9k_hw uvcvideo btintel bluetooth videobuf2_vmalloc videobuf2_memops ath videobuf2_v4l2 videobuf2_core mac80211 videodev media mei_me mei rtsx_pci_ms memstick intel_cstate intel_rapl_perf cfg80211 shpchp lpc_ich ie31200_edac wmi mac_hid asus_wireless i915 rtsx_pci_sdmmc r8169 rtsx_pci ApportVersion: 2.20.9-0ubuntu7 Architecture: amd64 Date: Thu Jun 7 12:36:23 2018 ErrorMessage: installed linux-image-4.15.0-22-generic package pre-removal script subprocess returned error exit status 1 InstallationDate: Installed on 2018-06-05 (1 days ago) InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426) Python3Details: /usr/bin/python3.6, Python 3.6.5, python3-minimal, 3.6.5-3 PythonDetails: /usr/bin/python2.7, Python 2.7.15rc1, python-minimal, 2.7.15~rc1-1 RelatedPackageVersions: dpkg 1.19.0.5ubuntu2 apt 1.6.1 SourcePackage: linux-signed Title: package linux-image-4.15.0-22-generic 4.15.0-22.24 failed to install/upgrade: installed linux-image-4.15.0-22-generic package pre-removal script subprocess returned error exit status 1 UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1775526/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp