View Single Post
Old 01-08-2015, 01:59 PM   #1
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Post Yet another telnet/sshd & misc tools package...

As my device list attests to, I'm mostly a Kindle guy, but I nonetheless got a H2O for Christmas (mostly because the Kindle Voyage isn't available in France, but that's another matter entirely), and I of course had to 'port' all my Kindle crap to that new device .

Long story short, this is mostly the various tools I build bundled up in one big sack, with a telnetd/sshd setup.

Since I already wrote a readme inside the package, I'll leave the floor to myself:

README

This is basically a collection of all the custom binaries I use throughout my Kindle hacks,
but built for the Kobo, put in a single package, and symlinked (when not clashing) in the PATH.
That includes, among other things, stuff like less, htop, strace, ltrace, lsof, fbgrab, sqlite3, elfutils, rsync,
xzdec, zstd-decompress, lz4, ImageMagick, gawk, nano, ZSH, ag, tmux, GDB, gprof, perf, objdump, cURL, evtest, evemu,
FBInk, the full OpenSSH suite, jq, bsdtar, lftp, tree, file, dtc,
and a CLI Python 2.7 & Python 3.9 build with quite a few third-party modules (HTTPie, requests & co, Pillow, wand, ...).
And yes, just for kicks, there's also KindleTool in there ;D.
sshfs is also bundled, although Kobo kernels do not ship with FUSE enabled, so making use of it will require
building/installing the proper kernel modules, c.f. https://www.mobileread.com/forums/sh...5&postcount=66.

I still follow the Kindle spirit of "don't put anything in the rootfs if you don't have to",
so almost all of this lives in /mnt/onboard/.niluje, so don't be surprised if stuff goes missing after a factory reset .

It also provides ftpd/telnetd through inetd (following Kevin Short's KoboTelnet package), plus sshd w/ sftp (dropbear).
The dropbear build provides the same convenience features than my Kindle one (namely, persistent shared key auth:
the keylist is expected in /usr/local/niluje/usbnet/etc/authorized_keys).
There is *no* automatic USB networking handling here. WiFi only.
That said, you *can* manually toggle USBNetworking (provided your device isn't truly ancient), if need be:
c.f., /usr/local/stuff/bin/usbnet-toggle.sh for more details (in particular the fact that I'm using legacy Kindle IP settings ;p).
If you want an easy way to launch this script (besides in a shell via SSH over WiFi, as it's symlinked as usbnet-toggle),
see KFMon: https://github.com/NiLuJe/kfmon#how-...my-own-actions and/or NickelMenu: https://pgaskin.net/NickelMenu/ .

It also installs an udev rule providing a means to run an user-editable script (/usr/local/stuff/bin/stuff.sh) early during boot.
(AFAICT, that loop0 udev trick is used in a number of Kobo packages (David Beinder's kobo-nightmode and Andreas Klauer's AutoPatch, for instance),
no idea who got the idea first ).
This script is used to launch both inetd & dropbear.
Since everything is passwordless, running this on a public/open WiFi would be a *terrible* idea.
If you really need to, I'd recommend disabling inetd, setting up ssh shared key auth, making dropbear actually check passwords,
and locking dropbear to shared key auth only:
by removing the -n switch & adding the -s switch to its startup args, see the comments in /usr/local/stuff/bin/stuff-daemons.sh.

This touches neither rcS nor inittab, but if you already have an inetd setup in your inittab, you should probably clean that up, or it will clash.
If you have custom stuff in (or symlinked in) /usr/bin, take a closer look at what this package installs to avoid overwriting your own stuff.
This *will* survive FW updates .

NOTE: Since v1.6.N, the way Python is handled has changed a bit. Instead of shipping *everything* in the install KoboRoot tarball,
only the "core" stuff is bundled (i.e., everything except Python).
To install (or update) Python, make sure WiFi is enabled and will stick around (i.e., either via ForceWifi,
or by simply keeping the WiFi popup open), then run update-kobostuff
Ideally, do that in a tmux session: e.g., to install/update Python 3, run
tmux new -s kobo update-kobostuff Python
c.f., /usr/local/stuff/bin/update-kobostuff.sh for more details (including how to do offline updates).
It can also be used to update the "core" component, saving you an USBMS session and a reboot, and quite a bit of time,
as it will then use a much more efficient compression algorithm than the standard KoboRoot tarball.
Another major interest in doing it this way is that the compressed data will never make it to disk,
saving a few write cycles to the internal storage in the process .

To save space, both Python builds are shipped without compiled bytecode. Run python-setup to generate it.
Be aware that it could take around 5 minutes on slower devices...

Assuming you want Python, this *does* require a significant amount of free storage space (as each Python version requires around 150MB),
so make sure you have north of 400MB of free space for a full (Core + Python3 + Python2) install...
The update-kobostuff script should be taking care of checking that for you at install time, though.
That said, the actual core KoboRoot itself no longer bundles Python, and it should only require around 50MB.
And on that note, be aware than on slower devices (especially those using an internal SD card),
the "update" process can take a fair bit of time.

Tested on a H2O running FW 3.12.1 - 4.28.x, a Forma running FW 4.9.x - 4.28.x, as well as an Elipsa running FW 4.27.x - 4.28.x .
I'm fairly sure that this will *not* work on *really, really* old Kobo devices/firmwares:
basically, if your device is *not* running at least Linux 2.6.35.3 & a hardfp eglibc 2_15, don't use this.
TL;DR: It should work just fine for 99.9% of the population .

NOTE: Speaking of FW 4.17+, c.f., the entry about *nix hidden folders at the bottom of this page: https://github.com/NiLuJe/kfmon#things-to-watch-out-for
Because you'll probably want to tweak that setting *before* installing this .

NOTE: Kobo ships a glibc with no compiled locales. This is problematic, because it makes anything non-ASCII tricky to deal with...
c.f., http://trac.ak-team.com/trac/browser...fix-locales.sh for a quick recap of how to build some yourself.

Sidebar: If you need git, it's also available for installation via the update-kobostuff script (e.g., tmux new -s kobo update-kobostuff Git).
It's not part of the default package because, among other things, it has to eat a ~10MB chunk out of the rootfs...

-- NiLuJe ($Id: README 18694 2021-08-11 18:27:14Z NiLuJe $)

INSTALL

Copy the KoboRoot.tgz file found inside the kobo-stuff archive in the .kobo folder of your device.
Eject it safely, and wait for it to reboot after the "update" process.

NOTE: Like mentioned in the Python aside above, once installed this way, you can simply check for updates by running
tmux new -s kobo update-kobostuff Core
This ought to be much faster than doing the KoboRoot dance again.

DOWNLOAD

The current version is available here: kobo-stuff-1.6.N-r18901. [External link because it's slightly >20MB].


The build script, patches & toolchain config are in the x-tc tarball of my snapshots.

Last edited by NiLuJe; 03-23-2022 at 07:31 PM. Reason: Bump to 1.6.N-r18901
NiLuJe is offline   Reply With Quote