minibase

Puppy related raves and general interest that doesn't fit anywhere else
Post Reply
Message
Author
User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

minibase

#1 Post by sc0ttman »

May be of interest to those who like small C programs, static binaries,
playing with the boot process or initrd (etc)...

https://github.com/arsv/minibase
What is this project
~~~~~~~~~~~~~~~~~~~~
This is an alternative base system / early userspace for Linux.

The role of this project in a system is similar to that of busybox
in small custom distributions. Boot the system, load modules, mount
partitions, establish networking, provide basic services. It is aimed
more at personal devices running GUIs however, more like systemd.

The project builds into small statically-linked executables with no
external dependencies. There are no build-time library dependencies
either, not even libc. It can be built with any toolchain that can
build the kernel.

Supported targets: x86_64 arm aarch64 rv64 mips mips64 i386.
(anything else will not work even if toolchain is available)

This project should be mostly useful for people building their own
custom systems, distribution, or maybe even looking for tools to put
into initrd.


Project status
~~~~~~~~~~~~~~
The project is ONGOING but not yet complete or even stable.
Components currently included in the package:

* batch command runner / script interpreter (msh)
* early-stage boot utils (switchroot, modprobe, mount).
* non-encrypted block device locator (findblk).
* encrypted device locator and passphrase prompt (passblk).
* support tooling for disk encryption (dektool, dmcrypt).
- no fsck for any file system yet.

* process supervision suite (svhub, reboot).

* udev event monitor (udevmod).
* syslogd and related tools.
* non-privileged mount service (mountd, pmount).
* controlled privilege escalation service (suhub, sudo)

* VT/DRI/input multiplexer (vtmux)
* simple non-graphical greeter (ctrlvt).

* network interface monitor (ifmon)
* DHCP client (dhcp)
* Wi-Fi client and connection manager (wsupp) [WPA2-PSK only]
* manual interface setup tools (ip4cfg, ip4info) [incomplete]
- no sntpd yet.

* simple interactive shell (cmd).
* basic command line tools (cat, ls, du, df etc).
* small linux-specific tools (systime, sync, dmesg etc).

- no package manager / download tool yet.
- no audio tools of any kind.

With everything in place, the system should boot on kernel and minibase alone
to the point where it can run X or Wayland GUI, establish internet connection
and start downloading packages.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hi, sc0ttman.

Interesting. Is this entirely your own work or have you been putting together
progs from other people?

The above is not meant negatively. IMO, "arrangers" should get as much
respect as "composers". (E.g. the name of jazzman Gil Evans comes to mind.)

Keep up the good work.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#3 Post by jamesbond »

Good find Scott. Thanks.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#4 Post by BarryK »

sc0ttman,
Thanks from me too. Looks really interesting, have added it to my check-this-out list.
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#5 Post by BarryK »

I have started to check it out. Have got as far as setting up with the ethernet utilities:

http://bkhome.org/news/201902/basic-eth ... ibase.html

...a first go, might have to modify the scripts. But, looks real good.
[url]https://bkhome.org/news/[/url]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#6 Post by vovchik »

Dear Scott,

What a nice find. Thanks. I am also looking at this and see potential.

With kind regards,
vovchik

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#7 Post by BarryK »

The minibase network utilities are in the latest release of EasyOS, version 1.0.8, given the name "UltraSNS" (Ultra Simple Network Setup):

http://bkhome.org/news/201902/easyos-x8 ... eased.html

And I have written some notes if anyone feels motivated to port UltrsSNS to Puppy Linux, or a derivative:

http://bkhome.org/news/201902/notes-for ... linux.html
[url]https://bkhome.org/news/[/url]

Leon
Posts: 265
Joined: Wed 22 Jun 2005, 21:33

Ultra Simple Network Setup for Quirky Beaver 8.7.1

#8 Post by Leon »

BarryK wrote:The minibase network utilities are in the latest release of EasyOS, version 1.0.8, given the name "UltraSNS" (Ultra Simple Network Setup):

http://bkhome.org/news/201902/easyos-x8 ... eased.html

And I have written some notes if anyone feels motivated to port UltrsSNS to Puppy Linux, or a derivative:

http://bkhome.org/news/201902/notes-for ... linux.html
Congratulation an thank you for UltraSNS and the instructions.

I made a pet package to install UltraSNS in Quirky Beaver 8.7.1.

After installing the pet I successfully established a working wired and wireless internet connection by using UltraSNS.

I like the encrypted password for wireless connection.
Attachments
UltraSNS-0.1-qb871.pet
Ultra Simple Network Setup for Quirky Beaver 8.7.1
(65.12 KiB) Downloaded 191 times

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

Re: Ultra Simple Network Setup for Quirky Beaver 8.7.1

#9 Post by BarryK »

Leon wrote:
BarryK wrote:I made a pet package to install UltraSNS in Quirky Beaver 8.7.1.
Great!

I have received a pm, how can UltraSNS handle a static LAN? Fixed IP addresses.

I don't know, presume that /etc/net/mode-lan0 would have to be edited -- currently it just does this:

Code: Select all

#!/bin/sh
echo "+++ mode-lan0 $1"
ifconfig $1 up
ifctl $1 auto-dhcp
...that last line causes dhcp, the DHCP client, to run. Which, effectively is just like we would do if using dhcpcd:

Code: Select all

ifconfig $1 up
dhcpcd $1
...but, don't try to do this with USNS daemons running, as dhcp and dhcpcd will clash.

I have never setup a static LAN, and can't think of the steps, but the info could be found.

There is documentation on the minibase utilities:

http://distro.ibiblio.org/easyos/amd64/ ... -amd64.pet
[url]https://bkhome.org/news/[/url]

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

Re: Ultra Simple Network Setup for Quirky Beaver 8.7.1

#10 Post by rufwoof »

BarryK wrote:I have never setup a static LAN, and can't think of the steps, but the info could be found.
I've used static ... taking your EasyOS 1.0.8 kernel and initrd, and editing init to leave the top bit (mounts etc.), striping out the middle bit (Easy stuff), and dropping changes at the bottom (instead of the switch-root parts). init content fully reproduced here, and where the static LAN parts might be used as a guide ...

Code: Select all

export TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAIN=easyinitrd
export OUTPUT_CHARSET=UTF-8
export LC_COLLATE=C 
export LC_CTYPE=en_US.UTF-8
mount -t proc none /proc
mount -t sysfs none /sys
mount -t rootfs -o remount,rw rootfs /
ln -s /proc/mounts /etc/mtab 2> /dev/null
export PATH="/bin:/sbin"

[ ! "$INIT_LANG" ] && INIT_LANG=C #precaution.
wkgLANG="${INIT_LANG}"
#this should match console font loaded in quicksetup...
case "${wkgLANG}" in
 C|en*)
  wkgLANG="C"
 ;;
 ar*|he*|iw*) #arabic, hebrew
  loadfont < /lib/consolefonts/LatArCyrHeb-16.psfu
 ;;
 *) #all european languages...
  #el|ru|uk|be|sr|tg|os|ba|ce|cv)
  loadfont < /lib/consolefonts/LatGrkCyr-8x16.psfu
 ;;
esac

export wkgLANG

gzip -d /lib/keymaps/uk.gz
loadkmap </lib/keymaps/uk

#170206 reintroducing aufs in the kernel:
if grep -qw aufs /proc/filesystems; then
 LAYERFS='aufs'
 RO='=ro'
else
 LAYERFS='overlay'
 RO=''
fi

echo "nameserver 192.168.1.2" >/etc/resolv.conf
echo "127.0.0.1 localhost EASYPC18131" >/etc/hosts
# /etc/network/interfaces
mkdir -p /etc/network
echo "auto lo" >/etc/network/interfaces
echo "iface lo inet loopback" >>/etc/network/interfaces
echo "#auto eth0" >>/etc/network/interfaces
echo "#iface eth0 inet dhcp" >>/etc/network/interfaces
echo "iface eth0 inet static" >>/etc/network/interfaces
echo "address 192.168.1.4" >>/etc/network/interfaces
echo "netmask 255.255.255.0" >>/etc/network/interfaces
echo "network 192.168.1.0" >>/etc/network/interfaces
echo "broadcast 0.0.0.0" >>/etc/network/interfaces
echo "gateway 192.168.1.2" >>/etc/network/interfaces
echo "dns-nameservers 192.168.1.4 192.168.1.2" >>/etc/network/interfaces

mkdir -p /var/run/network # needed by ifup
# dmesg on my system indicates sky2 for Ethernet
modprobe sky2 
ifup eth0
/etc/net/dhcp-dns		# dns

localedef -f UTF-8 -i en_US en_US.UTF-8

export LANG=en_US.UTF-8
export LANGORG=en_US.UTF-8

# tmux requires pseudo terminal
mount -t devpts non /dev/pts -o ptmxmode=0666,newinstance

while :; do
	/bin/busybox sh
done
18MB combined initrd.gz (13MB) and vmlinuz (5MB) after stripping out pretty much all other firmware/modules/drivers to just leave my sky2 hardwired eth0. Messing around with that - creating html documents manually using mc editor, and viewing them using lynx. Tested the download speed and it pulled down a 350MB Bionicpup iso in 40 seconds, so reasonable enough. Has tmux (terminal multiplexor), mc (file manager/text editor), lynx (web browser), sc-im (spreadsheet), calcurse (calendar/diary/todo) installed and I've set tmux to load showing windows of calendar, weather (from wttr.in), file manager, browser, spreadsheet, top ... all ready to F12 step between them.

That's for dhcp using a static IP (my PC is set to a fixed IP (.4) in the ISP's router (.2 ... which I found by using peasy lan scanner set to port 80 i.e. the routers admin login html page. HardInfo menu option is another great tool for discovering things).

A interesting note is that setsid cttyhack sh could be used in the final while loop as that invokes a child shell that gets you out of the init (pid 0) shell and rids you of the "tty job control disabled" complaints that otherwise prevent running capsh. But I digress, the code above that is indicative of one way to set up a static connection. Not sure its the right way though (but it works for me).
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#11 Post by BarryK »

rufwoof,
Yes, interesting what you are doing. Yesterday I recompiled busybox for the initrd, brought it down from over 1000KB to about 450KB, and I left in that 'cttyhack', coz, like you, I saw that it could be useful.

I also left in 'run-init', never knew about this before, it is like 'switch_root' but has an option to drop capabilities. So, this could be an alternative to containers, offer a menu, switch_root with full capabilities, or crippled-root, the former for development, the latter for when you just want safe browsing.
[url]https://bkhome.org/news/[/url]

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#12 Post by rufwoof »

Never knew about run-init. Thanks.

In another earlier version what I was doing was to run through init, creating a /tmp/CHR file in the process and then running /sbin/init of the main system, but where I had added exit-chroot /tmp/CHR at the end of /etc/.profile (and where I modified exit-chroot to run /tmp/CHR) ... which initialised the main system as normal but landed back at init cli. Within /tmp/CHR I then re-ran the main system ... in the background, but with cap_sys_chroot dropped, so the /etc/profile's exit-chroot command subsequently fails. That way the main system (on Ctrl-alt-F4) can't break back out of its chroot, but access to the init cli is locally available on ctrl-alt-F1 (so conceptually the entire main system could be unloaded, and another alternative (or the same) main sfs loaded). Dropped chroot however does mean not being able to run containers from within the main system (but they can be launched from ctrl-alt-F1). I had the container setup to load to ctrl-alt-F3, so ctrl-alt-Fn type switching between initrd's cli, the easy container and the main desktop.

Currently I've dropped that and I'm just using my mini tmux type 'desktop', as that boots in <5 seconds and has calendar, weather ...etc. pretty much instantly available. My phone is good for 'normal' searching (using voice) and other google like activities. I boot Easy OS easy container for the rest (lynx is pretty much cripped nowadays due to https everywhere and common use of javascript etc., but still useful for documentation (create a text file of words, add in a few basic html tags and view using lynx).
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#13 Post by rufwoof »

I've now merged my mini boot version with the main 1.0.8 EasyOS. With my mini boot init code at the top of init .. and the normal EasyOS init code at the bottom.

I've set the mini to boot directly to tmux, that has internet connected along with windows of a introduction (showing .. "either reboot, shutdown or tmux kill-session to boot full EasyOS"), calcurse (calendar), weather (from wttr.in), lynx browser, mc file manager, top and sc-im (spreadsheet).

That expands a gzip'd image of initrd by around 10MB in total, boots to the tmux session quickly, and if you exit tmux it continues with the usual 'Finding drives .." EasyOS boot up sequence.

Being net connected, the mini boot could conceptually pull down (download) the main easy.sfs from elsewhere. As I mentioned before on my connection link it took around 40 seconds to download a 350MB bionicpup iso

Presently I'm using the standard switch-root out of init into EasyOS (easy init code pretty much untouched/as-is), so that mini session is totally lost once EasyOS is booted, but with relatively minor tweaks it could use chroot, and potentially look back around to perhaps fully unload EasyOS and download/load a entirely different main sfs. But why would you want to do that :)
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#14 Post by BarryK »

BarryK wrote:I also left in 'run-init', never knew about this before, it is like 'switch_root' but has an option to drop capabilities. So, this could be an alternative to containers, offer a menu, switch_root with full capabilities, or crippled-root, the former for development, the latter for when you just want safe browsing.
Didn't think that one through. To offer choice of normal or "crippled root" in the initrd, then use run-init, crippled option would have to setup network and sound while still in the initrd.
[url]https://bkhome.org/news/[/url]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#15 Post by sc0ttman »

[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

Post Reply