2

I tried to upgrade from 20.04 to 22.04 on an HP envy and after the installation there is no wifi adapter and no bluetooth either.

The kernel I'm booting into is 5.13 if I'm not mistaken. I was hoping to connect to the internet and run some version of apt update && apt upgrade but I don't know how to connect. The laptop doesn't have an ethernet port and I tried bluetooth tethering but the bluetooth adapter also doesn't work and finally usb tethering didn't do anything either (ie the computer didn't recognize a new network or smth similar).

I was thinking that I can somehow fix this if I boot from a live USB maybe I could fix this but not sure how or if I can somehow download .deb packages that might be missing and install them. I tried to download the 6.2 kernel download link (the ones under this line "Test amd64/build succeeded (rc=0, on=amd64, time=0:13:06, log=amd64/log)" but this failed to install)

I'm somewhat familiar with linux / ubuntu but not enough to go further. Let me know what further info would be helpful.

Raffa
  • 32,237
evan54
  • 745
  • 1
    When booting you should see a menu, Using the option 'Advanced options for Ubuntu' should bring up a list of kernels. With this option you can boot from an old kernel (which hopefully has wifi) – Luuk Sep 08 '23 at 12:21
  • 1
    "I was thinking that I can somehow fix this if I boot from a live USB maybe I could fix this but not sure how" ... How --> https://askubuntu.com/a/1238393/968501 – Raffa Sep 08 '23 at 13:08
  • @luuk I tried this and the old kernel is the one i'm using - this was actually a problem with the previous issues as well - right now only have 2 kernels and the one it doesn't boot into it wouldn't even before the upgrade and the one it does boot into doesn't have wifi – evan54 Sep 08 '23 at 15:02
  • 2
    @Raffa your link worked like magic - after being able to drop into a root of the original system via liveUSB per your link I manually installed the deb packages. Only thing I needed to modify was an rbind instead of bind and some further troubleshooting on the GRUB interface but managed to manually download the 6.2 kernel and install it. Please post your answer so I can accept it – evan54 Sep 11 '23 at 08:36
  • @evan54 Done that with extra up-to-date info ... Please, let me know if I missed something. – Raffa Sep 11 '23 at 15:22

1 Answers1

4

There are ways to fix a non-functional system via built-in options like booting into an older kernel or tools like rescue/recovery mode ... etc. ... However, oftentimes, those builtin mechanisms might fail to fulfill your maintenance needs and an external help is needed ... In which case you can "metaphorically" but actually hook up your dying system to life support and open its gut to fix what's damaged and then bring it back to life ... For that you'll need a boot-able USB stick or other media containing a live Ubuntu system i.e. the kind you used to install Ubuntu on your machine in the first time ... Then, follow the instructions below.

Preparation

Boot into the live system then connect to Internet from the live system and open a terminal then find your root partition (the one that on which your system's root directory / resides) ... You can list partitions with e.g.:

sudo fdisk -l

... identify your root partition ... It could be something like /dev/sda2 ... Or it could be a logical volume or a ZFS pool that you need to scan for and prepare or even an encrypted disk/partition/volume that you need to decrypt first ... Whatever it is, you need to get it mounted at e.g. /mnt like so:

sudo mount /dev/sda2 /mnt/

Notice that if you have a separate /boot partition, then you need to mount it at /mnt/boot/ and likewise if you have a separate /home partition, then you need to mount it as well at /mnt/home/.

Then, only if you have the UEFI GRUB boot loader version, you'll need to mount the EFI partition under /mnt/boot like so:

sudo mount /dev/sda1 /mnt/boot/efi/

Then, "bind" mount healthy needed system directories from the live system over their equivalents in the damaged system under /mnt ... First, /proc:

sudo mount --bind /proc/ /mnt/proc/

... Then, /sys:

sudo mount --bind /sys/ /mnt/sys/

... Then, /dev:

sudo mount --rbind /dev/ /mnt/dev/

Notice the recursive bind mount with --rbind for /dev in order to also include the sub-mount of /dev/pts that might be needed for some commands like e.g. sudo and su to work (see why).

Now, run:

sudo cp /etc/resolv.conf /mnt/etc/resolv.conf

... That will copy your currently configured search domains from the live system to the chroot environment so that applications that rely on it to resolve DNS will work e.g. resolving repositories URIs from /etc/apt/sources.list when you do e.g. apt update from the terminal ... That change, however, will not persist after booting from the system on disk as that file is actually symlinked to /run/systemd/resolve/stub-resolv.conf which is dynamically managed by systemd-resolved.

Action

Run:

sudo chroot /mnt/

... and voila ... Now, you are operating on the original system on the disk, connected to Internet, with the root user's privileges and every command that you run from now on will be executed in this context ... So, fix your system as needed ... A good start (Set of maintenance commands) is almost always:

dpkg --configure -a && apt update && apt upgrade

... and when done run:

exit

Cleanup

Unmount previous mounts like so:

sudo umount /mnt/dev/

... then:

sudo umount /mnt/sys/

... then:

sudo umount /mnt/proc/

... and any others you mounted in the reverse order and you're done.

Raffa
  • 32,237
  • only thing I did differently was that the hard drive was already booted when I logged in with the liveUSB and instead of /mnt I navigated in the right folder and would just use . – evan54 Sep 14 '23 at 10:04