17

I installed Debian 7 using a USB flash drive "burned" from the first DVD ISO of the Debian installation CD/DVD.

I did a very minimal install without Debian desktop environment, Print server and Standard system utilities.

After installation and a reboot, I was presented with a console with the words Debian GNU/Linux 7 hostname tty1. I supplied the login username and password.

After I typed the command sudo apt-get install xorg, an error message popped up stating:

Media changed: please insert the disk labeled 'Debian GNU/Linux 7.4.0 _Wheezy_ - Official amd64 DVD Binary-1 20140208-13:47' in the drive and press Enter

I inserted the same USB flash drive into the same port and after waiting for a few seconds, I pressed Enter.

The same error message popped up.

I have tried the following steps on the advice of some of my colleagues:

  1. remove/delete all the entries in /etc/apt/sources.list and reboot the computer
  2. dmesg and fstab show that the USB thumb drive is mounted on /dev/sdb1
  3. sudo mount /dev/sdb1 /media/usb0
  4. sudo apt-cdrom -m -d /media/usb0 add

After doing the above, the following error message appears:

Using CD-ROM mount point /media/cdrom/
Identifying.......{a long string of alphanumeric characters}
Scanning disc for index files...............
Found 0 package indexes, 0 source indexes, 0 translation indexes and 0 signatures
W: Failed to mount '/dev/sr0' to '/media/cdrom/'
E: Unable to locate any package files, perhaps this is not a Debian disc or the wrong architecture

I prefer to install Xorg (60MB) and gnome-core (400MB) from the USB stick. The NGO that I am working with is in a developing country with a very basic internet access infrastructure. Internet access is very patchy and the average download speed is less than 2 Mbps.

Patrick Mevzek
  • 3,130
  • 2
  • 20
  • 30
user65787
  • 185
  • 1
  • 1
  • 4
  • 1
    The `apt-cdrom` output says it is looking at `/media/cdrom`, change the command to `sudo apt-cdrom -m -d=/media/usb0 add` – fooot Apr 23 '14 at 16:27
  • 2
    When you change `/etc/apt/sources.list`, there is no need to reboot, but you must run `sudo apt-get update`. I'm not familiar with `apt-cdrom`, but I would assume that requires the same update afterwards. Also, if your internet connection is unreliable / slow, you might want to remove / comment out any online sources from `/etc/apt/sources.list` once you can install from local media, just so you don't have to wait for the update to contact the servers listed. – ssc Apr 24 '14 at 06:12

4 Answers4

2

I found that this problem was very similar to my own. Debian installed from USB stick but then when I try to use apt-get install I am prompted for a CdROM.
After much fuss I found part 14.3.1 of the Debian tutorial valuable because it explains the syntax for instructing the system to look for source content in a file location. Here's what i did:

I ensured the usb stick was mounted and I took note of its location in the filesystem. For me that was /media/Debian 7.5 64 Copyleft FM

As su I edited sources.list so that the line with "deb cdrom" was commented-out. Then I added a new first line of that file using the tutorial info and my usb stick file location:

deb file:/media/"Debian 7.5 64 Copyleft FM" wheezy contrib local main non-free
#deb cdrom:[Debian GNU/Linux 7.5 _Wheezy_ - Copyleft amd64 Full Monty amd64 DLBD Binary-1 20140427-09:14]/ wheezy contrib local main non-free

For newbies such as me, note the use of quotes in the URI to protect the enclosed spaces from being misunderstood. (See Nixcraft forum: Howto cd to folder name with spaces blank names (white space)

Then I ran sudo apt-get update as advised above (thx). That's all I did.

This solved my problem - I was able to run sudo apt-get install vim and I was no longer asked to insert a CD.

owenmck
  • 121
  • 5
  • How did you mount your USB stick? – user65787 Jan 09 '15 at 01:52
  • 1
    @user65787 /media/something is probably an auto-mount, presumably owenmck was logged into a GUI session at the time. – Jasen Jun 09 '19 at 07:21
  • a note to anyone like me who does have internet connection, you can simply comment out that line `deb cdrom...` in `/etc/apt/sources.list` and then it should be able to get the packages you need online – Matthias Aug 13 '22 at 19:23
-1

mount your drive on /media/cdrom, then

apt-cdrom add -m --cdrom /media/cdrom
apt-get update
apt-get install your_desired_package
Kusalananda
  • 320,670
  • 36
  • 633
  • 936
omar
  • 1
-2

so in line with the previous answer, I just told my system to not even bother to use the cdrom as a source for updates at all.

I first had to change the file permissions of sources.list so I could change it

change to directory it was in

    cd /etc/apt

then change permissions

    chmod 666 sources.list

(read/write for owner, root, and user)

then I could open the file in text editor, and with new basic user read and write permissions, and stuck # in front of the line looking at the cdrom as a source.

    #deb file:/media/"Debian 7.5 64 Copyleft FM" wheezy contrib local main non-free

then changed permissions back to only owner and root could write as well as read, but user could not

    chmod 664 sources.list

apt-get now installs programs.

someone might tell me later there is a problem with this, but hey. it worked :)

bob
  • 9
  • 1
  • 3
    The appropriate way to edit a file that you don't have write access to is to run the ***editor*** (i.e., `vi`, `vim`, `emacs`, `pico`, `ed`, `teco`, or whatever you use) under `sudo`, and not to `chmod` the file so it's world-writable and then `chmod` it back afterwards.  So, beyond that, I'm not clear what your answer is.  Are you saying that your `/etc/apt/sources.list` file *already had* a `deb file:/media/...` line in it?  And that, after commenting it out, `apt-get` now installs programs ***from the flash drive***?  Are you sure it's not downloading from the Internet? – G-Man Says 'Reinstate Monica' Jun 20 '15 at 13:59
-2

Thank You so much, this was my fastest fix: Open Terminal and :`$su Password: mypassword name# pluma menu File/Open: (browse to Filesystem root) etc/apt/sources.list Add a # in front of the line looking at the cdrom as a source. Menu: File/Save Close

Open System/Administration/Synaptic Package Manager

I wanted VLC so scrolled down to Video and selected the first vlc,,, the rest is history :-) Again Thank You

DenisT
  • 1
  • 1
  • Hello. Your answer looks similar to [owenmck's answer](https://unix.stackexchange.com/a/171385/423679), but it appears that your approach allowed you to do not specify manually the path to your CD. Is it correct? Could you [edit] your answer to show the resulting `sources.list`, please? Did Synaptic configure it for you? – Roman Riabenko Dec 03 '20 at 21:25