I’m unable to install packages using a file in Linux because the system can’t locate the packages. Can someone help me please?

I installed Debian Trixie (debian-13.1.0-amd64-DVD-1.iso) with the help of a USB stick. This has been my customary way of installing Debian.

On this occasion I did something different.

I copied a file called packages.txt to the same USB flash drive. The former contains a long list of packages to be installed.

During the installation process, I didn’t install a desktop environment.

After installation, my computer booted into a tty1 console.

At the tty1 console, I did the following:

  1. sudo nano /etc/apt/sources.list

  2. I commented out the line containing the word “cdrom” (without quotes).

  3. I added the following line:

    deb [trusted=yes] file:/media/usbdrive trixie main

  4. sudo mkdir /media/usbdrive

  5. sudo mount /dev/sda1 /media/usbdrive

  6. sudo apt update

This time round, instead of typing each of the names of some twenty or so packages, the USB stick has a custom file called packages.txt

The following command in tty1 console was what Google suggested to me:

sudo apt install $(cat packages.txt)

The error message was:

Unable to locate package1..package2….package3…etc

What I did next was this:

cd /media/usbdrive

I used the ls command to list the files and directories and the file called packages.txt was there.

I’d appreciate it if someone could help fix my problem.