Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-22-2017, 11:46 AM   #1
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Collection of runme scripts

The current jailbreak process that installs the ";log mrpi" search bar command also installs a ";log runme" search bar command.

Entering the:
;log runme
command runs a (user supplied) script in the topmost visible level of USB storage that is named:
RUNME.sh
(Duh..., currently must be the mixed case shown)

It was meant to be a handy way to fix things that go wrong.
Except there has never been any example usages.

So here is a thread in which to collect runme scripts.
knc1 is offline   Reply With Quote
Old 11-22-2017, 11:52 AM   #2
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Unable to login as root after an Amazon update

Which sort of makes having serial port access useless until you fix it via 'diags'.

Instead, use this script at the top of visible USB storage and call it with:
;log runme

File must be named: RUNME.sh (case is important, at least for now) an MUST use *nix line endings, not Windows line endings.
Code:
#!/bin/sh

# Disable passwd for 'root'
cp /etc/passwd /mnt/us/passwd-frm
sed "s/^root:[^:]*:/root::/" </mnt/us/passwd-frm >/mnt/us/passwd-to

mntroot rw
cp /mnt/us/passwd-to /etc/passwd
mntroot ro
You will notice that I am keeping a "before" and an "after" copy of the password file on USB storage.
Just in case the result of this script needs trouble shooting.
(So how bad can things get? You can't log in now, at the worst you can't log in afterward. )

When faced with the login prompt, for user enter: root
If asked for the password, just enter: enter (return key, a blank line).

Edit:
Worked just fine on my PW3-5.9.2
Before:
Code:
root:x:0:0:root:/tmp/root:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:100:sync:/bin:/bin/sync
operator:x:37:37:Operator:/var:/bin/sh
sshd:x:103:99:Operator:/var:/bin/sh
messagebus:x:92:92:messagebus:/bin/false
nobody:x:99:99:nobody:/tmp:/bin/sh
default:x:1000:1000:Default non-root user:/dev/null:/bin/sh
framework:x:9000:150:Framework User:/tmp/framework:/bin/sh
guestuser:x:1002:1001:Guest user:/tmp/guestuser:/bin/sh
After:
Code:
root::0:0:root:/tmp/root:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:100:sync:/bin:/bin/sync
operator:x:37:37:Operator:/var:/bin/sh
sshd:x:103:99:Operator:/var:/bin/sh
messagebus:x:92:92:messagebus:/bin/false
nobody:x:99:99:nobody:/tmp:/bin/sh
default:x:1000:1000:Default non-root user:/dev/null:/bin/sh
framework:x:9000:150:Framework User:/tmp/framework:/bin/sh
guestuser:x:1002:1001:Guest user:/tmp/guestuser:/bin/sh
Note to self: Bridge passwd and shadow files across Amazon updates or do this fix-up in the bridge code.

Last edited by knc1; 11-22-2017 at 12:50 PM.
knc1 is offline   Reply With Quote
Advert
Old 11-22-2017, 02:03 PM   #3
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Install a fake registration to enable disk export

Some firmware versions do not allow the USB storage area to be accessible over USB unless the Kindle is registered.

A particular PITA is the firmware versions currently shipping on the KOA2 -
You have to be able to put the blocker directory name on USB storage to prevent an OTA update before you let the Kindle call home to register it. But you can't put anything on the USB storage until it is registered.

A significant problem with Kindles purchased as "gifts" during the up coming gift giving season.
This is one legitimate use of a fake registration file.

Use this RUNME.sh script (with *nix line endings, not Windows line endings) to install a temporary registration information file.
Note: This file will be removed anytime you contact with Amazon, so it should not interfere with registering the Kindle for real.
This also enables all menu entries, both main menu tree and settings menu tree.

Code:
#!/bin/sh

# If present, save current registration info file
[ -f /var/local/java/prefs/reginfo ] && cp /var/local/java/prefs/reginfo /mnt/us/reginfo.bak || true

# Add a fake registration file, format as for 5.9.2 and earlier
cat > '/var/local/java/prefs/reginfo' << EOF
givenName=Hacker
userId=amzn1.account.XXXXXXXX3AAA587YYYYYYYYYYYYY
deviceName=FakeReg
userName=Hacker
deviceEmailAddress=hacker@kindle.com
EOF
NOTE: You must reboot (restart with long press of power button) after running the above script.

Which results in (this is a PW3, fm 5.9.2):
Notice the device name above and in the upper left of the home screen:


Last edited by knc1; 11-22-2017 at 02:16 PM.
knc1 is offline   Reply With Quote
Old 11-24-2017, 01:03 PM   #4
doctoralvarez
Connoisseur
doctoralvarez began at the beginning.
 
Posts: 72
Karma: 10
Join Date: Jun 2016
Device: PW3
Thanks knc1

Quote:
Originally Posted by knc1 View Post
Some firmware versions do not allow the USB storage area to be accessible over USB unless the Kindle is registered.

A particular PITA is the firmware versions currently shipping on the KOA2 -
You have to be able to put the blocker directory name on USB storage to prevent an OTA update before you let the Kindle call home to register it. But you can't put anything on the USB storage until it is registered.

A significant problem with Kindles purchased as "gifts" during the up coming gift giving season.
This is one legitimate use of a fake registration file.

Use this RUNME.sh script (with *nix line endings, not Windows line endings) to install a temporary registration information file.
Note: This file will be removed anytime you contact with Amazon, so it should not interfere with registering the Kindle for real.
This also enables all menu entries, both main menu tree and settings menu tree.

Code:
#!/bin/sh

# If present, save current registration info file
[ -f /var/local/java/prefs/reginfo ] && cp /var/local/java/prefs/reginfo /mnt/us/reginfo.bak || true

# Add a fake registration file, format as for 5.9.2 and earlier
cat > '/var/local/java/prefs/reginfo' << EOF
givenName=Hacker
userId=amzn1.account.XXXXXXXX3AAA587YYYYYYYYYYYYY
deviceName=FakeReg
userName=Hacker
deviceEmailAddress=hacker@kindle.com
EOF
NOTE: You must reboot (restart with long press of power button) after running the above script.

Which results in (this is a PW3, fm 5.9.2):
Notice the device name above and in the upper left of the home screen:

Thanks for Alm your help knc1, I will be checking when script to remove oldKUAL arrives
doctoralvarez is offline   Reply With Quote
Old 11-24-2017, 02:38 PM   #5
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by doctoralvarez View Post
Thanks for Alm your help knc1, I will be checking when script to remove oldKUAL arrives
The developer who made his go away used a very big hammer.
(so we know it can be done)
We will try for something a little more elegant for the general release.

We may need a "fixup" for KPVbooklet also.

And one to get rid of broken RP/CRP installs on the KOA2 -
Those depend on having a 'Diags' partition and the KOA2 does not have a 'Diags' partition.
It went bye-bye in the re-organization to support Android.

Last edited by knc1; 11-24-2017 at 02:41 PM.
knc1 is offline   Reply With Quote
Advert
Old 01-15-2018, 09:43 PM   #6
tejasvi88
Member
tejasvi88 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Oct 2017
Device: Kindle basic 8th Gen
Script for launching koreader? KUAL broken in 5.9.2 😔
tejasvi88 is offline   Reply With Quote
Old 01-23-2018, 07:32 AM   #7
Georgie W
Connoisseur
Georgie W began at the beginning.
 
Georgie W's Avatar
 
Posts: 83
Karma: 10
Join Date: Jan 2014
Location: Scotland
Device: KT4 5.13.6
Quote:
Originally Posted by tejasvi88 View Post
Script for launching koreader? KUAL broken in 5.9.2 😔
And for Librarian Sync? Thanks for the examples above, but I don't feel confident that I've understood the language before venturing on developing my own script. Thanks.
Georgie W is offline   Reply With Quote
Old 01-23-2018, 08:55 AM   #8
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by Georgie W View Post
And for Librarian Sync? Thanks for the examples above, but I don't feel confident that I've understood the language before venturing on developing my own script. Thanks.
You do not have to invent your own script.
Just copy the one used by KUAL.

But if you or anyone else has time to do that, they should share their work by posting here.
knc1 is offline   Reply With Quote
Old 01-28-2018, 10:44 AM   #9
tejasvi88
Member
tejasvi88 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Oct 2017
Device: Kindle basic 8th Gen
Smile

Quote:
Originally Posted by knc1 View Post
You do not have to invent your own script.
Just copy the one used by KUAL.

But if you or anyone else has time to do that, they should share their work by posting here.
Copy from where?
tejasvi88 is offline   Reply With Quote
Old 01-28-2018, 12:20 PM   #10
02xda2
moddedmad
02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.02xda2 ought to be getting tired of karma fortunes by now.
 
Posts: 2,120
Karma: 3911694
Join Date: Jan 2018
Device: none
Quote:
Originally Posted by tejasvi88 View Post
Copy from where?
Please read the thread from the beginning
02xda2 is offline   Reply With Quote
Old 02-02-2018, 06:12 AM   #11
Georgie W
Connoisseur
Georgie W began at the beginning.
 
Georgie W's Avatar
 
Posts: 83
Karma: 10
Join Date: Jan 2014
Location: Scotland
Device: KT4 5.13.6
Writing scripts for beginners

Quote:
Originally Posted by 02xda2 View Post
Please read the thread from the beginning
Thanks - I have read the thread from the beginning and I do appreciate that this is an evolving area.
However, as a Kindle user, with no programming experience, I don't understand the detail of the script examples shown in this thread. They deal (I think) with fake registrations and logging at the root, but I can't extrapolate from that how to vary them to do anything else.

I would be grateful for signposting to how I can learn enough of the language to write one that would let me run LibrarianSync, in the absence of KUAL. One poster helpfully suggested copying the KUAL script - unfortunately I think they've overestimated my ability to (a) find the KUAL script (b) modify it.

It may turn out that all this needs more programming experience than I have, in which case I'll sit tight until either KUAL is updated or Amazon collections are integrated with Calibre.

Thanks in advance for any advice.
Georgie W is offline   Reply With Quote
Old 02-02-2018, 07:13 AM   #12
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Viewed over the USB cable:
/
Viewed from the command line:
/mnt/us/

So here shown as:
*/

*/extensions/<add-in name>/menu.json <<-- this file lists the association between menu label and script that performs the action
*/extensions/<add-in name>/config.xml <<-- configuration info for the menu, not for the add-in
*/extensions/<add-in name>/bin/*.sh <<-- the script(s) that perform the menu action
Rather than call that script with KUAL, copy it and call it with ;log runme
About the only thing you **might** have to do is add a:
cd /mnt/us/extensions/<add-in name> to the script (something that KUAL does, sets the current directory)

All of which is fully documented in the Wiki.

How to find the Wiki entry.
As usuall, we hide it behind some writing to be read:
First post of the KUAL release thread, section titled; "KUAL extensions", open spoiler, read text which includes the link to the KUAL/Extensions/documentation.

Computer information is stored in either a single tree (*nix, including linux on your kindle) or a tree per storage device (win*).
This forum is organized more like windows (which should not be too hard for most users, the *nix users put up with it).

The top of each information tree is always the first post of the tread dedicated to the introduction/release of the subject.

So like on Windows, when you want to find something, you start where it might be stored (say: F:\) or KUAL
Read what you find there (either under F:\ or forum\KUAL) to find the next level towards what you want.
Always read the first post, including opening any spoilers and reading the information there.
Keep a sharp eye out for any links (say to: F:\<more specific info> or Site\<first post>\<topic section>\<more specific info>

It really isn't rocket science (it is instead, computer science).

Last edited by knc1; 02-02-2018 at 07:25 AM.
knc1 is offline   Reply With Quote
Old 03-14-2018, 07:09 AM   #13
rola25
Junior Member
rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!rola25 is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 2
Karma: 50492
Join Date: Oct 2017
Device: Kindle Voyage
Hi

Quick and dirty serial console to kindle:

1. Create RUNME.sh with following content:

Code:
#!/bin/sh

# Unload Mass Storage Gadget Module
modprobe -r g_file_storage
# Load Serial Gadget Module
modprobe g_serial

# Infinite Loop for getty
while true; do
  getty -L 115200 -i -n -l /bin/bash /dev/ttyGS0
  sleep 1
done
2. Disconnect from USB
3. run ;log runme
4. Connect USB-Port to Computer, it is now recognised as new Serial Device
5. Open devmgmt.msc on Windows, Search for Serial Port Number in Ports (e.g. COM8)
6. Connect with Putty to Serial COM8 Speed 115200
7. After use you have to kill the RUNME.sh script in Terminal because it loops itself the getty process
8. If you want Mass Storage again, reboot kindle


Greetings from Austria
rola25

Last edited by rola25; 03-14-2018 at 07:20 AM.
rola25 is offline   Reply With Quote
Old 03-14-2018, 07:38 AM   #14
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 415
Karma: 750442
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
Quote:
Originally Posted by rola25 View Post
Hi

Quick and dirty serial console to kindle:

1. Create RUNME.sh with following content:

Code:
#!/bin/sh

# Unload Mass Storage Gadget Module
modprobe -r g_file_storage
# Load Serial Gadget Module
modprobe g_serial

# Infinite Loop for getty
while true; do
  getty -L 115200 -i -n -l /bin/bash /dev/ttyGS0
  sleep 1
done
2. Disconnect from USB
3. run ;log runme
4. Connect USB-Port to Computer, it is now recognised as new Serial Device
5. Open devmgmt.msc on Windows, Search for Serial Port Number in Ports (e.g. COM8)
6. Connect with Putty to Serial COM8 Speed 115200
7. After use you have to kill the RUNME.sh script in Terminal because it loops itself the getty process
8. If you want Mass Storage again, reboot kindle


Greetings from Austria
rola25
It works fine on my PW3

One note: if you have usbnetwork enabled, you have to disable it before (device must be in "usb mode" status)

Thanks for sharing
encol is offline   Reply With Quote
Old 03-14-2018, 09:15 PM   #15
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
Quote:
Originally Posted by rola25 View Post

Quick and dirty serial console to kindle: ...
Nifty! Thanks for sharing.

Last edited by PoP; 03-14-2018 at 09:17 PM.
PoP is offline   Reply With Quote
Reply

Tags
fake registration, runme


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindle 3 sysvinit scripts Feathers_McGraw Kindle Developer's Corner 11 03-10-2021 02:05 AM
Firmware upgrade scripts davidfor Kobo Developer's Corner 29 04-29-2014 04:34 PM
My Kindle 4 NT does not execute RUNME.sh! HariSeldon85 Kindle Developer's Corner 15 09-03-2012 01:52 PM
is it possible to run k5 launchpad scripts on k5 techiemonkey Kindle Developer's Corner 3 07-30-2012 09:10 AM
Network Control Scripts synerr iRex 3 01-13-2008 06:54 AM


All times are GMT -4. The time now is 12:09 AM.


MobileRead.com is a privately owned, operated and funded community.