UltraSNS based on minibase utilities
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:
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:
...choose the wifi interface, the SSID, enter password, click
"CONNECT", and we are online. Having done so, if I bring up the GUI
again:
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
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_ethThis has nothing to do with minibase. I may be bringing the minibase net utilities into Easy, as an alternative network management system, named UltraSNS.
/usr/local/pup_event/netchg
/usr/local/pup_event/frontend_timeout60
/usr/local/simple_network_setup/rc.network
/usr/sbin/delayedrun
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
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:
These were compiled in oe-qky-src, my fork of OpenEmbedded:
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
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/shSo, the only thing that we need to do is run 'ifmon' at bootup. Which I will be integrating into EasyOS.
echo "+++ conf-cancel $1"
dhcp $1 cancel
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
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
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
Floppy format PET internationalized
I posted earlier about the work that esmourguit is doing to help internationalize EasyOS:
http://bkhome.org/news/201902/easyapps-internationalized.html
He has also discovered that the floppy disk formatter app is not internationalized.
In case anyone still has a need to format floppy disks, Easy has the
PET. Somehow it escaped being internationalized. There was one version
that was, I think that rodin.s did it -- very vague memory, don't take
that as the truth -- anyway, the PET being used in Easy isn't.
Or rather, wasn't, it is now. Here is the new, internationalized, PET, created by esmourguit (3KB):
Note, it has a dependency, ufiformat, that is also in Easy.
Also, here is the latest fr langpack from esmourguit (4.0MB):
http://distro.ibiblio.org/easyos/noarch/packages/pet/pet_packages-noarch/langpack_fr-20190203.pet
This will of course be in the next release of fr Easy build, coming soon.
Tags: easy
EasyApps internationalized
PupApps is a great frontend for choosing apps that Roger (Puppy
Forum member Radky) created for Puppy Linux. Awhile back, he very
kindly created a slight variant especially for EasyOS, named,
appropriately, EasyApps. See forum post for PupApps:
http://murga-linux.com/puppy/viewtopic.php?t=61962
Puppy Forum member esmourguit has been working on updating the French
langpack. He is an old Puppy fan, a member of the forum since 2006, but
these days is not involved in the forum, instead spends his time in
retirement on the French canals. However, he has come back for this
project, which is greatly appreciated.
Esmourguit noticed that EasyApps is not internationalized, so he has
"gettextized" it. I have applied his changes to EasyApps, and bumped the
version from 3.0 to 3.1. PET is here (121K):
http://distro.ibiblio.org/easyos/noarch/packages/pet/pet_packages-noarch/EasyApps-3.1.pet
Note, there are no actual translations in this PET. There is a .pot
file, and MoManager can be used to create translations for specific
languages (which will create .mo files).
Tags: easy