![]() |
#1 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 457
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
Can someone please explain bind mounts to me?
I've been reading all over the web and still can't seem to get the info I want.
I want to make temporary changes to system files while a program is running. For example, if I wanted to make a change to /usr/share/alsa/alsa.conf which is in the read-only system files, I want to "bind mount" and make a change to that file (with sed or whatever), then unmount it when I want. How do I do that? I try: touch alsa.conf mount --bind /usr/share/alsa/alsa.conf alsa.conf sed -ie s/cards.pcm.front/cards.pcm.default/g alsa.conf error - cant move alsa.conf3ETwkI to alsa.conf -> obviously sed made a temp file and tried to move it to a read-only file. Is this even possible? I'm thinking it's just the syntax I'm doing wrong? edit: yep it's just the syntax. I made an edited rw file and can bind that to the ro system file. ie: mount --bind bind/alsa.conf /usr/share/alsa/alsa.conf that seems to work fine. I'll add it to my pianobar script... Thanks anyway! ![]() Last edited by brianinmaine; 10-31-2014 at 03:47 AM. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
You're looking at it from the wrong direction. A bind mount will map something *onto* another thing (file or directory). Your problem, abstracted, is this:
- you do not want to change the root file system (very good idea) - you want to have different file content in place of an existing file So you should - create a copy of the file in question (to the user store) and modify it so it has the content you want - then bind-mount that file onto the file in the root file system (well, to be exact, to that excerpt of the virtual file system name space that is otherwise backed by the root file system) PS: Ah, I only now see the your Edit (due to me not reading properly through the whole post). I leave my answer above, maybe it clears things up for others. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 457
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
So I was wrong again. How can I do this:
mount --bind pianobar/bind/lib/ao /usr/lib/ao where /usr/lib/ao contains libraries but the directory doesn't exist on the Kindle. In other words, can I bind mount to a place that doesn't exist yet somehow? I'm trying hard to not modify the system but just use bind mounts or something instead. Apparently the pianobar package doesn't work and I can't figure out how to fix without "mntroot rw" and adding the files/directories? I don't need someone to fix my package, just help me understand if this way of binding is possible. or is there a different way? I wish I could merge 2 directories? |
![]() |
![]() |
![]() |
#4 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Add the directory mount points to the Amazon image.
That is the least invasive that you can get in this situation. **OR** Use the PC utility attached to my "Hard Float on Kindle" thread, the patchelf utility. Change the ELF headers in your application to make the dynamic loader stop searching /usr/lib/ao and to search /mnt/us/usr/lib/ao instead. If you need a copy of patchelf built for something other than the host system I built my attachment for ... Recent (2014.08 and 2014.11) versions of Buildroot will build patchelf for the host system you are using (it is now in the "Host Utilities" menu section). |
![]() |
![]() |
![]() |
#5 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 457
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
ah, OK thanks a lot! At least it gives me a direction to go!
![]() |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
That is how I (propose) to run ARM Hard Float system libraries on an ARM Soft Float system. ![]() Yup, Linux (an elf based system) can run multiple sets of system libraries at the same time. The initial example contains hardfloat libraries and a couple of working applications (busybox and nano if I recall correctly). And they are loading the HF libraries from "user storage". Now if we can convince the 5.6.1 firmware's dynamic loader to do the same .... ![]() |
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
then there's also LD_LIBRARY_PATH, an environment variable that, when set, can add to the search path of the linker. But somehow I'm puzzled that this is about a *subdirectory* of /usr/lib. The linker typically doesn't search there, so you might be facing the problem that some software does an dl("/usr/lib/ao/...") - and you can't fix that by patching the ELF files, since in that case, the library path is a string, not metadata of the ELF file. (Though technically, it might be in the strings section of the ELF, but now it's getting complicated...)
|
![]() |
![]() |
![]() |
#8 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
The linker doesn't -
But the loader will, I have dozens of /usr/lib/* directories on my Linux distribution install. The loader's places to search are listed in /etc/ld.so.conf (or /etc/ld.so.conf.d depending) and the paths to be searched are in the binary /etc/ld.so.cache (which is built by the ldconfig command). But /etc/ld.so.conf(.d) is in the Amazon image, likely to be replaced by any update. (*) The fact that the linker and the dynamic loader are both referred to as: 'ld' can confuse mere humans. |
![]() |
![]() |
![]() |
#9 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 457
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
After a bit of research, I found some ENV variables and stuff to try to keep system alters to a minimum. I only create one directory and populate it with a symlink to my libalsa.so file.
I'm also trying to understand how all the sound works on the Kindle. Playing a file with tts only seems to load libasound.so but no libalsa or anything like that? It seems some players like mplayer and the TTS play directly to the hw device /dev/snd/pcmC0D0p? I guess pianobar does have libalsa as a dependency, but the file where I can list drivers for playback list null, au, wav, or alsa. I tried all the others and get 'cannot open audio device' but if I load alsa and link in libalsa.so I get it working fine. Audio under linux sure is complicated. I've now read dozens of pages with how this stuff seems to work - I still don't understand. As an aside, should I have a link under KUAL to remove all traces of my alteration? Or just leave it in a README file? I'll make changes to my package. Thanks for all the info! EDIT: I included a version of patchelf for my Kindle. It needs to go in /mnt/us/extensions and run the script called patchelf because it needs to load a library not on my Kindle... I could patch it with patchelf... ![]() Last edited by brianinmaine; 11-28-2014 at 01:05 AM. |
![]() |
![]() |
![]() |
#10 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
LD_DEBUG=libs <program name here> Will make the dynamic loader output a listing of everything it looks for and where it is looking. |
|
![]() |
![]() |
![]() |
#11 | |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 457
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
Quote:
/mnt/us/extensions/pianobar/ # LD_LIBRARY_PATH=./lib:/usr/lib:/lib LD_DEBUG=libs bin/pianobar I get lots of output, but none of it is the alsa stuff. Pianobar loads properly, I type in my email and password, select station and it starts to play - this is with the symlink to libalsa.so in /usr/lib/ao/plugins-4/libalsa.so pointing to the local copy. The output is all the libs loaded EXCEPT the libalsa.so library. I can make it show more debug output by changing the word "quiet" to "debug" in my local file .libao (system file name is libao.conf). It then shows the loading path of libalsa.so by looking only in the plugins-4 folder. Maybe I can patch libao.so to load libalsa.so from a different place? I'll have to read up more on that... EDIT: Found the reference to /usr/lib/ao/plugins-4 in the configure file for the libao source package. So now I'll have to try to build that with an altered path. This is going to take a bit ![]() Last edited by brianinmaine; 11-28-2014 at 04:17 AM. |
|
![]() |
![]() |
![]() |
#12 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
The build linkage command should mention libdl (-dl) and this is at least one of the places its being used. Hawhill had mentioned something about this earlier in this thread. - - - - - I read on, further than I quoted, and see you figured that one out and how to change the configuration of where it looks at runtime for its dlopen'd resources. - - - - - Just the same, this sort of failure forensics is one of those 'developer tricks' that sometimes has to be used. |
|
![]() |
![]() |
![]() |
#13 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 457
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
Working to build it now - thanks for all the help!
EDIT: all done - that was the issue. All I had to do was modify the pluginpath directory in the configure file and rebuild. I fixed the program and uploaded the new one. WOW it feels good to get that done well! I don't even need bind mounts at all now, as that's the title of this thread ![]() Thanks again all for the help! Last edited by brianinmaine; 11-28-2014 at 05:12 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Since Calibre v 0.9.14 PW mounts read-only! | EightWeight | Devices | 4 | 01-18-2013 07:35 AM |
Bind calibre-server to specific IP/interface | Strupniveral | Related Tools | 3 | 03-21-2012 01:32 PM |
umounting a mount --bind | PoP | Kindle Developer's Corner | 4 | 04-15-2011 03:13 PM |
Seriously thoughtful I'm in a bind | Spoon Man | Lounge | 31 | 04-15-2010 10:45 PM |
Accessories Idea for a battery-powered Kindle light that mounts in the USB port | artsci | Amazon Kindle | 8 | 03-09-2009 01:37 PM |