Announcement

Collapse
No announcement yet.

One way to get packages to install on a system with no internet connection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    One way to get packages to install on a system with no internet connection

    I needed to do a Kubuntu 20.04 install to my new PC for something I'm working on. However my ethernet and wifi both require some packages not available on the install ISO. So I had a shiny new 20.04 install with no internet. I had the driver files for my ethernet card but it requires the "build-essential" package to rum "make" and "make-install." Build-essential is a meta-packages that pulls 45 packages with it and I had no idea which packages I would need. This method is very helpful in many cases like this one because you don't have to figure out which packages you need - apt does it for you.

    Since my 22.04 is on-line I knew I could get the packages I needed but which packages and how do I get them for 20.04 from a 22.04 install?
    Whatever packages you're situation might be needing, here's a method to easily capture the needed packages and get your system on line.
    If the system you're using is the same distro and release that you need packages for, it's even easier.

    Here's my method:

    You need:
    • A bootable computer with internet access.
    • If it's a different distro or release from the system you need packages for; the ability to create a virtual machine on that computer.
    • A USB drive.

    If you need packages for a different distro/release that the system you are using, start with Step 1.
    If you are using the same distro/release that you need packages for, skip steps 1 and 2.


    1. ​On a system that has internet access, create a virtual machine of the distro you need to get packages for.
    Any VM system you're comfortable with should work and long as you can get on-line from the VM and access a USB drive.
    In my case, I made a VM of Kubuntu 20.04 using QEMU/KVM but I have no doubt VirtualBox would have worked just as well.

    2. Boot the VM and get on-line on the VM.
    Do steps 3, 4, and 5 on the VM.

    3. Open a terminal and run "sudo apt clean".
    This clears unneeded packages that might be left over from the initial install.

    4, Run "sudo apt install -y --download-only <YOUR PACKAGE(S)>".
    This downloads all the packages and dependencies but does not install them.
    In my case, the "build-essential" package is actually 45 packages.
    The packages are now in the /var/cache/apt folder.

    5. Copy the .deb files from /var/cache/apt/ to your USB drive.

    6. Boot the computer or distro you need to install the packages to and mount the USB drive.

    7. Open a terminal and navigate to the USB mount folder.

    8. Run "sudo dpkg -i *.deb" in the folder.


    You now have installed the needed packages.

    In some cases, you may have to install some packages in a specific order to satisfy dependencies.
    If you get dependency errors, install each package one at a time until all the packages are installed.
    In my case, all 45 packages installed easily and without error.

    After doing this, I was able to run the ethernet driver installer and my Kubuntu 20.04 install was on-line.
    Last edited by oshunluvr; Aug 04, 2023, 06:06 AM.

    Please Read Me

    #2
    Therer is an even easier, though possibly obscure way to do this without even needing a second machine

    Have you looked at the contents of the install disk at all?
    Much if not all you need should be available there, build-essential and its components. There is a small repo included that has these package as well as some other utils, and the related info: the /dists and /pool directories specifically. Packages are in /pool
    The problem is that this repo seems to be still set up for optical drive usage.

    If you look at Software Sources, you ill see the option to enable the cdrom as a source:
    Click image for larger version  Name:	Screenshot_20230804_084515.png Views:	0 Size:	41.4 KB ID:	673120
    Try checking this, and closing the app. You will probably see an error regarding pk-client when it reloads information , ignore that.

    Then try installing build-essential.

    Click image for larger version  Name:	Screenshot_20230804_090120.png Views:	0 Size:	400.3 KB ID:	673121

    However if that does not work, it is easy to manually use the USB stick as an apt source:
    • Mount the USB stick, if it isn't already
    • run: sudo apt-cdrom add --cdrom /media/username/drive_name or wherever it is mounted
    • hit <enter> when prompted to insert a disk
    • you may see messages about not mounting a cdrom, particularly if you have the cdrom option checked as in the first image.
    • try installing build-essential again
    • When done, you will want to disable/remove this entry from Software Sources, or from your sources.list manually, else it will look for it every time you update
    Worst case is you have to go and manually dig all the packages found in /pool and manually install them.
    They are sorted in alphabetical sub-directories.
    Last edited by claydoh; Aug 04, 2023, 07:13 AM.

    Comment


      #3
      I tried that first but couldn't install build-essential from it. It appears to be there under /pool/b/ but even after I enabled the cdrom as a source it wouldn't install. Maybe I did it wrong.

      Anyway, I also had a ubuntu server install that need the same files so doing this helped me a lot.

      I figured this technique had other potential uses so I figured it was worth documenting.

      Please Read Me

      Comment


        #4
        One of my points is that all the debs for build-essential and its dependencies are on the ISO (including the server ISO), though getting them all together to install with dpkg is a bit of a hassle due to the file system tree, if using a GUI file manager. But probably easier than sneakernet?
        But there are some unneeded debs as well, to be sure.
        I was showing 22.04, maybe there is a bug here with 20.04?

        Comment


          #5
          Several times I wasn't able to install the wifi driver for the wifi chip on my PC while installing an ISO, BUT, when I plugged in a cat-5 or 6 cable ETH0 always lit up and I had a connection. What PC is it that didn't automatically connect using an ETH0 cable?
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            Originally posted by GreyGeek View Post
            Several times I wasn't able to install the wifi driver for the wifi chip on my PC while installing an ISO, BUT, when I plugged in a cat-5 or 6 cable ETH0 always lit up and I had a connection. What PC is it that didn't automatically connect using an ETH0 cable?
            The Ethernet port is a brand new "RTL8125 2.5GbE" and it didn't exist in 2020 so no driver in the kernel. Ones has to manually install the driver provided by Realtek, and this requires build-essential

            Please Read Me

            Comment

            Working...
            X