Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
08-15-2017, 12:02 PM
|
#16
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,206
|
If you're sticjking with the sdcard, 'noatime' would be better than 'relatime.' Atime writes every 5 seconds; relatime writes every 15 seconds; noatime is best.
|
|
|
08-16-2017, 02:26 AM
|
#17
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
i think you should delete your custom udev rules and stick with the shell script, and the advice given in post #2.
or, you should reformulate your problem from scratch.
here's a simple rule:
you never say "it doesn't work" without providing full disclosure about commands issued, output received (errors or not), general system information etc.
|
|
|
08-20-2017, 04:39 AM
|
#18
|
LQ Newbie
Registered: Aug 2017
Posts: 15
Original Poster
Rep:
|
Hello,
ok, I removed all and try this:
Code:
cat /etc/udev/rules.d/69-sdcard.rules
KERNEL=="mmcblk0", SYMLINK+="sdcard"
ACTION=="add", RUN+="/home/domo/sdcard_insertion.sh"
ACTION=="remove", RUN+="/home/domo/sdcard_removed.sh"
Code:
cat sdcard_insertion.sh
#! /bin/sh
/bin/mkdir /home/domo/sdcard_present
/bin/mount /dev/mmcblk0p1 /media/card/
Code:
cat sdcard_removed.sh
#! /bin/sh
/bin/rm -R /home/domo/sdcard_present
When I now put the sd_card in the beaglebone, the folder are created, when I remove the sdcard, it will be delete.
Now I want to mount over with the sh.script the sdcard. When I put the sdcard in the beaglebone, I get in the syslog:
Code:
Aug 20 10:35:23 foxc0a800bd kernel: [320476.390036] mmc0: host does not support reading read-only switch, assuming write-enable
Aug 20 10:35:23 c0a800bd kernel: [320476.395067] mmc0: new high speed SDHC card at address 0007
Aug 20 10:35:23 c0a800bd kernel: [320476.411492] mmcblk0: mmc0:0007 SD16G 14.4 GiB
Aug 20 10:35:23 c0a800bd kernel: [320476.419344] mmcblk0: p1
but the folder in /media/card is empty
When I run after in den commandline:
/bin/mount /dev/mmcblk0p1 /media/card/
then it works.
But why not in the bash script?
|
|
|
08-20-2017, 04:58 AM
|
#19
|
LQ Newbie
Registered: Aug 2017
Posts: 15
Original Poster
Rep:
|
Hello,
I see now in the syslog:
Aug 20 10:53:49 c0a800bd systemd-udevd[20525]: Process '/home/domo/sdcard_insertion.sh' failed with exit code 32.
Aug 20 10:53:53 c0a800bd systemd-udevd[20525]: Process '/home/domo/sdcard_insertion.sh' failed with exit code 32.
Aug 20 10:53:56 c0a800bd systemd-udevd[20525]: Process '/home/domo/sdcard_insertion.sh' failed with exit code 32.
Error 32 means:
mount failure
Same when I remove the sdcard:
Aug 20 10:56:45 c0a800bd kernel: [321758.605831] mmc0: card 0007 removed
Aug 20 10:56:45 c0a800bd kernel: [321758.716607] FAT-fs (mmcblk0p1): FAT read failed (blocknr 802)
Aug 20 10:56:45 c0a800bd kernel: [321758.730084] FAT-fs (mmcblk0p1): unable to read boot sector to mark fs as dirty
Aug 20 10:56:45 c0a800bd systemd-udevd[20666]: Process '/bin/sh /home/domo/sdcard_removed.sh' failed with exit code 32.
Aug 20 10:56:45 c0a800bd systemd-udevd[20671]: Process '/bin/sh /home/domo/sdcard_removed.sh' failed with exit code 32.
Aug 20 10:56:45 c0a800bd systemd-udevd[20666]: Process '/bin/sh /home/domo/sdcard_removed.sh' failed with exit code 32.
But why 3-times?
Here the new scripts:
cat sdcard_insertion.sh
#! /bin/sh
/bin/mkdir /home/domo/sdcard_present
sleep 3s
fsck.vfat -v -a -w /dev/mmcblk0p1
/bin/mount /dev/mmcblk0p1 /media/card/
cat sdcard_removed.sh
#! /bin/sh
/bin/rm -R /home/domo/sdcard_present
/bin/umount /media/card/
|
|
|
08-20-2017, 11:17 AM
|
#20
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,206
|
Code:
Aug 20 10:56:45 c0a800bd kernel: [321758.605831] mmc0: card 0007 removed
Aug 20 10:56:45 c0a800bd kernel: [321758.716607] FAT-fs (mmcblk0p1): FAT read failed (blocknr 802)
In the first line, why is it /dev/mmc0? Is your sdcard mounting sometimes as /dev/mmc0? It certainly would explain the FAT read fail.
Code:
grep mmc0 /var/log/messages
might clear this up.
Checking with 'grep -r', I have no mention of mmc0 in /lib/udev/ or /etc/udev, or of course in /dev, although I have /dev/mmcblk0, & /dev/mmcblk0p1.
|
|
|
08-21-2017, 12:59 AM
|
#21
|
LQ Newbie
Registered: Aug 2017
Posts: 15
Original Poster
Rep:
|
Hello,
I don´t know why there is mmc0.
Here are some informations:
cat /etc/udev/rules.d/69-sdcard.rules
Code:
KERNEL=="mmcblk0p1", SYMLINK+="sdcard", GOTO="sd_cards_auto_mount_end"
ACTION=="add", RUN+="/bin/sh /home/domo/sdcard_insertion.sh"
ACTION=="remove", RUN+="/bin/sh /home/domo/sdcard_removed.sh"
LABEL="sd_cards_auto_mount_end"
grep mmc0 /var/log/messages
Code:
Aug 21 06:48:48 foxc0a800bd kernel: [ 332.849825] mmc0: host does not support reading read-only switch, assuming write-enable
Aug 21 06:48:48 foxc0a800bd kernel: [ 332.855045] mmc0: new high speed SDHC card at address 0007
Aug 21 06:48:48 foxc0a800bd kernel: [ 332.871791] mmcblk0: mmc0:0007 SD16G 14.4 GiB
dmesg
Code:
[ 332.849825] mmc0: host does not support reading read-only switch, assuming write-enable
[ 332.855045] mmc0: new high speed SDHC card at address 0007
[ 332.871791] mmcblk0: mmc0:0007 SD16G 14.4 GiB
[ 332.879312] mmcblk0: p1
tail -f /var/log/syslog
Code:
Aug 21 06:48:48 c0a800bd kernel: [ 332.849825] mmc0: host does not support reading read-only switch, assuming write-enable
Aug 21 06:48:48 c0a800bd rsyslogd-2007: action 'action 17' suspended, next retry is Mon Aug 21 06:49:18 2017 [try http://www.rsyslog.com/e/2007 ]
Aug 21 06:48:48 c0a800bd kernel: [ 332.855045] mmc0: new high speed SDHC card at address 0007
Aug 21 06:48:48 c0a800bd kernel: [ 332.871791] mmcblk0: mmc0:0007 SD16G 14.4 GiB
Aug 21 06:48:48 c0a800bd kernel: [ 332.879312] mmcblk0: p1
Aug 21 06:48:52 c0a800bd systemd-udevd[5459]: Process '/bin/sh /home/domo/sdcard_insertion.sh' failed with exit code 32.
Aug 21 06:48:55 c0a800bd systemd-udevd[5459]: Process '/bin/sh /home/domo/sdcard_insertion.sh' failed with exit code 32.
cat sdcard_insertion.sh
Code:
#! /bin/sh
/bin/mkdir /home/domo/sdcard_present
sleep 3s
fsck.vfat -v -a -w /dev/mmcblk0p1
/bin/mount /dev/mmcblk0p1 /media/card/
|
|
|
08-21-2017, 04:41 AM
|
#22
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,206
|
Can we try a workaround? With the offending card out,
Code:
cd /dev
sudo ln - sf mmcblk0p1 mmc0
If that works, it's a gift, but I don't really expect it to. I did a basic grep in the kernel source, and mmc0 appears to be handed out by the kernel, and not udev, and seems to be part of various sdcard controllers and GPIO (General Purpose Input Output) stuff, as sdcards are not read by a bus. GPIO stuff is old, slow & clunky, implemented these days in a small corner of some asic. HP used to have a GPIO bus on their instruments to automate them (in the days before widespread automation), but nobody in their right mind outside of a factory environment ever used it :-/. I'm actually surprised to find it still alive.
|
|
|
08-21-2017, 12:45 PM
|
#23
|
LQ Newbie
Registered: Aug 2017
Posts: 15
Original Poster
Rep:
|
Hello,
I get:
Code:
ln: target ‘mmc0’ is not a directory
|
|
|
08-21-2017, 12:54 PM
|
#24
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,206
|
Right. I hoped rather than expected that to work. Can you post the output of
both with the sdcard in and out.
|
|
|
08-21-2017, 01:00 PM
|
#25
|
LQ Newbie
Registered: Aug 2017
Posts: 15
Original Poster
Rep:
|
with sdcard:
Code:
brw-rw---- 1 root disk 179, 24 Aug 21 18:58 /dev/mmcblk0
brw-rw---- 1 root disk 179, 25 Aug 21 18:58 /dev/mmcblk0p1
brw-rw---- 1 root disk 179, 0 Aug 21 13:36 /dev/mmcblk1
brw-rw---- 1 root disk 179, 8 Aug 21 13:36 /dev/mmcblk1boot0
brw-rw---- 1 root disk 179, 16 Aug 21 13:37 /dev/mmcblk1boot1
brw-rw---- 1 root disk 179, 1 Aug 21 13:37 /dev/mmcblk1p1
without sdcard:
Code:
brw-rw---- 1 root disk 179, 0 Aug 21 13:36 /dev/mmcblk1
brw-rw---- 1 root disk 179, 8 Aug 21 13:36 /dev/mmcblk1boot0
brw-rw---- 1 root disk 179, 16 Aug 21 13:37 /dev/mmcblk1boot1
brw-rw---- 1 root disk 179, 1 Aug 21 13:37 /dev/mmcblk1p1
Thanks for your help
|
|
|
08-21-2017, 02:45 PM
|
#26
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,206
|
No mmc0? But it was there previously, and screwed things up.
I THINK what's going on is that mmc0 is some bit of the sdcard apparatus, which is mistaken by the kernel for the actual sdcard. Then the card is seen on mmc0, not mmcblk0. If that's right, you might solve it with one of the following bodges:
1. Put mmc0 in /etc/fstab with a 'noauto' option, (before mmcblk0p1) so it will not be mounted.
2. Copy the fstab line for mmcblk0p1, except make mmc0 the device node. This line should go after mmcblk0p1. Both should not exist at the same time. Scripts will have to be changed to use the mount directory instead of the device node.
For your script in post #1, you would have something like
Code:
if [ -b /dev/mmcblk0p1];
<syntax & stuff>
elif [ -b /dev/mmc0];
<syntax & stuff>
Otherwise, I'd look into whether you could cobble a kernel without mmc0. Distro kernels are inclined to have everything but the kitchen sink in them, but you mightn't need the offending stuff. What is /dev/mmcblk1 in your box?
|
|
|
08-21-2017, 04:09 PM
|
#27
|
LQ Newbie
Registered: Aug 2017
Posts: 2
Rep:
|
forum site's accounts .research involves looking at not just one source/website but lots of sources and websites/videos to gather as much information as you can then come to a conclusion ahhaha [racism+personal attack].come at me i dare you-[WWII era racism, also seen earlier]
|
|
|
08-21-2017, 04:09 PM
|
#28
|
LQ Newbie
Registered: Aug 2017
Posts: 2
Rep:
|
Note: Post very much edited by mod to remove harshest words and directed attacks against a member. It should seem clear that the OP here chose to go on the extreme offensive with the slightest provocation and this type of behavior is not acceptable within LQ ever.
|
|
|
08-22-2017, 01:06 AM
|
#29
|
LQ Newbie
Registered: Aug 2017
Posts: 15
Original Poster
Rep:
|
Good morning,
ok, I can try ... but when I start the script at the commandline and not via udev, it works fine.
And this is my fstab:
Code:
cat /etc/fstab
# /etc/fstab: static file system information.
#
UUID=a26ac92c-c772-40fc-aa2e-0ccc87a4bb30 / ext4 noatime,errors=remount-ro 0 1
debugfs /sys/kernel/debug debugfs defaults 0 0
Quote:
Originally Posted by business_kid
No mmc0? But it was there previously, and screwed things up.
I THINK what's going on is that mmc0 is some bit of the sdcard apparatus, which is mistaken by the kernel for the actual sdcard. Then the card is seen on mmc0, not mmcblk0. If that's right, you might solve it with one of the following bodges:
1. Put mmc0 in /etc/fstab with a 'noauto' option, (before mmcblk0p1) so it will not be mounted.
2. Copy the fstab line for mmcblk0p1, except make mmc0 the device node. This line should go after mmcblk0p1. Both should not exist at the same time. Scripts will have to be changed to use the mount directory instead of the device node.
For your script in post #1, you would have something like
Code:
if [ -b /dev/mmcblk0p1];
<syntax & stuff>
elif [ -b /dev/mmc0];
<syntax & stuff>
Otherwise, I'd look into whether you could cobble a kernel without mmc0. Distro kernels are inclined to have everything but the kitchen sink in them, but you mightn't need the offending stuff. What is /dev/mmcblk1 in your box?
|
Last edited by fohnbit; 08-22-2017 at 01:08 AM.
|
|
|
08-22-2017, 02:58 AM
|
#30
|
LQ Newbie
Registered: Aug 2017
Posts: 15
Original Poster
Rep:
|
Hello,
crazy ... now it works without any script or udev rule.
I added this to the fstab:
Code:
/dev/mmcblk0p1 /media/card auto auto,rw,async,user,nofail 0 0
Now anytime I put it the sd card in the beaglebone, it mount and unmount when I remove.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 06:52 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|