Connect with us

USB external DVD/CD Drive in Linux OS.

Discussion in 'Microcontrollers, Programming and IoT' started by ADRT, Jul 11, 2015.

  1. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    One of the machines that I service, an optical sorting machine, uses a linux based OS. This machine was physically configured to have the HMI on one side of the machine and the CPU's on the other. When I need to update software from a cd I have to go around to the opposite side of the machine to insert the CD, then return to the side with the HMI to initiate the update. Not a huge deal, just a pain in the butt.

    I have tried using a USB external DVD/CD drive. The problem I'm having is that to do the update there is an icon on the toolbar that you click on and the process will then begin. Unfortuneately it does not recognize that the cd is in the external drive. I can see that the drive is connected. I'm assuming that the software is looking for the SATA installed drive for the update process specifically.

    Was wondering if there was a way to force it to look at the USB drive instead maybe through CMD or GRUB?

    I can edit text files in the system but have no way, nor do I have the expertise, to edit any bin files.

    Any input would be greatly appreciated.

    Jason
     
  2. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Is this an embedded machine running on an architecture other than the Intel/AMD i386/x64 variants that most home computers are running on?
    It may be easy enough to simply remount the usb drive or make a symlink, but this all depends on the current configuration of the system... and are you trying to update the OS or just the software on it?
     
  3. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    They are not like a home PC. I can get specifics on Monday, but do not know right off the top of my head.

    Updates can be anywhere from full OS update to just a patch for newer generation hardware. Recently it was a new touch screen which needed a patch for the drivers.
     
  4. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    In my digging I found this text file with settings for the toolbar where the icon in question is located.

    "UpdateSystem"usr/local/bin/UpdateSystem

    Or something to that effect.
     
  5. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    I'm assuming "bin" here is where the instruction set is for decompressing the files from the cd, installing, and restarting the CPU as well as ejecting the cd. This is all done automatically once the "Update System" icon is selected.
     
  6. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    Was just reading about symlinks. Think this mite be an option. Gonna try a few different things on Monday and get back to you with more info. Thanks for the help.

    Jason
     
  7. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    I know it's not a run of the mill home pc, my question is more or less to try to home in on how it might be configured.
    There are countless official linux variants available... and that does not account for the unofficial spin-offs that are commonly built and slapped in routers, refrigerators, and security camera DVRs ... :s

    I'll overfill you with info now... and maybe it will help you during your experimentations.

    First and foremost. Most embedded systems do not utilise the harddrive like conventional computers... They will typically have an 'image' which consists of a tar.gz or similar archive that is copied to memory when the system starts. The majority of the operating system is held in memory, and the image or harddrive is only ever utilized to read larger assets that can't be stored in memory. The problem with this setup, is that almost any modification to the file system will be lost on reboot. If you can confirm this is not the case it will make your life a lot easier.
    Next up is the update... and there is no way to know for sure without a bunch more investigation. If the update is simply a script that runs to apply a patch or update software on the machine then you can most likely get away by mounting your USB device to the same path the CD-ROM usually resides, or by simply creating a symlink to it. A symlink can make a folder appear in more than one location which will let your USB drive be mounted as normal, AND also appear mounted as a CD drive.
    If the update reboots the computer or replaces the current OS... then this method is most likely out of the question unless you will be creating or manipulating the system to automatically mount the USB device as you want it... the issue with fresh installs is that you will not be able to control this behaviour at all...

    So.. now for a little explanation on common directories in linux based systems.
    /usr/local/bin/UpdateSystem (don't forget the leading / ... it can make all the difference of where the file actually is!)
    I will not discuss mounting points, and harddrive mounting points... that gets messy.
    Almost any 'bin' directory will hold 'binary' executable files which are responsible for anything from showing a directory listing to allowing ssh access. There will typically be one in the / which takes care of most if not all system programs, and another in /usr as you have found. The programs in /usr/bin and /usr/local/bin are commonly additional programs such as data logging applications, or perhaps the software running on your machine.
    /media /mnt and /dev will be related to USB drives, CD-drives, Video Capture cards, etc.
    /proc is going to contain a bunch of 'virtual' files that define and show the current state of the system such as the number of processors, the current clock and all sorts of fun goodies.
    /var will normally contain files that change a lot such as logs.
    /etc will be configuration files, but there will be another etc file in /usr as well on occasion depending on the setup.

    The vast majority of all things linux can be altered and manipulated with text editors... the exception will be the actual binary files in /bin /usr/bin and /usr/local/bin .. This also means that simply going around and 'reading' a bunch of files will give you tons of info into the system. For example... looking at /proc/version may tell you what the linux system you have is based on as well as a file in /etc usually named a variety of things with the word 'release' in it.

    So. dig around, read things, careful changing certain files and let us know what you find out!
     
    Supercap2F likes this.
  8. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    Awesome information Gryd. Gonna do just that. Not worried about damaging or screwing anything up as I am experimenting on an old CPU I replaced because the processor is going in it. Starts to overheat and continually will reboot, so not worried about screwing it up. Even if I did I would be able to delete partitions and reload the OS.
    I'll do some looking around on Monday and let you know what I've found.

    Jason
     
  9. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    I do know that the company that makes this machine has a programming division that does all there software for them. I think the reason they went with Linux is because of how open source it is. They write the OS themselves using Linux as their platform.
     
  10. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    I can tell you I would be intruiged to find out what they have done with it...
    Linux is such a broad operating system now... They could have used the kernel and built from there, or they could have grabbed something like a debian release and simply made their own branch.

    Regardless, it sounds like your going to have some fun ;)
     
    ADRT likes this.
  11. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    So today wasn't as productive as I wanted it to be. I looked in /proc/version and it was blank. In /etc I found a file about debian release, but all that had was a message saying something about unstable/test text or something of that nature. Did find some things about Linux Kernel Version: 2.6.30. Unfortunately I didn't get much farther than that as the CPU I was using finally died. I have another CPU and have started going through a few other things. Would it be more likely to find what I'm looking for in /usr or is it going to be in the main file system?

    I can see the drive every time I turn it on or plug into the USB ports in /dev/disk/by-id.
     
  12. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Ew... if the /proc/version and /etc/*release* files didn't give you any info... the system you are on is either spun up from scratch or is a horribly butchered custom spin-off of an existing distribution.
    Luckily, the symlink options are going to be the same on almost ANY linux release... that said... the files responsible for mounting drives will vary based on linux release, so helping you with that part may be quite difficult.

    Debian, Slack, and Redhat make up the very very vast majority of linux distrobutions. Anything else is going to be a bit of a niche which may prove to be ... interesting to learn or figure out. This is what I was hoping to learn by looking in those two files.
    You 'may' get luckly finding this from a /usr directory, but it's unlikely. At this point, let's try to magic that USB device into a different mount point to be read properly.

    You'll be using 'ln -s' to to create a symlink from one location to another... It's almost like making shortcuts in windows.
     
  13. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    This is going to be fun all the way around. The spare I was using was a Gen2 CPU( generation2). I am now using a Gen3. The Gen2 gave me the option to enable USB DVD drive emulation in bios. The Gen3 does not. I was able to see the drive under /usr on the Gen2 but not in the Gen3. The machine in question is running a Gen3 right now, but I am slowly updating, as they fail, to a Gen4. Have no idea what that one looks like. It may be in my best interest to contact the manufacturer and see if they can give me any info. Unfortunately my contacts at the manufacturer are not the guys who do the programming. I may have to manually mount the drive as well. Was reading something about /etc/fstab. Does that mean anything to you?
     
  14. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    Also, would executing 'lsusb' be any help?
     
  15. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    Oh and it's a debian release. I've seen that several times during boot and in the file system.
     
  16. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    /etc/fstab is certainly one place you would want to look if you want the usb device to be mounted automatically when you start the machine... but unless the usb device will remain plugged in, I would save this modification for a later time.
    As far as the drive showing up in /usr ... it's odd, it normally shows up in /mount/ or /media/ , but a custom alteration or script to how a USB drive is automounted would change that.
    It most certainly would. At least to give you some additional details regarding your usb drive.
    :) Glad to hear.
    The commands you should look into are:
    ls (Directory Listing)
    cd (Change directory)
    cat (display file contents)
    vi (common text editor... this or nano)
    ln (used for symlink creation)
    mount (used to mount the usb device to a specific location... ie, where the cd-rom would normally be)
    umount (used to unmout the usb device when you are done.)

    This may not be as difficult as we thought if it's debain based depending on how much modifications were made.
     
  17. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    Awesome! Thanks again Gryd. I'll try some more stuff tomorrow and let you know how I make out.

    Jason
     
  18. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Sounds good. Let me know how you progress.
    I'm sure you know many of the commands I listed already, but I'm thinking that should pretty much be a minimum requirement to tinker with it.
    Of course, lsusb will help identify the device, but you already knew that ;)

    Also, depending on your resources, it may be handy to hop in an IRC chat and find someone in a debian or linux channel who could walk you through something on the fly.
     
  19. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    Ok, so lsusb did not work. Says command not found. Tried editing fstab but do not have the rights to it. Says read only. Tried mount -a and says only root can do that. Also tried creating a directory and it said : Permission denied. Also noticed that there is no dev directory in /home/usr only in file system. Is there any other way to tell where the USB drive is attached to?
     
  20. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    Also what is BASH?
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-