Install Ubuntu including all drivers from the USB-Live system

If I boot from a Ubuntu USB live stick, everything works perfect on our belinea o.book 1301, but if I install Ubuntu from this stick with completely wiping the harddrive I end up with no wifi, touchpad and no USB support. Not even a USB-Stick or Mouse is recognized. and the Network-card neither, so I cannot install new packages at all.

But all these things work in the Live-System from the USB Stick! I tried all Ubuntu 16.04, 17.10 (17.10 is worse: there is no correct display settings either although it is perfect in the live-stick too) and even 18.04 beta.

Why isn`t the USB stick installing the same version on the system?


Output of lspci |grep -i net:

Ethernet controller: Realtek Semiconductors Co., Ltd. RTL8101/2/6E PCI Express Fast/Gbit Ethernet Controller (rev 02)
Network controller: Realtek Semiconductors Co., Ltd. RTL8187SE Wireless LAN Controller (rev 02)

Output in the USB-live-system of modprobe -c|grep rtl818x

alias pci:v000010ECd00008180sv*sd*bc*sc*i* rtl818x_pci
alias pci:v000010ECd00008185sv*sd*bc*sc*i* rtl818x_pci
...

In the installed system I get no output so there seems there is no RTL drivers installed.

I found some hints on this page, but that seems really hard to install without internet connection.

On the Realtec drivers page, there is only a driver for the old kernel 4.7. ;(


Note: solving the problem for the laptop of my friend is one thing, but I'd rather find a solution how to solve this for everyone:

How do I copy all drivers from the USB live system on my computer?


Solution 1:

I've encountered similar problems in the past. As ever in these situations, the details matter. One solution that has worked for me is to boot the live image, "change root" into the not-working installed image, and use the live-setup's networking to allow the normal update procedure to properly install things. The precise procedure below:

  1. Boot the live image (e.g., USB, CD)
  2. Install Ubuntu to the HDD/SSD as per usual. Two details:
    1. As an aside, consider making multiple partitions, at least one for / and one for /home. This will make future updates or installations much easier. However, unless you know what you're doing, I might suggest sticking with the ext4 filesystem on each partition (unlike the link).
    2. I've generally had better luck not installing updates during this part of the process. You're choice of course, but we'll be doing the updates below, and the whole process at least feels faster if done later.
  3. When the installation finishes "Continue Testing" and don't reboot.
  4. Mount the newly minted root (/) partition by clicking the icon (one of the new gray platter/HDD looking items on the vertical bar to the left)
  5. Open a terminal ("Ack! I know!") via Ctrl+Alt+t -> A purple-looking window will appear

    Terminal example (cropped), akin to Live-image Ubuntu

  6. By clicking on the icon in step 2, Ubuntu Live mounted the hard drive to a directory in /media/ubuntu/. It will potentially be a weird directory name (technically a GUID), like 2801b1ba-d7d4-22e1-a6e3-0abcab51f05a. Task: "Change Root" into that directory with:

    sudo chroot /media/ubuntu/<directory_name>
    
  7. At this point, the shell (terminal) will run all commands as if on the new system, but with access to the working networking of the running kernel (the Live image). So, try a simple update and dist-upgrade (the command line equivalent to what the GUI does when updating your packages) and with luck, the correct packages will install themselves It doesn't always work, but this has been a surprisingly "simple" fix to a number of Live-boot vs installed-boot issues I've encountered:

    apt-get update
    apt-get dist-upgrade
    

I may have missed a step in terms of getting networking setup; if so, please leave a comment, and I'll update this answer when I can more thoroughly confirm each step of this procedure ("I'm not at my desk right now." :-) ).

Solution 2:

Exact copy of the Ubuntu USB live system on my computer

You get an exact copy of the USB live system, if you clone the iso file to your internal drive. This will be faster than when booted from a DVD disk or USB pendrive.

It will be live-only, installed programs and tweaks will not survive shutdown or reboot. So this is not what you want.

Persistent live Ubuntu system in your internal drive

mkusb can create a persistent live Ubuntu system in your internal drive. It will work in the same way as a persistent live system in a USB pendrive. mkusb makes a casper-rw partition for persistence, and the size is only limited by the drive size.

Make a system with mkusb and use mkusb to create a persistent live system.

See the following links and links from them,

  • help.ubuntu.com/community/mkusb

  • help.ubuntu.com/community/mkusb/persistent

  • Compressed image file with a persistent live system

  • In Windows, Win32DiskImager can make a USB boot drive

A persistent live system starts as almost an exact copy of the USB live system

  • You can install program packages,
  • you can tweak the system,
  • you can save data like in an installed system,

and these things will survive shutdown and reboot, they are persistent.

  • But the persistent live system cannot be and should not be completely updated & upgraded
  • and it is more sensitive to corruption compared to an installed system.
  • So you need frequent backups to keep it alive.

Installed Ubuntu system

It might be difficult to find the tweaks to make your particular computer hardware work with an Ubuntu installed system. But this is the best solution in the long run. Such a system can be completely updated & upgraded including linux kernel and all software can be up to date.

Depending on the particular hardware in the computer

  • You may need some boot options.

    Boot options

  • You may need some proprietary driver (for example for the graphics and the wifi).

  • You may have better luck with one particular version of Ubuntu.

    How to select the version and flavour of Ubuntu

Solution 3:

Install but decline updates

To get the exact copy of the Live USB the best method is to not update the system during installation. Some users have experience bugs introduced by recent updates this year (2018):

  • Ubuntu Menu and Launcher not showing after 2/16/2018 update
  • 2/15/18 compiz update broke unity
  • GUI/Unity crashing in 16.04 LTS after updates 2018-01-04, compiz segfaults
  • Touchpad gestures and holding keys does not work
  • virtualbox crash on kernel 4.13.0-26
  • Lubuntu 16.04.3 - After the last update(kernel 4.13.0-26) crashed
  • Ubuntu 16.04 not booting 4.13.0-x-generic
  • Problem with ethernet on latest kernel on Ubuntu 16.04 LTS
  • Intel Microcode 2018-01-08 breaks some systems

Because of these and many other errors I haven't upgraded this year so far. I have manually installed Kernels though to keep ahead of Meltdown and Spectre.

By not applying any of the Ubuntu updates during installation and afterwards you are getting the closest possible system to the Live USB.

Wifi related updates

Here are a couple of similar questions where during Live-USB session Wifi works but breaks after installation:

  • Why does my wireless work during install but not after booting?
  • Internet worked during install, but not after

Solution 4:

As mentioned in WifiDocs/Driver/bcm43xx community help page in Ubuntu Documentation:

A running LiveCD/LiveUSB environment has these packages (allowing the wireless to work), but an installed system may not. Make sure you have the linux-headers package that matches your current kernel version, plus the appropriate generic header packages so that they are automatically updated on a kernel upgrade.

to get it done, please follow the instruction provided in this page.

I hope this helps in solving your problem.