site  contact  history  index

Notes for porting UltraSNS to Puppy Linux

February 21, 2019 — BarryK

Or some other Puppy-derivative. UltraSNS has debuted in the latest EasyOS, version 1.0.8, see post yesterday:

http://bkhome.org/news/201902/easyos-x8664-version-108-released.html

And a post about UltraSNS and minibase-network utilities:

http://bkhome.org/news/201902/ultrasns-based-on-minibase-utilities.html

Minibase, created by Alex Suykov, can be obtained from the project page and compiled, see post:

http://bkhome.org/news/201902/minibase-super-tiny-static-system.html

I have two PETs. The utilities are statically-linked and will work in any distribution (38KB, 10KB, 41KB):

http://distro.ibiblio.org/easyos/amd64/packages/pet/pet_packages-pyro/minibase-net-20190218-p1-amd64.pet

http://distro.ibiblio.org/easyos/amd64/packages/pet/pet_packages-pyro/minibase-net_DOC-20190218-p1-amd64.pet

http://distro.ibiblio.org/easyos/aarch64/packages/pet/pet_packages-pyro/minibase-net-20190218-p1-aarch64.pet

...notice the size!

In WoofE, the build system for EasyOS, in folder 'rootfs-skeleton', can be found the files for UltraSNS. The latest WoofE (94MB):

http://distro.ibiblio.org/easyos/project/woof/woof-project-20190221.tar.gz

In rootfs-skeleton/usr/local/UltraSNS are these new scripts:

usr/local/UltraSNS/rc.network
usr/local/UltraSNS/usns

Also new, are scripts in etc/net, that are called by the minibase daemons:

conf-cancel  conf-request  dhcp-gw   identify  mode-wifi
conf-renew   dhcp-dns      dhcp-ntp  mode-lan  wifi-wpa

In rootfs-skeleton, all of these scripts have been modified:

usr/local/apps/Connect/AppRun
usr/sbin/network_default_connect
usr/sbin/connectwizard
usr/sbin/networkdisconnect
usr/sbin/connectwizard_2nd

EasyOS specific, handling EasyContainers:

usr/local/easy_containers/stop-container
usr/local/easy_containers/ec-chroot

This is new:

sbin/dhcp-delayed

usr/local/defaultconnect now has this at first bootup (instead of "connectwizard"):

#!/bin/sh
exec usns

At bootup, etc/rc.d/rc.sysinit calls usr/sbin/network_default_connect, which reads 'defaultconnect' and as it contains "usns", calls usr/local/UltraSNS/rc.network, which launches the minibase daemons 'ifmon' and 'wsupp'.
From then on, network handling is automatic, though wifi will need a password first-time, by clicking on the "connect" icon on desktop, which launched the GUI, usr/local/UltraSNS/usns

The above should be enough info for porting.  One thing to look out for, make sure that 'dhcpcd' or 'udhcpc' are not run anywhere, as they will conflict with minibase's 'dhcp' DHCP client. 

Tags: linux

EasyOS x86_64 version 1.0.8 released

February 20, 2019 — BarryK

It has arrived, a new release of EasyOS! The previous x86_64 release was version 1.0, and it is essential to read that announcement:

http://bkhome.org/news/201901/easyos-version-10-released.html

Lots of little improvements since then, and some not-so-little, such as adoption of Alex Suykov's minibase network utilities, which is now the default network manager, given the name "UltraSNS":

http://bkhome.org/news/201902/ultrasns-based-on-minibase-utilities.html

There are two non-English builds, French and German, with considerable input provided by L18L and esmourguit (names on the Puppy Forum). There were some other languages built for 1.0.

Esmourguit has been extremely helpful, discovering and fixing a lot of buglets, some of which have been there for a long time, back in the Puppy days. Also, he has internationalised some apps.

Download from here:

http://distro.ibiblio.org/easyos/amd64/releases/pyro/1.0.8/

Have fun! 

Tags: easy

UltraSNS based on minibase utilities

February 18, 2019 — BarryK

I have posted recently about Alex Suykov's minibase network utilities:

http://bkhome.org/news/201902/basic-ethernet-setup-with-minibase.html

http://bkhome.org/news/201902/minibase-super-tiny-static-system.html

EasyOS has a variety of network managers, inherited from Puppy Linux. These include SNS (Simple Network Setup), Frisbee, PupDial, and GPGRS. The last two are for dial-up network access.

For wired and wireless networks that do not require dialup, I have now added UltraSNS. This is a network management frontend to Alex's minibase network utilities.

I have had various issues with using these utilities, and Alex has been extremely helpful, improving them. The latest, as at February 18, 2019, is working well.

The utilities are in /sbin. The scripts that are called by the 'ifmon' and 'wsupp' daemons, are in /etc/net, and I have crafted these. I also created two scripts in /usr/local/UltraSNS, 'rc.network' and 'usns' -- the former gets called at bootup to launch 'ifmon' and 'wsupp' (if UltraSNS is chosen as the network manager), the latter is the management GUI.

The GUI runs when click on the "connect" icon on the desktop. For ethernet connection, where there is a DHCP server, everything is automatic. This is the GUI, however, it is for information only, as everything is automatic:

img1

And as described in earlier posts, unplugging/replugging the cable, etc., is automatically responded to.

OK, unplug the ethernet cable, plug in the USB wifi module, reboot, bring up the GUI:

img2

...choose the wifi interface, the SSID, enter password, click "CONNECT", and we are online. Having done so, if I bring up the GUI again:

img3

When I reboot, if the USB wifi device is plugged in, it will automatically connect. The password is remembered, in an encrypted form, so if disconnected and we get that second-bottom snapshot (above), then the password-box will be greyed-out.

I haven't got around to any means of altering the password, but it could be done.

'usns' is just a shell script, using gtkdialog for the GUI. As Alex pointed out to me, parsing the output of the minibase utilities, such as 'wifi', the client for the 'wsupp' daemon, is not a good idea, as the utilities are evolving and the output format is liable to change. So, this is a temporary GUI, will have to think of writing a GTK GUI in C or BaCon, with a socket to talk to 'supp'. Also 'ifmon'.

I think will make UltraSNS the default for the next release of EasyOS. 

Tags: easy

Dynamic eth handling in EasyOS

February 16, 2019 — BarryK

I posted about an improvement in pup_event_frontend_d:

http://bkhome.org/news/201902/pupevent-now-detects-cable-plugunplug.html

This is now implemented in EasyOS, for the case of default at first bootup, and for SNS. In the case of first-bootup default, a active ethernet connection is automatically found, and 'dhcpcd' run to obtain a lease. This is as before, except now if the network goes down or up, such as the cable being unplugged/plugged, then the network connection will go down/up automatically.

The modified scripts:

/etc/rc.d/rc.network_eth
/usr/local/pup_event/netchg
/usr/local/pup_event/frontend_timeout60
/usr/local/simple_network_setup/rc.network
/usr/sbin/delayedrun
This has nothing to do with minibase. I may be bringing the minibase net utilities into Easy, as an alternative network management system, named UltraSNS.

Minibase is a work of art, and I would like to explore a distro, maybe the return of Quirky, built upon minibase. 

Tags: easy

pup_event now detects cable plug/unplug

February 14, 2019 — BarryK

I have reported recent work with the minibase network utilities:

http://bkhome.org/news/201902/basic-ethernet-setup-with-minibase.html

The 'ifmon' daemon detects "aliveness" of an ethernet interface. That is, if a cable is plugged-in, with a router or something at the other end, that is working, then there is a "carrier" on the cable. It doesn't mean that we have Internet connection or whatever, it just shows that the cable is connected and functioning.

The carrier would go down if the router is turned off, back up if turned on -- however, we observed the carrier going up and down a few times, over about 30 seconds, before staying up, which does complicate how we will respond to this information. Discussion here:

https://github.com/arsv/minibase/issues/8

Putting aside minibase for awhile, being able to detect cable plug/unplug and router on/off, is very important to have as a basic feature in EasyOS, so that the network connection can be dynamically brought up/down in response. Rather than the current situation, where the ethernet connection is expected to be active at bootup, and there is no dynamic response afterward.

The utility 'pup_event_frontend_d' is launched at bootup and detects various conditions, such as whether X is up, whether there is a Internet connection. This is part of 'pup_event', described here:

http://bkhome.org/docs/pup_event/pup_event-service-management.htm

'pup_event_frontend-d' is written in BaCon and is in the 'pup-tools' PET. I have enhanced the daemon to detect carrier up/down, and here are the latest binary packages:

http://distro.ibiblio.org/easyos/amd64/packages/compat/oe/pyro/pup-tools-20190215-r0-nocona-64.tar.xz

http://distro.ibiblio.org/easyos/aarch64/packages/compat/oe/pyro/pup-tools-20190215-r0-aarch64.tar.xz

These were compiled in oe-qky-src, my fork of OpenEmbedded:

https://github.com/bkauler/oe-qky-src/tree/master/quirky/meta-quirky/recipes-quirky/pup-tools

The latest source for pup-tools is here;

http://distro.ibiblio.org/easyos/source/oe/pyro/pup-tools-20190215.tar.gz

'pup_event_frontend_d' uses a netlink socket to monitor events from the kernel. Extracting a tiny part of the code, there is a seconf socket added, to wait for 'NETLINK_ROUTE' events:

pfd2.fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)

The code that receives the messages is very simple:

 IF pfd2.revents NE 0 THEN
len = recv(pfd2.fd, buf, size_buf, MSG_DONTWAIT)
IF len==-1 THEN END 4
IF netcnt EQ 0 THEN
netcnt=50
'post to ipc clients, if any...
ipc_post_func("netchg_","change")
'also, let us be proactive, call a script directly...
IF FILEEXISTS("/usr/local/pup_event/netchg") THEN
SYSTEM "/usr/local/pup_event/netchg &"
ENDIF
ENDIF
ENDIF

This posts a "netchg_" IPC message to any clients that might be waiting on it. The pup_event IPC mechanism is explained here:

http://bkhome.org/docs/pup_event/pup_event_ipc.htm

Not only does this daemon detect cable carrier up/down, it also detects a USB wifi dongle plugged/unplugged. The 'netcnt' variable is to take care of the rapid carrier up/down that occurs when the router is turned on -- there is an IPC generated on the first change, and any changes over the next 50 seconds are ignored.

I have not yet written a client daemon. Will probably name it something like 'netchgd' and it will start at bootup and await "netchg_" IPC messages. It will then examine /sys to determine exactly what has changed, 

Tags: easy

Basic ethernet setup with minibase

February 08, 2019 — BarryK

I posted a couple of days ago about minibase, created by Alex Suykov:

http://bkhome.org/news/201902/minibase-super-tiny-static-system.html

Since then, I have been learning how it works, and posting questions:

https://github.com/arsv/minibase/issues

...to which he has patiently and helpfully replied.

Initially, I have explored ethernet network connection, as this is one of the areas in EasyOS (and Quirky and Puppy) that has issues. When I introduced NetworkManager to EasyOS, the ethernet connection problems went away. Basically, NetworkManager automatically detects which ethernet interface is "alive" and connected to a router/modem, and you can turn off the router, turn it back on, change cable to a different ethernet socket on the PC, and NetworkManager automatically adjusts.

I think that Puppy Forum member Jemimah originally created Frisbee network manager with this kind of flexibility in mind (project now maintained by rerwin), but I don't know to what extent that flexibility was achieved.

Anyway, fast-forward to now, testing minibase, and yippee, it has the same automatic flexibility as NetworkManager. Note, NetworkManager is no longer in Easy, as posted yesterday, I removed it:

http://bkhome.org/news/201902/networkmanager-removed-from-easyos.html

The rest of this post will be a mini-tutorial, explaining how I have setup minibase, or rather, just the utilities concerned with ethernet networking. There are these networking utilites, in /sbin:

dhcp  ifctl  ifmon  ip4addr  ip4info  wifi  wsupp

Actually, Alex places 'ifmon' and 'wsupp' in /sbin/service. 'wifi' and 'wsupp' are for wifi, so will leave those out of the discussion for now. Note, the total size of these utilities is 100KB and they are statically-linked.

'ifmon' is a daemon, that is intended to be started at bootup. To easily show output, I have started it in a terminal. I deliberately left the network cable unplugged:

# mkdir /run/ctrl
# ifmon
+++ identify eth0
+++ identify eth1
+++ identify wlan0
+++ mode-lan0 eth0
+++ mode-lan1 eth1

I then plugged in the network cable (between PC and router):

+++ conf-request eth0
+++ dhcp-gw 192.168.1.1
+++ dhcp-dns 192.168.43.1 168.126.63.2

Unplugged the cable:

+++ conf-cancel eth0

Plugged it in again:

+++ conf-request eth0
+++ dhcp-gw 192.168.1.1
+++ dhcp-dns 192.168.43.1 168.126.63.2

The network connection went up when I plugged in the cable, down, then back up when I replugged the cable. The network_tray icon faithfully showed the status.

Technical note:
"aliveness" detection is not done by a polling loop. It is done efficiently by a netlink socket, waiting on notifications from the kernel.

This is great, exactly what I want. Now, some explanation about the messages that 'ifmon' puts out. 'ifmon' relies upon scripts to do any real action. Those scripts are in /etc/net:

conf-cancel  conf-request  dhcp-gw   identify  mode-wifi
conf-renew   dhcp-dns      dhcp-ntp  mode-lan  wifi-wpa

At startup, 'ifmon' calls /etc/net/identify, for each interface that it discovers, passing the interface name, as you can see above. This is what I put into 'identify':

#!/bin/sh
echo "+++ identify $1"
IF="$1"

IDflg=""; NET='lan'
[ -d /sys/class/net/${IF}/wireless ] && NET='wifi'

#test if id already assigned...
[ -s /var/local/interfaces ] && IDflg="$(ifctl | grep "${IF}: ${NET}")"
#if not, assign it...
if [ ! "$IDflg" ];then
NUM="${IF/*[a-z]/}"
if [ ! -f /etc/net/mode-${NET}${NUM} ];then
cp -a /etc/net/mode-${NET} /etc/net/mode-${NET}${NUM}
sed -i -e "s%\+\+\+ mode-${NET} %+++ mode-${NET}${NUM} %" /etc/net/mode-${NET}${NUM}
fi
ifctl ${IF} mode ${NET}${NUM}
fi

ifctl $IF identify

I won't spend much time explaining this. Minibase determines a persistent name for the interface, independent whether the actual interface name "eth0", "eth1" or whatever, changes. This persistent name is assigned to a script. What I have done in the above script is assign eth0 to script /etc/net/mode-lan0 --which will get called even if the name assigned to that interface changes. In other words, script 'mode-lan0' is locked to that physical interface.

Technical note:
"eth0", "eth1" etc., are the names assigned by the linux kernel. Most linux distributions rename these, or rather, udev does, to a name unique to each physical interface. I do not like this, and EasyOS does not have this renaming (it is simply a matter of removing a certain rules file from the udev (or systemd) package). The method employed by Alex, is, I think, much more intelligent, and we get to keep the kernel-assigned names.

If you look above, you will see that next, /etc/net/mode-lan0 got called, with the kernel-assigned name (in this case "eth0") passed in. This is the content of 'mode-lan0':

#!/bin/sh
echo "+++ mode-lan0 $1"
ifconfig $1 up
ifctl $1 auto-dhcp

Then, after plugging in the ethernet cable, /etc/net/conf-request got called:

#!/bin/sh
echo "+++ conf-request $1"
dhcp $1 request

The 'dhcp' utility responds by obtaining a lease from the DHCP server on the router. Note, 'dhcp' is just a client. It is tightly integrated with the other utilities.

When the lease is obtained, 'ifmon' calls /etc/net/dhcp-dns, passing in the nameserver IP addresses, as you can see above. This is the content of 'dhcp-dns':

#!/bin/sh
echo "+++ dhcp-dns $@"
[ "$1" == "" ] && exit
echo "#written by /etc/net/dhcp-dns" > /etc/resolv.conf
for aIF in $@
do
echo "nameserver ${aIF}" >> /etc/resolv.conf
done

...I had to do that, as apps such as the browser need that info in /etc/resolv.conf for Internet access.

When I unplugged the cable, 'conf-cancel' got called:

#!/bin/sh
echo "+++ conf-cancel $1"
dhcp $1 cancel
So, the only thing that we need to do is run 'ifmon' at bootup. Which I will be integrating into EasyOS.

EDIT: Alex has read this blog post, and responded here:
https://github.com/arsv/minibase/issues/5#issuecomment-461873169

I have not got onto wifi yet, and that is most exciting, as Alex has written the utilities from scratch. There is 'wsupp' which replaces 'wpa_supplicant'. The latter has been troublesome, and I am eagerly anticipating what is coming... 

Tags: easy

NetworkManager removed from EasyOS

February 05, 2019 — BarryK

It was an experiment, the last few releases of Easy have NetworkManager and ModemManager, replacing the Puppy-inherited network management tools. They don't really seem to bring that much more "to the table", but they do bring a lot of weight.

I am reverting to the Puppy tools. Here are the removed packages. This list includes dependencies that are not required by anything else. The second column is installed size, uncompressed, in KB:

networkmanager
6456
modemmanager
6368
dnsmasq
316
jansson
64
neard
372
libndp
64
libnewt
132
slang
1988
ofono
2052
libqmi
2648
libmbim
360
mobile-broadband-provider-info
356

The total is 21176KB. In the compressed EasyOS image file, that would become about 7-9MB. The image file is currently about 400MB, so that is a significant drop.

I decided that I would rather keep on improving the network tools inherited from Puppy, and of course the Puppy developers are working on improving those.

Note, they are they all along in Easy, never got removed, and even though NetworkManager is the default, a user may fallback to the older tools.

Many of the mainline distributions use NetworkManager and ModemManager. Here is info about them:

https://en.wikipedia.org/wiki/NetworkManager

https://www.freedesktop.org/wiki/Software/ModemManager/

This is a post when I first started to consider NetworkManager:

http://bkhome.org/news/201811/considering-networkmanager-for-easyos.html

I did also consider 'iwd', a replacement for 'wpa_supplicant', however couldn't get it to work. Here is a blog post when first considering it:

http://bkhome.org/news/201811/iwd-alternative-to-wpasupplicant.html 

Tags: easy

Minibase, super-tiny static system

February 04, 2019 — BarryK

Thanks to sc0ttman on the Puppy Forum who discovered this, see post:

http://murga-linux.com/puppy/viewtopic.php?t=115255

Here is the Minibase project page:

https://github.com/arsv/minibase

I compiled like this:

# ./configure
# make
# make install

...and it compiled in, well, it seemed like a few seconds!

Installation is into folder 'out'. The utilities are statically-linked ...and wow, they are small!

Minibase is a complete Linux system, and can be used with Buildroot to compile an X desktop. I downloaded a ready-made image from here:

https://github.com/arsv/minibase-br/

...file 'sys-1-plain.tar.xz' is only 17.7MB, what kind of desktop can that possibly be?

I expanded 'sys-1-plain.tar.gz' and inside is 'whole.img' which I wrote to a USB stick. It actually booted to a desktop, on my HP midi-tower PC, and I couldn't believe how fast -- under 5 seconds.

Nothing much on the desktop, just Fluxbox and urxvt. But hey, this is brilliant.

Xorg, fluxbox, urxvt etc., were compiled in Buildroot, using musl, and it should be possible to add more apps, such as a browser.

I have a particular fascination for minimalist systems like this. Also, I am interested in some of the utilities, for possible use in Easy. 

Tags: linux