LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Debian: how to see files in a camera being an "USB mass storage"? (https://www.linuxquestions.org/questions/linux-newbie-8/debian-how-to-see-files-in-a-camera-being-an-usb-mass-storage-4175618692/)

dedec0 11-30-2017 10:31 AM

Debian: how to see files in a camera being an "USB mass storage"?
 
We have a camera Sony Cybershot. In Ubuntu 10.04, we simply conect its USB cable to the computer and the system automatically mounts two "media disks" for it. There we may copy or delete the pictures stored inside it (card and internal memory).

I tried to plug this camera in a Debian 9 machine, but nothing apparently happens! The camera screen shows its expected "USB mode | Mass Storage", but I cannot see it as a mounted media or a device which I may mount with my user by clicking on it in the file manager (similar to what happens with pendrives).

What should we do to access those camera files?

hazel 11-30-2017 10:51 AM

I would start by seeing if the kernel has recognised the new drives. The command dmesg|tail should do it. dmesg prints out the contents of the kernel's message ring and |tail passes it through a filter that just selects and prints the last ten lines.

For example, I have a printer with a built-in disk, and when I switch the printer on, dmesg shows the lines:
Code:

[18976.226295] scsi 5:0:0:0: Direct-Access    HP      Photosmart C4700 1.00 PQ: 0 ANSI: 5
[18976.226902] sd 5:0:0:0: Attached scsi generic sg7 type 0
[18976.229860] sd 5:0:0:0: [sdg] Attached SCSI removable disk

So that built-in disk is being recognised as /dev/sdg.

Once you have a device name for it, you should be able to mount it. I don't know why your desktop is not mounting it automatically. Probably it is not the same desktop that you used in Ubuntu.

dedec0 11-30-2017 11:06 AM

Just completing the first post and adding some info after haze first replied
 
Just completing the first post and adding some info after haze first replied:

Before, I tried the mount command, which showed nothing new, which I found strange (since I expected it to be automatically mounted). See:

Code:

$ mount| tail
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1535)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1634320k,mode=700,uid=1000,gid=1000)
/dev/sda6 on /media/user/ubu10 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)

$

That sda6 is a network mount of one Ubuntu 10 disk.

The window manager used in the Debian 9 machine is Mate Desktop, file manager is Caja (which is the same as Nautilus in Ubuntu 10 Gnome 2). So most things are (have been) similar in both. At least similar, very few changes I could notice.

I find the situation strange because it should not need any extra driver to access that generic "USB mass Storage". That we may do when accessing this camera in Windows.

dedec0 11-30-2017 11:16 AM

In Debian, dmesg is not allowed to non root user. Is this normal? In Ubuntu I did it with my user (which can also use sudo, both users may use it).

dmesg has lines showing the camera being disconnected and connected again, as you pointed:

Code:

[2138899.842881] usb 1-7: USB disconnect, device number 13
[2138905.245459] usb 1-7: new high-speed USB device number 14 using xhci_hcd
[2138905.386539] usb 1-7: New USB device found, idVendor=054c, idProduct=046a
[2138905.386545] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[2138905.386548] usb 1-7: Product: DSC-S2100
[2138905.386552] usb 1-7: Manufacturer: Sony
[2138905.386555] usb 1-7: SerialNumber: a12a1234a1a1
[2138905.387449] usb-storage 1-7:1.0: USB Mass Storage device detected
[2138905.388295] scsi host3: usb-storage 1-7:1.0
[2138906.390327] scsi 3:0:0:0: Direct-Access    Sony    DSC              1.00 PQ: 0 ANSI: 0
[2138906.390898] scsi 3:0:0:1: Direct-Access    Sony    DSC              1.00 PQ: 0 ANSI: 0
[2138906.391316] scsi 3:0:0:2: Direct-Access    Sony    DSC              1.00 PQ: 0 ANSI: 0
[2138906.392397] sd 3:0:0:0: Attached scsi generic sg1 type 0
[2138906.392526] sd 3:0:0:0: [sdb] 15646720 512-byte logical blocks: (8.01 GB/7.46 GiB)
[2138906.393115] sd 3:0:0:1: Attached scsi generic sg2 type 0
[2138906.394238] sd 3:0:0:2: Attached scsi generic sg3 type 0
[2138906.403241] sd 3:0:0:0: [sdb] Write Protect is off
[2138906.403252] sd 3:0:0:0: [sdb] Mode Sense: 0f 00 00 00
[2138906.414216] sd 3:0:0:0: [sdb] No Caching mode page found
[2138906.414232] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[2138906.414912] sd 3:0:0:1: [sdc] 12353 512-byte logical blocks: (6.32 MB/6.03 MiB)
[2138906.415166] sd 3:0:0:2: [sdd] 25601 512-byte logical blocks: (13.1 MB/12.5 MiB)
[2138906.426252] sd 3:0:0:1: [sdc] Write Protect is on
[2138906.426257] sd 3:0:0:1: [sdc] Mode Sense: 0f 00 80 00
[2138906.426433] sd 3:0:0:2: [sdd] Write Protect is off
[2138906.426438] sd 3:0:0:2: [sdd] Mode Sense: 0f 00 00 00
[2138906.437188] sd 3:0:0:1: [sdc] No Caching mode page found
[2138906.437195] sd 3:0:0:1: [sdc] Assuming drive cache: write through
[2138906.448236] sd 3:0:0:2: [sdd] No Caching mode page found
[2138906.448249] sd 3:0:0:2: [sdd] Assuming drive cache: write through
[2138906.472257]  sdb: sdb1
[2138906.530250] sd 3:0:0:0: [sdb] Attached SCSI removable disk
[2138906.531460]  sdc: sdc1
[2138906.533991]  sdd: sdd1
[2138906.553057] sd 3:0:0:1: [sdc] Attached SCSI removable disk
[2138906.576286] sd 3:0:0:2: [sdd] Attached SCSI removable disk

Now I will try to mount those devices... be right back! (:

DVOM 11-30-2017 11:23 AM

I recently installed Pardus, which is a debian distro. To get it to mount things normally I had to install "gvfs". "autofs" and "udisks2".

hazel 11-30-2017 11:30 AM

I suspect the last two disk partitions (sdc1 and sdd1) are your camera disks. You may indeed need to install extra software to get them automounted, but you shouldn't have any problems adding them to /etc/fstab so that you can mount them by hand when you need to.

dedec0 11-30-2017 11:34 AM

Quote:

Originally Posted by DVOM (Post 5787087)
I recently installed Pardus, which is a debian distro. To get it to mount things normally I had to install "gvfs". "autofs" and "udisks2".

I will check those, DVOM. Thank you. I manually mounted the camera using sudo mount /dev/sdb1 /media/user/camera, after creating the /media/user/camera dir. Doing that automatically in the future would be my next post, and you guessed it! hehe
(:

Be right back again...

dedec0 11-30-2017 11:56 AM

Quote:

Originally Posted by hazel (Post 5787092)
I suspect the last two disk partitions (sdc1 and sdd1) are your camera disks. You may indeed need to install extra software to get them automounted, but you shouldn't have any problems adding them to /etc/fstab so that you can mount them by hand when you need to.

Yes, the camera files (due a config in it) are in sdb1 directories, which is an 8GiB card. They could be in sdc1 or sdd1 too (not both, but I do not know from memory which one is that).

I was about to look around exactly about that, haze. Thank you very much!

sundialsvcs 11-30-2017 01:02 PM

Also note that "some devices expose the 'I am a disk drive'" protocol, while others do not. If their firmware doesn't support this, it can't be done.

Shadow_7 11-30-2017 01:08 PM

By default debian does not AUTO mount drives. Install autofs and reboot plus other stuff. Or manually mount the storage device. I normally $(cat /proc/partitions) before and after attaching the camera to see what drive designation it got. There also gphoto2 to get pictures from cameras that act as PTP (peer-to-peer) devices. Be sure to umount the device before unplugging it.

hazel 11-30-2017 01:09 PM

Quote:

Originally Posted by sundialsvcs (Post 5787136)
Also note that "some devices expose the 'I am a disk drive'" protocol, while others do not. If their firmware doesn't support this, it can't be done.

I doubt if that's the problem here because these disks did automount in gnome. Also the kernel recognises them.

dedec0 11-30-2017 03:07 PM

Quote:

Originally Posted by Shadow_7 (Post 5787137)
By default debian does not AUTO mount drives. Install autofs and reboot plus other stuff. Or manually mount the storage device. I normally $(cat /proc/partitions) before and after attaching the camera to see what drive designation it got. There also gphoto2 to get pictures from cameras that act as PTP (peer-to-peer) devices. Be sure to umount the device before unplugging it.

I had to stop looking at this problem for a few hours, got back just now.

Umount before unplugging is really important, since there could be pending file operations (removed, renamed, copying files). Mate is good, it even asked me about cleaning camera Trash folder - which I choose never to do, to use the whole SD card physical media as distributedly as possible. This helps maximizing its life.

Now I will be looking into these:

- check if I can use /etc/fstab to enable normal users manually mounting the camera; my doubt is if camera main disk will always be /dev/sdb1, which I think is not true: what if a pendrive is inserted and mounted before inserting camera?

- check autofs and the other options already pointed above

(:

hazel 11-30-2017 04:05 PM

If you want to make sure you have the right disk specified in fstab, use the UUID and not the device name. The command ls -l /dev/disk/by-uuid will show the UUIDs of all your mounted disks.

To make the disk mountable on demand by ordinary users, just add the user,noauto options to the line. For example, I have this line in my Debian fstab:
/dev/sda1 /mnt/crux ext4 user,noauto 0 0

dedec0 11-30-2017 04:44 PM

I installed autofs, but did not reboot the computer. Is it really needed? I checked autofs status, seems normal:

Code:

# /etc/init.d/autofs status
● autofs.service - Automounts filesystems on demand
  Loaded: loaded (/lib/systemd/system/autofs.service; enabled; vendor preset: enabled)
  Active: active (running) since Thu 2017-11-30 19:33:28 -02; 2min 30s ago
 Main PID: 29200 (automount)
  CGroup: /system.slice/autofs.service
          └─29200 /usr/sbin/automount --pid-file /var/run/autofs.pid

Nov 30 19:33:28 debian systemd[1]: Starting Automounts filesystems on demand...
Nov 30 19:33:28 debian systemd[1]: Started Automounts filesystems on demand.

I read autofs(5) and auto.master(5), but I am pretty lost on what I should do now.

The only thing that I am sure now is: camera device will be different (sdb, sdc, sdd, ...) when a pendrive (or possibly other USB devices) is inserted before. So that 'ls -l /dev/disk/by-uuid' will probably be really useful. For example, it showed:

Code:

$ ls -l /dev/disk/by-uuid/
total 0
0 lrwxrwxrwx 1 root root 10 nov 14 16:05 111a1111-aaa1-1111-aaa1-a1aa11111a11 -> ../../sda6
0 lrwxrwxrwx 1 root root 10 nov 14 16:05 1111111a-a1aa-11aa-a111-11a1111a11a1 -> ../../sda4
0 lrwxrwxrwx 1 root root 10 nov 14 16:05 1a1aaa11-a11a-1a1a-a1a1-111aa11111a1 -> ../../sda3
0 lrwxrwxrwx 1 root root 10 nov 14 16:05 1a1aaaaa-1aa1-11aa-a1a1-11a11111a1aa -> ../../sda5
0 lrwxrwxrwx 1 root root 10 nov 14 16:05 a11aaa11-11aa-1111-11aa-aa1111a111aa -> ../../sda1

The only thing that changed since I started playing with pendrive, camera and installing autofs is that now there is one CPU core at 100%:

Code:

PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM    TIME+ COMMAND                       
366 root      20  0  583692 539868  2168 R 100,0  3,3 297:57.39 systemd-udevd

Is there something wrong here? Possibly, I imagine. I removed the pendrive and the camera sometime ago, but that process still at 100%.

Forgot to note: the process uptime shows that is has been running since the computer last booted. But it surely was not fixed at 100% CPU, like it is now.

dedec0 11-30-2017 04:47 PM

Forgot to note: the process uptime shows that is has been running since the computer last booted. But it surely was not fixed at 100% CPU, like it is now.


All times are GMT -5. The time now is 11:43 AM.