LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   missing /dev/sda* device files (https://www.linuxquestions.org/questions/ubuntu-63/missing-dev-sda%2A-device-files-482267/)

monkeyman2000 09-10-2006 09:24 PM

missing /dev/sda* device files
 
Hi,

I have a usb flash card reader attached to my computer. When I used Breezy, if I inserted a flash card into it, it was automounted, and kubuntu created an icon for it on my desktop.

Now I have upgraded my computer to Dapper, and my card reader no longer automounts. It seems to be the case that no /dev device file exists for the device.

If I insert a card into the reader and reboot my machine, a device is created, and the disk is mounted. If I remove the card and reboot, however, the device file no longer exists when ubuntu comes back on, and if I insert a card one is not created.

How can I tell Dapper ubuntu to make this work, so that when I insert a card into the reader, it gets automounted, like it used to work before?

------------------------------------
When booted with card inserted:
Code:

$ ls -l /dev/sda*
brw-rw---- 1 root plugdev 8, 0 2006-09-10 07:48 /dev/sda
brw-rw---- 1 root plugdev 8, 1 2006-09-10 11:48 /dev/sda1
$

From my /etc/fstab:
Code:

/dev/sda1 /media/cardreader0 vfat auto,user 0 0

cs-cam 09-10-2006 09:41 PM

Boot without a card in there, insert one, wait a sec and run 'dmesg' and see if anything useful is printed. If you aren't sure post the last 20 lines or so but if linux is recognising the device at all, this is where you'll hear about it :)

rkelsen 09-10-2006 10:47 PM

Is HAL enabled?

monkeyman2000 09-10-2006 10:54 PM

Quote:

Originally Posted by cs-cam
Boot without a card in there, insert one, wait a sec and run 'dmesg' and see if anything useful is printed. If you aren't sure post the last 20 lines or so but if linux is recognising the device at all, this is where you'll hear about it :)

Nothing gets added to dmesg output when I insert a card after booting without one inserted.

When I boot with the card inserted, the dmesg output is slightly different; the relevant portion seems to be:
Code:

> SCSI device sda: 3910656 512-byte hdwr sectors (2002 MB)
> sda: Write Protect is off
> sda: Mode Sense: 03 00 00 00
> sda: assuming drive cache: write through
> SCSI device sda: 3910656 512-byte hdwr sectors (2002 MB)
> sda: Write Protect is off
> sda: Mode Sense: 03 00 00 00
> sda: assuming drive cache: write through
>  sda: sda1

Bottom line, the system only creates the device file(s) when it boots with the card inserted. It seems it should either create the device files when a card is inserted, or already have the device file, and use it to automount the card, like it used to do before I upgraded to Dapper.

Any idea why this is happening and how to fix it?

cs-cam 09-10-2006 11:25 PM

If nothing is appearing in dmesg then the kernel isn't even recognising it which is the problem, no userspace daemons like HAL or udev are going to make a difference.

Maybe the module isn't autoloading for the device unless there's a card in it, if you feel like rebooting a couple of times again then use lsmod to grab a list and loaded modules and compare them using diff.
Code:

# boot with card
lsmod | sort > ~/module-list1.txt
# reboot without
lsmod | sort > ~/module-list2.txt

diff ~/module-list1.txt ~/module-list2.txt


monkeyman2000 09-11-2006 02:48 PM

lsmod output
 
OK, I rebooted twice & ran lsmod both with the card inserted (/dev/sda1 created & card mounted) and without (no /dev/sda is created).

It looks like the same modules are loaded... the only differences seem to be in the number in the 'Used By' column of the lsmod output for some modules...I assume that's not significant.

The output is as follows:

Code:

$ diff module.list.withoutcard.txt module.list.withcard.txt
45c45
< ipv6                  265728  17
---
> ipv6                  265728  25
56,57c56,57
< nls_cp437              5888  1
< nls_iso8859_1          4224  1
---
> nls_cp437              5888  2
> nls_iso8859_1          4224  2
75c75
< sd_mod                19984  0
---
> sd_mod                19984  2
79c79
< snd                    55268  18 snd_emux_synth,snd_seq_virmidi,snd_seq_oss,snd_seq,snd_emu10k1,snd_rawmidi,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_device,snd_timer,snd_hwdep
---
> snd                    55268  17 snd_emux_synth,snd_seq_virmidi,snd_seq_oss,snd_seq,snd_emu10k1,snd_rawmidi,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_device,snd_timer,snd_hwdep
82c82
< snd_emu10k1          117284  4 snd_emu10k1_synth
---
> snd_emu10k1          117284  3 snd_emu10k1_synth
88c88
< snd_pcm                89864  4 snd_emu10k1,snd_ac97_codec,snd_pcm_oss
---
> snd_pcm                89864  3 snd_emu10k1,snd_ac97_codec,snd_pcm_oss
113,114c113,114
< usb_storage            74176  0
< vfat                  13440  1
---
> usb_storage            74176  2
> vfat                  13440  2
$


monkeyman2000 09-11-2006 04:23 PM

also note -- can manually create device
 
Note that if I boot without the card inserted (no /dev/sda1 device file is created), I can then insert the card, and manually create the device file and mount the card:

Code:

$ cd /dev
$ sudo mknod sda1 b 8 1
$ mount /media/cardreader0/

When I reboot again without the card, though, the /dev/sda1 file is gone again.

binary_y2k2 09-11-2006 05:23 PM

That should be done by udev and hal, do you have them both installed?

cs-cam 09-11-2006 05:42 PM

Quote:

I can then insert the card, and manually create the device file and mount the card
Ohh that's different then, I assumed it wasn't being recognised but I've never played with card readers, everything I've ever plugged in has turned up in dmesg.

You are indeed looking at a Udev problem, I found a few links but I'm not sure if any of them apply to you.

http://indiboi.com/history/2005/09/16/2887535
https://www.fsfe.org/en/card/howto/c...der_howto_udev # i think this is for encrypted cards or something?

monkeyman2000 09-11-2006 07:00 PM

udev or hal? Any more info?
 
Thanks for the links, cs-cam... however, they don't really help that much. udev looks really complex and involved... and according to it's FAQ, it doesn't sound like its the right thing to look at (though I could be wrong depending on how ubuntu is set up):

Frequently Asked Questions about udev
Q: Can I use udev to automount a USB device when I connect it?
A: Technically, yes, but udev is not intended for this. All major distributions
use HAL (http://freedesktop.org/wiki/Software_2fhal) for this, which also
watches devices with removable media and integrates into the desktop software.

However, I don't really understand either udev or HAL, and both seem very complex and not so clearly documented, at least for non-programer users.

Can you (or anyone) give me some further advice on how to proceed? It seems like something that should 'just work,' particularly since it used to before I upgraded from Breezy to Dapper.

cs-cam 09-11-2006 07:10 PM

Quote:

Frequently Asked Questions about udev
Q: Can I use udev to automount a USB device when I connect it?
A: Technically, yes, but udev is not intended for this. All major distributions
use HAL (http://freedesktop.org/wiki/Software_2fhal) for this, which also
watches devices with removable media and integrates into the desktop software.
Automount isn't what you're having a problem with (at this stage). Just a FYI, if sda1 was being created then chances are HAL would automatically mount it, it's udev not creating sda1 that is the problem. Just make sure udev is running:
Code:

pidof udevd

monkeyman2000 09-11-2006 07:32 PM

Code:

$ pidof udevd
2309
$

So udevd is running. Possibly it lacks a proper 'rule' or configuration to create the /dev/sda1 (or 2,3, whatever) when a card is inserted. If so, I could use some help figuring out what it is.

I couldn't say if HAL is running, how would I determine that?

Note that when I insert the card into the reader, there is no usb event reported in dmesg output... I don't know if that's significant.


All times are GMT -5. The time now is 11:47 PM.