Resize2fs Questions

2022-01-31 Thread Martin McCormick
I figured I would start a new topic as none of this pertains to
the previous messages I posted.

I've got an almost 30-GB disk image of a working debian
installation for a Raspberry pi that I should be able to easily
squeeze on to a roughly 8 GB SSD card because it only takes up
10% of the 30-GB card and I think I am close but not there yet.
Because I hate drudgery with regards to syntax, I wrote a little
shell script that makes it easier to duplicate the same actions
and also makes it easy to show exactly what is happening so far.
The big image name is

rpi1_good.img

and it is 29 gb in size.  Here are the commands that work so far.

#!/bin/sh
#This resets everything for a new run.
  sudo losetup -d /dev/loop0
#copy a backup to the image name to start fresh.
sudo cp -p rpi1_good.img.bak rpi1_good.img
#This takes about half an hour.  Now, get to business.
sudo losetup -P /dev/loop0 rpi1_good.img
#This should show 2 partitions on loop0 when successful.
sudo ls -l /dev/loop0*
#You get /dev/loop0p1 and p2
#e2fs is required to run before one can resize.
   sudo e2fsck -f /dev/loop0p2
#I should be telling resize2fs to squeeze everything in to a 7GB
#partition.
   sudo resize2fs /dev/loop0p2 +7G

There are no complaints up to this point and resize
appeared to work so now it is time to reduce the size of
partition 2.

This may be where things go off the track.

I run

sudo fdisk /dev/loop0

and fdisk tells me it is 29.9 GB which I expected since Partition
#2 should be mostly empty but for the OS and my login directory.

I note that the starting sector for P2 is 137215 since
one must start at that sector and then I delete P2 and then add a
new partition which defaults to 2.

fdisk prompts for the first sector with a default of 2048 but I
type in 137215.  The last sector is in the 62-million range and I
want only 7 GB as the size so I type +7G and it takes that.

I then type w to save the changes and there is no
complaint.

The first hint of trouble is when you do fdisk -l
/dev/loop0.  The size count is still almost 30 GB but then a ray
of Sun in that P2 has a size of around 7 GB.

I outwitted Murphy this time by using another file on my
computer as the target rather than the SSD card so that if it
went over 8 GB, nothing annoying would happen.

I watched on another console as the size climbed past 5
GB, then 6 and 7 GB and then it was up past ten so it was going
to do the whole 30 GB if I hadn't stopped it.

I am not sure what I missed but the manual page for
resize2fs warns you to use something like fdisk to trim off the
excess empty space which is what I thought I did.  I would also
have thought that the disk image file should have deflated like a
punctured air mattress but it didn't.

I think I am almost there but obviously not yet.

Thanks in advance for ideas.

Martin



Re: SD Memory Card (was The Raspberry Pi that Took a Day Off.)

2022-01-29 Thread Martin McCormick
There's always one more question that nobody mentions and none of
the articles one finds on the topic don't touch.  When looking at
the man page for resize2fs in debian, it talks about the -b
option to turn on "the 64 bit feature."
__

   When shrinking the size of the partition, make  sure
   you do not make it smaller than the new size of the ext2 filesystem!

   The  -b  and  -s  options enable and disable the 64bit feature, respect-
   tively.  The resize2fs program will, of course, take care  of  resizing
   the  block  group  descriptors  and moving other data blocks out of the
   way, as needed.  It is not possible to resize the filesystem concurrent
   with changing the 64bit status.
__

Do I need this since the Pi runs an ARM processor which
would make the command

   #sudo resize2fs -b /dev/loop0p2 6.3g

or is it the same command without the -b flag?

I have determined that the 28.9 gb SSD card is 10% full
with the debian installation and the files I want in my login
directory.  I found a 7.3 gb SSD card that has probably never
been used that came with the first Raspberry Pi I bought around
2012 or so, going for a 32-gb card instead.  If I shrink the
Linux partition to 6.3 gb which is what the small card had
available, I should have it about 40 or 50% full.  I can then
safely dd it on to a larger card any time I want to do so and
then use resize2fs to expand the Linux partition after it is
installed.

What I did so far was to mount the 27-gb partition on
/mnt through /dev/loop0 and edit /mnt/etc/hostname to reflect the
host name for the system being rebuilt.  The edit changes the
image which is really neat.  All that is left is to shrink it
down to 6.3 gb and it should be ready to dd on to the 7.3 gb card
which should be bootable on it's own but which I will use to seed
a new 28-gb system that can be customized after it is running.

Many of the raspbian distributions have a #1 partition
that is a small fat32 lba partition for Windows users to be able
to activate debian from Windows.  Is this even necessary once one
is using unix tools on the disk?

Thanks to all the good advice from everyone.  I am seeing
the end of this project and have learned some new  useful tricks
that are good to know.

Martin



Re: SD Memory Card (was The Raspberry Pi that Took a Day Off.)

2022-01-28 Thread Martin McCormick
My thanks to everybody who has responded here.  I think the
prudent thing to do is use a new SSD card and I have one that is
supposed to be a full 32 gb.  The card I was able to finally
clear the partitions on is several years old but I think it is
still good but the suggestion to use it in a less mission
critical application is a good idea plus it is not a full 32 gb.

I have a radio receiver that can store information on one
of these cards and I'll use it for that since if there turns out
to be a bad cell somewhere, the world won't end like it can if
one's kernel or sector information becomes corrupted if it
happens to land in a vital piece of code.

Again, many thanks.

Martin McCormick



Re: SSD Memory Card (was The Raspberry Pi that Took a Day Off.)

2022-01-28 Thread Martin McCormick
David Wright  writes:
> I've not heard of that problem. You were prevented from zeroing the
> entire device, which would have wiped the partition table anyway.
> 
> What I would want to check is that the OS isn't doing something
> stupid, like trying to automount it, failing, and consequently
> setting the device readonly. By OS, I really mean DEs, or
> automounters in general.
> 
> You could also try zeroing it in another machine, ± any adapters
> required. (Bear in mind that adapters do have readonly sliders.)

I suspect this is the crux of the problem.  the adapter I
connected is a card reader.  You put the SSD in a little plastic
jacket that holds the SSD in such a way that the card reader can
access the edge connector but the holder jacket has no electronics.
There is a small notch in the plastic of the jacket on the left
edge and the right front corner of the plastic carrier has a
diagonal cut to prevent someone from putting it in upsidedown.

Since I posted, there is good news but I still wonder if
I am not going bonkers because after unplugging the Sony card reader
and plugging it back in, I now am getting device /dev/sdg instead
of /dev/sdh.  I was also able to do the following:

#sudo fdisk /dev/sdg

which gave me the fdisk utility as before so I did what crazy
people do which is to do the same thing as before, hoping for
different results.

By Joe, I got them.

I typed d to delete a partition and it put partition 2 up as the
default candidate as before so I selected it and then typed d
again which told me that only partition 1 was left so it was
deleted.

I had gotten this far before so wasn't too excited but type
w and this time got the message stating that the partition table
had been rewritten and fdisk then exited.

Now, doing sudo fdisk -l /dev/sdg yields

1wb5agz martin tmp $ sudo fdisk -l /dev/sdg
Disk /dev/sdg: 28.8 GiB, 30908350464 bytes, 60367872 sectors
Disk model: USB   HS-SD Card
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x680226ff

The partitions are gone.  My latest screwball theory is
that the Sony card reader went in to some sort of protective mode
after the dd operation overwrote the device.  My unplugging the
reader and plugging it back in reran the driver which reset the
protective mode back to normal which may be why it all worked
right this time.

One last question:  Since the image will still be too
large as it is, can tunefs be run on it or a copy of it to shrink
about 4 gb of user space?  The good system I copied the image
from only had about 12%  of the partition used so I should be
able to transplant it to the smaller disk if tunefs can do that
and still leave a bootable device.

Thanks for all useful ideas.

Martin McCormick



Re: SSD Memory Card (was The Raspberry Pi that Took a Day Off.)

2022-01-27 Thread Martin McCormick
Bijan Soleymani  writes:
> Can you delete both partitions, create a new single linux partition, 
> reboot
> then run mkfs.ext4 to create a single new partition and then just install
> linux onto it or try dd again?

Great suggestions but I can't.  Part of the typescript output I
included was me doing just that and I was root when I did it but
the squawk is that I don't have permission as if I wasn't root.

If writing to the SSD card was possible, I could have
just done the dd command, only with a smaller input image and it
would have worked.

Thank you because what you suggest would be the normal way out.
Martin

Martin



Re: SSD Memory Card (was The Raspberry Pi that Took a Day Off.)

2022-01-27 Thread Martin McCormick
Charles Curley  writes:
> I'm no expert on RPis, but that sounds to me like the SD card is
> protected against writes. Check for any physical write protection
> switches on the card itself and the holder.

Thanks for the suggestion, but this is one of those SSD cards
that often is found in a camera and resembles a wafer the size of
a thumbnail.  It has a projection that acts as a key way to keep
a user from inserting it in the wrong way and there is a groove
for a fingernail to help pull the chip out of the socket.  This
particular one was reading and writing just fine until I bricked
it by the DD that must have overwritten some address which now
makes it unwritable.  It went from good to bad without my
removing it from the card reader so there should be some way to
at least clear it for writing again.

Apparently, it stops being writable if the partition
table is corrupted.  In my case, I just want to delete both
partitions and start over.

The OS is debian Buster and has all the tools you can
expect to find and runs on a 64-bit ARM.  Otherwise, it's pure
debian Linux.

Martin



SSD Memory Card (was The Raspberry Pi that Took a Day Off.)

2022-01-27 Thread Martin McCormick
I thanked the person who responded to my post and reported that
there were no unusual log entries in syslog on the failing system
so not much to go on.  I decided to upgrade the Raspberry Pi
which was suddenly having this mysterious problem as I have
backups of the failing system so I figured I'd just clone a
buster image from another Raspberry Pi that is running buster and
use dd to copy it to the Raspberry Pi which was running stretch
and having that weird problem.

Then, assuming the upgraded Pi was alive, I could use the
backup from the stretch system to put all the user space from my
old home directory on the new buster system but I messed up
again.  The SSD card from the older system is 28 GB and the
working buster system's SSD card is 32 GB so the smaller card
filled up and I achieved that "no space left on device" state
that we all love to see.

Simple, I thought.  I'll just delete all partitions, and
do the dd if=rpi_good.img of=/dev/sdh which is where this card shows
up when it is in the reader and I can maybe dd a smaller 8.5-gb
drive which I have that has almost never been used.

Murphy has struck again.  Here is what happens when I try
to use that 28-gb SSD card:  Script dump follows

Script started on 2022-01-26 20:03:52-06:00 [TERM="Linux" TTY="/dev/pts/3" 
COLUMNS="80" LINES="25"]
1wb5agz martin tmp $ sudo su -
[sudo] password for martin: 
root@wb5agz:~# fdisk -l /dev/sdh
/dev/sdh: 28.8 GiB, 30908350464 bytes, 60367872 sectors
Disk model: USB   HS-SD Card
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x680226ff

Device Boot  Start  End  Sectors 
 Size Id Type
/dev/sdh1 8192   137215   129024   63M  c W95 FAT32 (LBA)
/dev/sdh2   137216 62333951 62196736 29.7G 83 Linux
root@wb5agz:~# fdisk /dev/sdh
Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdh: 28.8 GiB, 30908350464 bytes, 60367872 sectors
Disk model: USB   HS-SD Card
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x680226ff

/dev/sdh1 8192   137215   129024   63M  c W95 FAT32 (LBA)
/dev/sdh2   137216 62333951 62196736 29.7G 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 

Partition 2 has been deleted.

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): w
fdisk: failed to write disklabel: Operation not permitted
root@wb5agz:~# logout
2wb5agz martin tmp $ exit

Script done on 2022-01-26 20:07:59-06:00 [COMMAND_EXIT_CODE="1"]

So close and yet so far away.  If I try to use dd on
/dev/sdh again, I get:

1wb5agz martin tmp $ sudo dd if=~/rpi/rpi2_good.img of=/dev/sdh
[sudo] password for martin: 
dd: writing to '/dev/sdh': Operation not permitted
1+0 records in
0+0 records out
0 bytes copied, 0.021666 s, 0.0 kB/s
2wb5agz martin tmp $ exit

I've had usb thumb drives fail when filled to capacity
and, if I hadn't been tired, I would have noticed that the image
was 4 gb too large so this wouldn't have happened but surely,
there is some way to at least zero out everything so the SSD can
be either reformatted or used as the output of an image transfer
using dd.

The SSD passed a fsck test earlier in the day before I
blew it up so the chip should be salvageable.  I don't care for
recovering either of the two partitions which will be overwritten
anyway if the SSD can be made writable again.

One can mount /dev/sdh1 which is the fat32 partition
but it mounts as read-only.  If you try /dev/sdh2, you get a
squawk that says that this partition is not in /etc/fstab which
is certainly true but it doesn't mount either so mount doesn't
understand what I was trying to do.  This is the partition that
got the overflow condition so it's utterly useless.

These last 2 days, I have been a day late, a Dollar short
and 1 step behind on what shouldn't be really that big of a problem.

Martin WB5AGZ



The Raspberry Pi that Took a Day Off.

2022-01-25 Thread Martin McCormick
This Pi is running Debian Stretch.  I believe that's what version
9 is called.  I have it capturing audio from a radio receiver and
it's been doing that for several years now and it was doing that
yesterday morning.  Later in the day, I downloaded more audio
and, after a long pause, I got the message from ssh that the
Raspberry Pi wasn't there any longer so I retrieved the Pi from
the room where it was and brought it to my Debian desktop system
to work on it.

I could login to the Pi which seemed to be up and running
but the short story is that it couldn't talk to any address but
our router.I couldn't even ping it's interface from the Pi,
itself.

If I was on the Raspberry Pi's console, everything looked
normal as long as one wasn't using the TCP/IP interface.  You
could even do a ip addr or an ipconfig -a command and it would
show that it had gotten the correct address from our dhcp server
which is in the router.  It would successfully ping the router
but no other addresses, not even the address it uses on our
network.

I finally quit messing with it and went to bed but fired
it up again today, January 25 and low and behold, it just came
right up and is now back doing what it has been doing.

Is it possible that it got a corrupted lease for dhcp
from the router?  Dhcp leases on our Netgear router are issued
for not quite 24 hours so it may have gotten a bad lease, kept
renewing it for the time it was powered up and then it got a new
version of that lease today and all is well.

It's the same IP address because I have put it in the
router as a static IP address.

The other thing that is weird is that the Raspberry Pi in
question has both a wired Ethernet and a WiFi interface and both
were misbehaving identically.

Normally, the wired port is not used and the dhcp lease
renewal process happens over WiFi.

The results of ip addr always showed a correct subnet
mask and the only rules in iptables are the 2 default rules.  In
other words, all looked normal except that it didn't work.

While I had it on the work bench, so to speak, I ran fsck
-fy on the SSD card since it has been a couple of years since I
last did that and there was not a single squawk about anything.

Thanks for any ideas about how things got wrong and then
magically fixed themselves.

When I turned it off last night, I gave it the halt -p
command.  The power supply has no switch so I unplugged it from
power so it started fresh about 8 hours later.

Martin WB5AGZ



Re: /usr/share/calendar.usholiday

2022-01-17 Thread Martin McCormick
deloptes  writes:
> And if you look into the file, you see it has no years associated with the
> date, so it doesn't matter when it was written unless there was a change 
> in
> the official holidays in the US.

Correct.  I see two types of date references, exact dates
such as Christmas and New-year's and rule-based dates which are
some designated day such as the second Monday in a given month,
what the British refer to as a "bank holiday."

My original question about this file has been answered in
a round-about way in that there are also two types of holidays.
St. Valentines day, for example, is not a postal or bank holiday
but one will certainly get in deep trouble on the home or
romantic front if that day is forgotten.

Also days like Arbor Day are a nice idea but nothing
about normal commerce or daily activities changes

I also noticed that today in the United States should be
marked but hasn't been yet.  It is the third Monday in January
which, since 1986 has been the official recognition of
the birthday of a US civil rights leader, Martin Luther King Jr.

The entry in that file probably should read:

01/MonThird Martin Luther King Birthday (3rd Monday of January)

It is now a major holiday and schools and government
offices are usually closed so it should probably be there.

Thanks to all and sorry if I created  any confusion about
the path.

Martin McCormick.



Re: /usr/share/calendar.usholiday

2022-01-17 Thread Martin McCormick
Greg Wooledge  writes:
> On Sun, Jan 16, 2022 at 09:58:11PM -0600, Martin McCormick wrote:
> > There's a stale version of this file on my system that reflects
> > when Debian was installed but it brings a question to mind.
> 
> The one in the Subject: header?  Are you sure that's the correct
> path for this file?

I goofed.  I thought I could remember it long enough but
it is actually


/usr/share/calendar/calendar.usholiday

I also still had an old directory tree from when I had
wheezy on the system and there is

/home/wheezy/usr/share/calendar/calendar.usholiday

> 
> On Debian 11, I have the file /usr/share/calendar/calendar.usholiday

I am presently running

Debian GNU/Linux 10 as in Buster.
---


> which is a different path from the one you showed.

That was just a mistake on my part.  Sorry to add more confusion.

This also reminds me to get rid of the old wheezy files
since I now don't even remember why I saved them but they are
getting backed up nightly for no reason at all other than they
get caught up in the sweep.

Martin



/usr/share/calendar.usholiday

2022-01-16 Thread Martin McCormick
There's a stale version of this file on my system that reflects
when Debian was installed but it brings a question to mind.

Does this file simply cause messages to appear on an
event calendar or can it be used along with crontab in some way
to either cause or prevent cron jobs from running if a date
matches one of the dates in the file?

I use cron and at jobs all the time and have thought that
it would be nice to skip some jobs if the day is a holiday and
the result might be not what one wanted.

Right now, I don't think this file is doing a thing as it
is for 2017 but this is why I am asking.

I also saw versions of that file for other countries such
as the UK.

Thanks for all good responses.

Martin McCormick



Curious Question about an Extra MAC Address

2021-10-26 Thread Martin McCormick
I was inventorying all the systems on our WiFi and wired network
so I did the following:

   sudo nmap -sn 192.168.1.0/24 followed by
  sudo arp -a and I found nothing extraordinary so I also got on
our Netgear router and told it to cough up a list of attached
devices, showing the same list of stuff that the first two sweeps
found.  Additionally, there was 1 mac address with no other
information such as an IP address or system name, just that MAC
on a row all by itself.

I had been looking for our DVD player which has the
ability to view streamed movies and I think this might be it.

As a computer user who is blind, I don't directly use
this player but my wife does.  We usually play DVD's from it
however she did use it once to watch a movie off the network and
it worked fine.

I asked her if she remembered giving our WiFi password
and she said no but was given a message to go to a certain url to
authorize payment in order to watch the film and it all worked
down to the monetary slurp so this is not a complaint or gripe
about anything.

My question is, did the link she went to on the computer
or maybe her iPhone use javascript to get our WiFi password and
if so, how did the player get the authorization to use our WiFi?

The stray MAC showing up on the router is probably the
player broadcasting an attempt to get in the network but to do
so, it has to send the password in order to get a DHCP lease
which would then allow it to get on the internet.

I am just curious about how did this work and could a
person cause it to log on to our WiFi network and receive a video
stored on a system here?

I'm not trying to rip anybody off but it's good to
know what extra features are under the hood.

What I am actually thinking of is more like a DVR where a
computer can record a TV show like the old-school VCR's and then
one could play it back through the DVD player on the network.

This player can also update it's firmware when necessary
and we've never been prompted from it for a WiFi password.  It
just seems to be able to get through when it needs to.

I guess this could also be a neighbor trying to mooch
WiFi, but I doubt it.  Everything with an IP address belongs to
us and there are no odd amounts of data coarsing through our
router that aren't caused by us.

This is a neighborhood in a college town so one must be
careful but not too paranoid.

Thanks for any good ideas.

Martin



Re: eMail Com Between Hosts on a Private Net

2021-10-22 Thread Martin McCormick
One more question I should know the answer to but am not sure of.
The debian Buster system I use for email presently uses fetchmail
to get mail from the ISP and is configured to use that ISP's
smarthost for out-going mail.  I do not want to  effect
(= muck this up) this  functionality because  it works well for
now.

Shouldn't I be able to install an imap server on the
debian box and forward messages of interest to it, then reach
imap4 on the private net from any system that speaks imap or has
an imap client?

That would do what I need to do.

When I was researching, the article in wikipedia I read
said that many commercial systems have email clients which
understand imap, pop3, etc.  The systems likely to do this on our
network are a windows10 box, an iMac and maybe an iPad.  The idea
would be to forward an email message needing this attention to
imap on the linux box, contact the Linux box from one of the
devices I mentioned, and download the message at which point it
would e as if that system had been hooked up to the ISP and
received it.

I was all ready to use .local as our domain name and then
I looked that up and there is a good wikipedia article which
explains how that is problematic and recommends using something
like .lan, .office or something else that isn't likely to be
registered as a top-level resolvable domain name.

The machine I receive email on presently would be a good
candidate for running a mdns but our netgear router advertises
whatever dns's the isp uses for obvious reasons and that's fine
but it would be nice if the mdns's address could also be known to clients
on our network which could make DNS queries to each other's names
that would resolve properly.

Is there a way to advertise the mdns so that the router
picks it up but doesn't drop the internet DNS's that we all need
to resolve the rest of the world?

I do remember when I was working, we explored open-source
network authentication systems which involved fake DNS's that one
had to advertise as such so their information wouldn't corrupt
the proper working DNS's which could really mess things up if
somebody happened to pickup and cache the wild card * that sent
all new supplicants to the authentication server after they were
already up and running.

In our case, the corruption would be okay and done for
good reasons but the dhcp server in our router  already advertises two
domain name servers so ours would have to be learned about by
discovery.

Thanks again.

Martin McCormick



Re: eMail Com Between Hosts on a Private Net

2021-10-20 Thread Martin McCormick
Joe  writes:
> Indeed so, it is even in a folder called 'etc', which I think is in a
> 'drivers' folder. It's a while since I used it. There may be an
> existing default or example \etc\hosts file. The LMHosts file is also
> here, but of interest only to Windows networks for speeding up share
> lookups.
> 
> --
> Joe
My thanks to all who replied and thanks for reminding me of some
of the considerations one needs to think of when setting this all
up since that's what I used to do as part of my job before
retiring in 2015.  As for there being 16 subnets in the
192.168.x.x number space, one can use variable-width subnet masks
so unless you have a lot of hosts or, for some reason, are
sharing space with another subnet, one can spread out to a Class
B-style network which would be the whole space and have a subnet
mask of 255.255.0.0 or you can make lots of little subnets of
various mask sizes with blocks of 16 addresses being about the
smallest subnet that is practical.  Remember you always lose the
all-zeros and all-ones broadcast addresses because they are
special plus there is likely a router address taken by the router
which leaves 13 addresses for hosts in each subnet.

I remember early in the nineties our campus went from a
single Class C to a Class B network and the whole campus used the
Class B subnet mask with bridges holding the whole thing
together.  You should have seen some of the arp storms that would
blow up like wild fire when somebody had a misconfigured host
trying to be helpful or maybe deliberately misconfigured because
somebody got their socks in a wad over something and started the
fire on purpose.

It wasn't long before we began more efficiently using the
number space with big departments getting let's say 1024 or 512
possible addresses and others getting 16 or 32 addresses.

By the time I left, we were using the huge private
network space of 10.0.0.0 with aNAT or Network Address
Translation to parts of the old Class B network and it generally
worked well.

I wrote a C then a perl program which would assign IP
addresses for hosts on our networks that knew the sizes of all
the subnet masks so assigning IP addresses was something anybody
in our group could do without much more information other than
what host name the customer wanted and what building it was in.
My job was basically to encode all that in to rules for
automation to keep us safe from making mistakes and it worked.

Martin



eMail Com Between Hosts on a Private Net

2021-10-20 Thread Martin McCormick
The installation, here, is like millions of others.  We are on a
private VLAN with the router acting as the gateway to our ISP's
network and the internet.  There is nothing unusual about that so
the question is Can systems on a 192.168.x VLAN use smtp to send
mail to each other?

I really should know the answer to this because I am a
retired systems engineer who used unix systems and mailers all
the time but that was in a university network and I would just
assign a DNS name to each box and maybe a MX record if it was
necessary so that box1.midlevel.edu could deliver mail to
box2.midlevel.edu whether it was across the room or on another
continent.

The DNS support is what you don't have on a private VLAN
so I want to do this in a safe but simple way.

This would make it possible for Linux boxes on the
network to send messages to the system I normally receive mail on
so that squawks about a process crashing or some other problem
are sure to be seen.

The other systems sending those messages don't even
necessarily need to send mail outside the network but they do
need to send mail to the system I normally read mail on.

I looked up this topic using duckduckgo and found very
little hits that were on topic and lots of mercantile buzz about
email hosting companies, etc.  All are necessary but not what I
was asking about.

I have put static IP records in to the dhcp server on our
router so 192.168.1.xx will always either have a specific host at
that address or nothing if the MAC address changes and the record
hasn't been updated.

Also, I have put /etc/hosts files on Linux systems and a
Mac and I believe there is a hosts file one can add to Windows
systems for a similar effect.

Thanks for any good ideas.

Martin McCormick



Re: Proprietary USB Drivers; Ya Gotta' Love'em.

2021-09-25 Thread Martin McCormick
So, what is the easiest route to end up with a kernel that has
this patch in it?

The image for the current kernel is
4.19.0-5-686-pae

The Raspberry Pi is an arm-based system and the image
version number is probably different but the idea is the same,
have a kernel that doesn't choke when one is using the ICR-30
usbC port.

To put it bluntly, this is an area of Linux I have very
little familiarity with because generally, Linux kernels just
work so this is a left-handed complement in that I think this is
the first kernel bug that I have encountered ever.

I am sure I have run kernels with other bugs that I
didn't know about but this is the first time one has bitten me,
so to speak.

Thanks.


Martin WB5AGZ
Martin McCormick  WB5AGZ



Re: Proprietary USB Drivers; Ya Gotta' Love'em.

2021-09-25 Thread Martin McCormick
Gene Heskett  writes:
> You forgot to mention it can get the message thru better because it has a
> 12 db advantage over competing noise compared to the original AM,
> sometimes called Ancient Mary in our circles.

I did forget that but you are correct.  another
interesting thing about ssb which includes both sidebands is that
it was first tried during the 1930's as a concept and had to wait
until after World War II before amateur radio operators, the
millitary and commercial folks began using it routinely.  To not
stray too far from the group purpose, the usb dongles that give
you a wide coverage receiver from 26 to almost 1000 MHZ use
basically math to decode sideband, AM, FM and data using DSP
techniques.

Martin



Re: Proprietary USB Drivers; Ya Gotta' Love'em.

2021-09-25 Thread Martin McCormick
Charles Curley  writes:
> Possibly a known kernel bug.
> 
> https://forums.opensuse.org/showthread.php/538695-USB-driver-Zero-Length-Descriptor
> 
> https://lore.kernel.org/lkml/1507709452-31260-1-git-send-email-msa...@iotecha.com/
> 
> --
> Does anybody read signatures any more?
> 
> https://charlescurley.com
> https://charlescurley.com/blog/

Thank you.  That's got to be it.  I've been doing debian Linux since
right around 2000 but I must admit that I don't know the easiest
way to include the patch referenced in the second link.

I will need to do that on an i86 box plus the Raspberry Pi
I first discovered the issue on since I am apt to have the radio
connected to either system and, if this problem is fixable, this
solution is preferable because the radio defaults to using the
usbC port as the serial port so it should still work if a full
reset is ever needed and the mechanism for usb should naturally
accept as many different devices as practical because you never
know what you will need to connect until you try it and it fails.

As an amusing aside, the radio has a usb mode, but
that's totally unrelated because in that case, USB stands for
upper side band and is a very energy-efficient method of radio
communication because it is only a spectrum of frequencies
consisting of the sidebands of an audio signal without the
carrier.  It can be LSB or lower side band or USB for upper side
band.  Nothing like a few new acronyms for your day. I guess that's TMI.

Martin McCormick WB5AGZ



Proprietary USB Drivers; Ya Gotta' Love'em.

2021-09-25 Thread Martin McCormick
This is an embedded usb serial port in a radio receiver which
works in MS Windows10 and I was hoping to write some control
routines for a Raspberry Pi running buster and it does the
following:

Sep 22 20:17:15 rpi2 kernel: [551843.541477] usb 1-1.2: new full-speed USB 
device number 6 using dwc_otg
Sep 22 20:17:16 rpi2 kernel: [551843.674681] usb 1-1.2: not running at top 
speed; connect to a high speed hub
Sep 22 20:17:16 rpi2 kernel: [551843.684432] usb 1-1.2: New USB device found, 
idVendor=0c26, idProduct=002b
Sep 22 20:17:16 rpi2 kernel: [551843.68] usb 1-1.2: New USB device strings: 
Mfr=1, Product=2, SerialNumber=3
Sep 22 20:17:16 rpi2 kernel: [551843.684452] usb 1-1.2: Product: IC-R30
Sep 22 20:17:16 rpi2 kernel: [551843.684460] usb 1-1.2: Manufacturer: Icom Inc.
Sep 22 20:17:16 rpi2 kernel: [551843.684468] usb 1-1.2: SerialNumber: IC-R30 
16002557
Sep 22 20:17:16 rpi2 kernel: [551843.727911] cdc_acm 1-1.2:1.0: Zero length 
descriptor references
Sep 22 20:17:16 rpi2 kernel: [551843.727940] cdc_acm: probe of 1-1.2:1.0 failed 
with error -22
Sep 22 20:17:16 rpi2 kernel: [551843.728056] usbcore: registered new interface 
driver cdc_acm
Sep 22 20:17:16 rpi2 kernel: [551843.728061] cdc_acm: USB Abstract Control 
Model driver for USB modems and ISDN adapters
Sep 22 20:21:11 rpi2 kernel: [552078.765119] usb 1-1.2: USB disconnect, device 
number 6

So much for that.  There is one other possibility.  It is
possible that one can go to one of the menu options and flip a
virtual switch that will take the serial data that should have
been on /dev/ttyACMx and put them on a logic-level serial line
that is accessible through the right stereo channel of a
3-conductor jack.  Whether or not that works is beyond the scope
of this list so my question is whether or not there is a wrapper
program of some kind in Linux that can fool an application like
the serial port module that tried to run here in to thinking that
it is home and among friends when it's really been kidnapped.

The possible use of a logic-level serial line is probably
what I will need to do but that means that if one resets the radio to
factory defaults, one will have to go in to the menus on
the radio's screen and restore the virtual switch setting.

As a computer user who happens to be blind, that's a major pain as
well as in a case where the radio is remotely located and one is
operating it headlessly.

I smiled a bit when reading the syslog admonition to
connect to a high-speed hub.  That would be quite a trick.

Thanks for any constructive suggestions.

Martin McCormick WB5AGZ



Re: Swiss Army Knife of Sound has me Baffled.

2021-08-19 Thread Martin McCormick
Dan Ritter  writes:
> > arecord: set_params:1345: Channels count non available
> > sox FAIL formats: can't open input  `-': WAVE: RIFF header not found
> 
> Keep recording 2 channels. Your hardware doesn't like it
> otherwise.
> 
> You can ask sox:
> 
> sox -t wav -c1 - -r44100 $filename
> 
> to merge the channels to a single output channel
> 
> I believe, but have not tested, that a final argument to sox of
> 
> remix 1
> 
> will get you just the left channel, or remix 2 for the right
> channel.
> 
> -dsr-

I haven't tried anything new yet but that sure looks right and
will probably work.

Thanks to all who responded.  This is what I like about
this list as it presently exists.  I had figured out that the
problem was  with the hardware which is a fairly decent device
but severely limited in Linux because a lot of it's power comes
from a proprietary driver like a number of other devices such as
winmodems, etc.  Then I read this:

Nicolas George  writes:
> If you read carefully, you will notice that your problem is not with
> sox, it is with arecord: sox only fails because arecord fails and does
> not produce anything.
> 
> arecord itself fails because "channels count not available": the sound
> device you are using does not like mono, it obviously like only stereo.
> 
> You have two options:
> 
> - Use a sound device that supports mono. Since you cannot change your
>   hardware, it needs to be done in software with an ALSA plugin. This is
>   all streamlined, you only need to write plughw instead of hw.
> 
> - Keep recording in stereo, and have sox convert it to mono before
>   saving. You will need to peruse the manual page of sox to know the
>   option, I only ever use ffmpeg for obvious reasons.
> 
> Note that:
> 
> - If you use plughw instead of hw, then the ALSA plugin can also
>   resample, and therefore you no longer needs sox at all.
> 
> - sox is capable of recording from ALSA directly, with something like
>   "-t alsa plughw:0".
> 
> Regards,

I actually did get a message from arecord about using a plugin
and you  have answered the question as to what needs to be done
to make that happen.  I had not even thought of the plugin
solution so this is a whole new possible route to success which I didn't even
think of before.

David Wright  also writes:
> Try -r 8000, or leave out -r and -c entirely, and you should
> succeed. But I doubt that's really your priority, is it?
> 
> > […] and I
> > guess I could leave it in stereo mode and tell sox to mix the
> > left and right channels which is fine with me but kind of clunky.
> 
> That's why it's the "Swiss Army knife". After mixing the two channels,
> you can write to a single-channel WAV file.
> 
> What you can't do is tell /arecord/ to use an ADC that doesn't exist.
> 
> Cheers,
> David.

    I am in no great hurry so I will probably try both the
plugin solution and the sox coding and save them both for later
as the idea is to end up with something that is both efficient and
useful.

Thanks, everybody.

Martin McCormick   WB5AGZ



Swiss Army Knife of Sound has me Baffled.

2021-08-18 Thread Martin McCormick
I have a little shell script called fullstereo which works fine.
It's short so I'll show it to you.  It records sound from a
Creative Labs usb sound card which is probably much happier on a
Windows box but that's not where I need it.  It has only 1
sampling rate that works under debian and that is 48 KHZ.  I want
44.1 KHZ and I get 2 good stereo channels with the following script:

#! /bin/sh
cd ~/tmp
filename=$1.wav
echo $filename
arecord -D hw:1,0 -r 48000 -d $2 -c 2 -f S16_LE - \
| sox -t wav - -r44100 $filename

$2 is a value in seconds, minutes or hours and it goes
like a house on fire with no problem.

So, I want a mono version.  Let's try this:

#! /bin/sh
cd ~/tmp
filename=$1.wav
echo $filename
arecord -D hw:1,0 -r 48000 -d $2 -c 1 -f S16_LE - \
| sox -t wav - -r44100 $filename

This hasn't worked yet.  It is identical to the good version but
for c 1 as the number of channels to arecord instead of c 2 .

When running that script, this is what happens:

$ ./highmono testsound 30
testsound.wav
Recording WAVE '-' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

#Good so far and then

arecord: set_params:1345: Channels count non available
sox FAIL formats: can't open input  `-': WAVE: RIFF header not found

Darn!  A couple of microseconds before that, the same process
understood what I asked it to do.  When the -c parameter was set
to 2, it understood what to do with the standard output but with
c set to 1, it did what you see above.

I can't seem to figure out why 1 channel output is any
different from 2 channel except that the wav header should be
pretty much the same with a channel count of 1 instead of 2.

The man page for arecord even says the following:

   -c, --channels=#
  The number of channels.  The default is one channel.  Valid val‐
  ues are 1 through 32.  Theoretically, one could
leave out -c 1 and it should go ahead as if that flag was
actually there but it breaks instead.  This might also be because
one can not set any parameters without the Windows driver and I
guess I could leave it in stereo mode and tell sox to mix the
left and right channels which is fine with me but kind of clunky.

I am asking the list's wisdom in case there is a better
way to produce the mono channel.

Thanks.

Martin WB5AGZ



Grub Success at Last

2021-06-08 Thread Martin McCormick
I did it!  It works!

Okay.  Here's the short story.  I read some more stuff
about building a boot drive for another system than the one being
used for the rescue.  In this thread were the usual tales of woe
which I have also experienced when misusing grub such as "Oh
#%^*! Now I've got 2 systems that won't boot."  a poster on that
thread states:

   I'm not a grub2 expert (sorry) but try adding --skip-fs-probe to your
   grub-install line, I have found this prevents creation of
   /boot/grub/device.map which can cause booting to a grub prompt. I think
   that without this parameter grub-install, instead of doing what you
   tell it, thinks it is cleverer than you, and may do something
   different.

   Another thing is to be sure you are using the right grub-install (i.e.
   for grub2 and not for original grub). This isn't a problem if you are
   inside Centos but with SystemRecoveryCD both versions are available and
   so you have to use grub2-install. I learned the hard way...

   And as @wurtel pointed out (kudos), you should specify a drive not a
   partition. Grub2 installs in sector 0 of the whole disk drive, and this
   'stub' is what runs at boot time, but it needs to know whereabouts on
   the disk it should install the files for the next stage of booting -
   this is what the --root-directory parameter is for. (I think.)

   Reading man grub-install and googling I see that --root-directory is
   not really meant to be used for grub2 versions 1.99++, though it does
   work in my experience. You are meant to use --boot-directory and refer
   to the actual boot directory, so this would give you:
grub-install /dev/sdb --skip-fs-probe --boot-directory=/media/new_drive/boot

End of quote

I did the following:

#!/bin/sh
#mount the drive being repaired.  Uncomment lines as needed.
  sudo mount /dev/sdd1 /mnt
cd /mnt/boot
#installing to the mounted disk
  sudo grub-install \
--skip-fs-probe \
--boot-directory=/mnt/boot/ /dev/sdd

When you boot your disk that starts out on /dev/sda1,
it's the first partition, in this case, so it will be /dev/sda1
not /dev/sdd1 .  This was quite a long thread and people were
remarking on how it is easy to get confused and do the wrong
thing.

Anyway, It booted right up and then I discovered there
was no network.

The network issue was only tangentially related because
the update-upgrade process also install some more strict and
modified ethernet interface naming rules and eth2 just doesn't
cut it any more.  Now, it's enp0s17 on the system that just got
revived and enp0s18 or something similar on the system that got
the same upgrades but is a little newer and took the tharapy much
easier.  Everything's working again at least in the Linux world.

I saw this ad on TV for some product that is supposed to
improve brain function and memory but I can never remember it's
name.  I could use a few more IQ points and things would flow a
little faster around here.

Thanks for all the help, everybody.

Martin



Re: A Grub Boot Question about initrd

2021-06-07 Thread Martin McCormick
Felix Miata  writes:
> This is a big lurking booby trap that could have been the problem both 
> last time
> and this time. It's one of the reasons why installation systems and Grub 
> switched
> from using device names to using UUIDs: inconsistent and/or unpredicable 
> device
> enumeration.
> 
> Is this a PC with both PATA and SATA controllers? These old PCs can 
> compound the
> issue.
> 
> Different kernel, disk controller, USB controller and BIOS combinations 
> can cause
> e.g. an SATA or PATA disk sda to become sde, or sdb become sda, IOW, 
> device names
> that don't persist. UUIDs are supposed to prevent inconsistent device 
> names from
> being a problem, but in a rescue environment, it can muddy the waters, or 
> backfire.

Yes on all counts.  These are old PC's that use IDE
controllers.  The IDE cables end in the normal 34-conductor
header with one pin missing on one side that plugs directly in to
the drive.  In this case, the connector plugs in to a SATA-to-IDE
converter with a female SATA connector.

I believe you have hit the nail on the head because I
know for a fact that the devices change names.  On the working
system, the boot device we would normally think of as /dev/sda is
/dev/sdc and 5 minutes from now might be /dev/sdq depending on
what drives were plugged in to usb ports when the system booted.

Just yesterday, I mounted /dev/sdd, thinking it was the
now infamous unbootable drive and immediately realized that I was
looking at the boot drive that starts the good system.  I had
plugged a thumb drive in to a usb port some time earlier and then
rebooted the system while failing to remove the thumb drive as it
wasn't even being used right then.

Let's see.  $ dd if=/dev/sdd of=/dev/sde  What could
possibly go wrong?  Just kidding this time but that's what we are
dealing with.  That possibly lethal command can work but only
under the right circumstances so if one forgot to recreate the
world one was working with, it's tuition in the school of hard
knocks.  I haven't yet totally given up and done anything else
rash so it's still full steam ahead.  This is one of those
situations where if a person has the time, this can be a
teachable moment.

I've got several thumb drives that I mount based on their
UUID and that method of doing things is your friend if you
understand how to use it.  If not, what one ends up with is total
chaos.

Felix's message hasn't saved the day yet but it confirms
my hunch that the UUID's have been at the heart of this problem
all along because there is simply no other logical reason why one
can not transplant the same boot logic from one system to the
other when they are functional copies of each other.  The trick
will be to replace every UUID personalization which is doable.
Whether it is practical still remains to be seen.

To briefly reference an earlier message, I checked the
good system to see what rsnapshot did over night and /boot is
now committed to a series of little capacitors which is how SSD's
remember things.  From fstab:

# /etc/fstab: static file system information.
UUID="49c4eda8-3bcc-445e-841b-513b07d560fe" /var/cache/rsnapshot ext4 
relatime,rw,user,noauto  0   0

If that drive wasn't always plugged in, the boot drive
would have a different device number than /dev/sdc1 which is also
mounted by UUID.  That drive also plugs directly in to a usb slot
and not any extender to hopefully insure that it is more likely
to be present.

I will uncompress the initrd files and see how hard it
will be to find the UUID and change it to what it should be on
the problem target system.

Again, thanks to all.

Martin   WB5AGZ



Re: A Grub Boot Question about initrd

2021-06-06 Thread Martin McCormick
I admit I made several big mistakes, here.  The first was not
having a backup of /boot as I thought I did.  The next is
thinking I could just copy the whole boot directory from a
known working system and be able to get it to work by using sed to
replace the UUID's of the system it was on with those of the
system it will be on.  Had I backed up the broken system instead
the minute I knew there was a problem, it would have been
fixable.

Trying to transplant the good boot system to a different
machine really should work if one knows what all changed but if
that was the case, I'd be crowing about how I got it working.

I may try one last thing which is to decompress the initrd
files and see if there is a way to make sure they work after
transplantation.  At this point, it's probably more important to
know what is poisoning the well as a training exercise since
having good backups of /boot would have turned a major halt in
to a minor irritation.  Trust me.  The good system is going to
get daily backups of boot and grub every 24 hours from this day
on.

I haven't actually done anything yet to clone the good
system's boot drive because I want to do the clone in the middle
of the night when things are quieter and I don't run fetchmail
in the wee hours so the backup sees a more stable file system.

If, by chance, I end up actually making the broken system
work, I'll let you know what it was and the one drive can serve
the whole system again.

Martin



Re: A Grub Boot Question about initrd

2021-06-06 Thread Martin McCormick
Felix Miata  writes:
> IMO you gave up too soon. IIRC you never showed us output from parted -l 
> or fdisk
> -l. Very likely on the problem PC the / filesystem was/is not on the first
> partition, where often lies a swap partition. Very likely root=/dev/sda2 
> would
> have been/be correct.

Sorry.  I meant to do that.

Swap is the last partition.

Disk /dev/sde: 29.8 GiB, 32017047552 bytes, 62533296 sectors
Disk model: 600 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0080

Device BootStart  End  Sectors  Size Id Type
/dev/sde1   2048 59314876 59312829 28.3G 83 Linux
/dev/sde2   59314877 62533295  3218419  1.5G  5 Extended
/dev/sde5   59316925 62533295  3216371  1.5G 82 Linux swap / Solaris

$ ls -1 /mnt/

bin
boot
dev
etc
home
initrd.img
initrd.img.old
lib
lost+found
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
vmlinuz
vmlinuz.old



Re: A Grub Boot Question about initrd

2021-06-06 Thread Martin McCormick
Thanks to all for the advice and knowledge you shared about how
grub works.  I am writing this on June 6 and early this morning,
I  edited the boot command in the grub shell after
verifying that my stubborn no-boot drive truly was sitting at
hd0,1msdos and grub-install had picked out hd2,1msdos for every
single drive reference, even the bare metal one.

I did try that one first in case I was missing some magic
but the only drive on the whole system was that one and listing
the contents of (hd0,1msdos) show exactly what you see if looking
at / so grub showed it exactly where one would expect it to be
and hd2,msdos is pure science fiction on that system so I set
every drive reference to hd0,1msdos except the root which grub
wanted to set to /dev/sdc1.

The sample that Greg Wooledge showed looked very close to
how my grub.cfg looked after doctoring the drive references to
point to hd0,1msdos.  and I tried booting that way and set the
root parameter to /dev/sda1, /dev/sdb1 and /dev/sdc1 which is the
one that grub chose, again non-existent.  /dev/sdb1 is actually a
Zipdisk drive but I tried it anyway since there is no zipdisk in
there.

It never booted so I am throwing in the towel, figuring
that in all the messing around, I have corrupted something and
wasted about two weeks on and off trying this, that and the other.

I have a good 32 GB drive left over from a computer that
died last year so I will just clone it from the working system
that is sending this email.  The drive that can't boot but is
otherwise fine will now be the second drive and will mount as
/home where all the important stuff I used it for can still live.

The only good thing about this exercise is that I know a
lot more about what grub does than I did and I also discovered
that while I had perfect backups of the home directory, I had
failed to set rsnapshot to backup /boot which was quite a stupid
oversight on my part.  /var, /etc and several other directories off of
/ get daily backups and I could have sworn /boot did but it's not
there so I have been doing a lot of industrial-grade swearing
lately.

Grub is a very fine tool when used properly and I do
believe that there should be a pristine way to make a disk
bootable that is intuitive and automatic plus unaffected by the
configuration of any other drive on the system, like the old sys
command in DOS to make any DOS diskette bootable.

The unix incarnation of the sys command would have to do
a lot more such as verify that you have a kernel and modules
ready to go plus consult your /etc/fstab and /etc/default/grub
files but that shouldn't be a real problem.  One would basically
do the grub install in a a total jail so it would come out set as
if one had just been running the installer and this was the only
drive on the system.

Thank you all for your help and sorry that it took so
long to determine that nothing simple was going to work.

Martin



Re: A Grub Boot Question about initrd

2021-06-05 Thread Martin McCormick
First I greatly appreciate all this information as the idea is to
fix a problem I probably created long ago though I am not sure
how but the short story is that apt-get upgrade ran update-grub
and update-initramfs late last Fall and I was able to rescue it
but it happened again at the end of April so I figured I had
better fix it correctly since I didn't know it was a ticking
bomb.

Felix Miata  writes:
> Martin McCormick composed on 2021-06-05 12:46 (UTC-0500):
> 
> > I have a plan but I need some more information.  Is there any
> > personalization done by the boot setup process?  Do our UUID's
> > or any other specific information pertaining to the installation
> > make it in to the initrd files?
> 
> Dracut includes a root=UUID= statement in the initrd. A root= 
> statement on
> the Grub linu* line overrides it. The override can be any of the accepted 
> forms,
> including root=LABEL= and root=.

Good to know.

> The translation is easy. UUIDs are assigned to devices. The device names 
> are
> acceptable substitutes, just as they used to be the only option before 
> libata made
> device names capable of playing musical chairs. If devices also have 
> labels,
> labels can be used instead of device names.

Very much like the reasoning behind udev which is a God-send if you
have multiple sound cards as one example.

> UUIDs were designed for computer scripts, not human brains. You'll need 
> to make a
> conversion, but instead of UUIDs, I highly recommend using labels when 
> you know
> device names will be different on the system migrated to. UUIDs are 
> appropriate
> too, just rather unwieldy unless scripted.

There's 1 UUID for the root file system in /boot/grub/grub.cfg
which is the file one must not normally edit by hand.  It 
reads

menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu 
--class os $menuentry_id_option 
'gnulinux-simple-658da8df-942e-4ad7-8c5b-695f2f2eb4ed' {

> Grub provides a shell. From the shell it's possible to boot using the 
> information
> you have. Instead of trying to figure it all out in advance, drop to the 
> shell and
> use the device names you know. It's really not hard if you have a copy of 
> a grub
> menu from the two PCs planted in your brain or on paper. Once you've 
> booted, it's
> easy to fix everything up by running grub-mkconfig, and if necessary,
> /etc/default/grub.
> 
> >   As an aside, one ought to be able to do something like
> > this.  It makes life a lot simpler.  Both systems are using the
> > same kernel and versions of the same processor the only real
> > differences are the UUID's.  The grub configurations of both are
> > the same down to the serial console.
> 
> Don't let the massive volume of data in grub.cfg mislead you. Its primary 
> job is
> to find and load a kernel and initrd. If you know where they are and 
> their names,
> none of the menu components or apparent search and identification bloat 
> are
> necessary. Before Grub2 you could simply tell Grub's shell the root 
> device, the
> kernel name (with associated parameters, most of which aren't actually 
> necessary),
> and the initrd name, then boot. With Grub2 you may need to precede the 
> root device
> name with loading a module or two or three, which you see in your copy of 
> a
> grub.cfg, then proceed with the important three. I do a lot of cloning, 
> so I've
> done it often.

Thanks again.  I was starting to get discouraged but I
will try using actual labels since I thought you really shouldn't
do that.

Martin



Re: A Grub Boot Question about initrd

2021-06-05 Thread Martin McCormick
Reco  writes:
> On Sat, Jun 05, 2021 at 12:46:13PM -0500, Martin McCormick wrote:
> > I have a plan but I need some more information.  Is there any
> > personalization done by the boot setup process?
> 
> Yes. One of the GRUB's tasks is to supply kernel which is about to boot
> with root=... cmdline parameter. Root filesystem UUID can be used for
> this.
> 
> 
> > Do our UUID's or any other specific information pertaining to the
> > installation make it in to the initrd files?
> 
> In Debian - no, unless you include it there for some bizarre reason.
> It's not needed for the things initrd usually does.
> 
> 
> >   If that is so, then two computers using the same
> > processor type should be able to use copies of the same initrd files
> > and the only thing that is personalized on an individual computer
> > is all the grub configuration in which the UUID's of at least /
> > and /swap partitions are sprinkled throughout grub.cfg and
> > /etc/default/grub.
> 
> It's not the CPU difference you need to worry about.
> Different SATA controllers, video cards, NICs - i.e. what they call
> periphery devices - those things require different kernel modules that
> should be (or could be) used in early boot process, and therefore need
> to be included in initrd.
> 
> Luckily, Debian uses initramfs-tools for building initrd, and
> initramfs-tools should build initrd with everything and a kitchen sink
> included (MODULES=most in /etc/initramfs-tools/initramfs.conf).
> 
> 
> >   One should be able to write a program to get the
> > appropriate UUID's out of fstab on the working system
> > and translate them in to corresponding UUID's for the system on
> > the operating table.
> 
> Er, they've invented filesystem labels for exactly this many decades
> ago.
> 
> 
> >   As an aside, one ought to be able to do something like
> > this.  It makes life a lot simpler.  Both systems are using the
> > same kernel and versions of the same processor the only real
> > differences are the UUID's.
> 
> Perfectly possible for the last 15 years or so. Assuming Debian and
> MODULES=most, of course.
> 
> Reco
> 
> 
It sounds like I haven't missed anything obvious so I will see if
I can write a perl script or some other text-muncher that will
recreate the grub configuration of the working system but with
the UUID's of the non-working system plus a grub.cfg file exactly
like the grub.cfg file on the system that refuses to boot but
with the correct UUID labels describing the boot partition on
that system plus a copy of the kernel and it's module directory.

As for partition labels, I have always thought the name
was much easier to deal with than the 36 randomly-selected
characters that make up the UUID on a unix partition but UUID
labels are supposed to be unique and are what you encounter today
so I will see if I can make the script modern compatible.

Thanks to you and delop...@gmail.com.



A Grub Boot Question about initrd

2021-06-05 Thread Martin McCormick
I have a plan but I need some more information.  Is there any
personalization done by the boot setup process?  Do our UUID's
or any other specific information pertaining to the installation
make it in to the initrd files?

While reading about the boot process, it doesn't appear
that the initrd files or initranfs are personalized with anything
pertaining to this computer and this installation.

If that is so, then two computers using the same
processor type should be able to use copies of the same initrd files
and the only thing that is personalized on an individual computer
is all the grub configuration in which the UUID's of at least /
and /swap partitions are sprinkled throughout grub.cfg and
/etc/default/grub.

One should be able to write a program to get the
appropriate UUID's out of fstab on the working system
and translate them in to corresponding UUID's for the system on
the operating table.

If the target system actually boots, it is probably a
good idea to run update-grub to make sure that still produces a
working boot but this would still more than likely produce the
same results if this process works in the first place.  It's also
possible that the reconstructed grub setup is okay except for the
drive designation which usually starts out as /dev/sda1.  On my
good Buster system, this is now /dev/sdc1 and on the sick one,
the attempt is being made on /dev/sda1.

The idea here is to copy the concept of what is happening
rather than the literal configurations which definitely will
never work unless one used dd to generate the clone drive and I
have actually done that once and it worked but the cloned system
was then adapted for other uses.  Here, all I want to do is
rescue the boot process so it lives on and not have to reinstall
everything else.

As an aside, one ought to be able to do something like
this.  It makes life a lot simpler.  Both systems are using the
same kernel and versions of the same processor the only real
differences are the UUID's.  The grub configurations of both are
the same down to the serial console.

Martin



Re: Boot Repair. Still Going Round and Round.

2021-06-04 Thread Martin McCormick
I placed the ailing drive back on a good Linux system and mounted
it as /dev/sdd1 /mnt
and ran the following commands on it:

#!/bin/sh
#mount the drive being repaired.  Uncomment lines as needed.
  sudo mount /dev/sdd1 /mnt
cd /mnt/boot
#installing to the mounted disk
  sudo grub-install \
--boot-directory=/mnt/boot/ /dev/sda

Installing for i386-pc platform.
Installation finished. No error reported.
root@wb5agz:/#

But wait.  There's more.

root@wb5agz:/# update-grub --boot-directory=/dev/sda
Unrecognized option `--boot-directory=/dev/sda'

Not good.


Continuing on to update initramfs.

#Isolate the disk.


 sudo mount --bind /dev /mnt/dev
 sudo mount --bind /dev/pts /mnt/dev/pts
 sudo mount --bind /proc /mnt/proc
 sudo mount --bind /sys /mnt/sys

That all worked.

 sudo chroot /mnt
root@wb5agz:/# 
update-initramfs -c -k 4.19.0-5-686-pae

That appears to work.


root@wb5agz:/# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.0-5-686-pae
Found initrd image: /boot/initrd.img-4.19.0-5-686-pae
Found linux image: /boot/vmlinuz-4.9.0-9-686-pae
Found initrd image: /boot/initrd.img-4.9.0-9-686-pae

Now this ruins everything.

Found Debian GNU/Linux 10 (buster) on /dev/sdc1
done

This was a chroot environment but it appears that /dev/sdc1 was
recognized as the boot source for this external drive.  /dev is
part of the system.


The external drive normally lives in another system and
is the only boot source which is why it should be /dev/sda1.

Is there any way to run update-grub from grub itself?

The system this external drive is meant for normally only
has 1 boot drive which is the one that is currently confusing
grub.  If I could run install-grub and update-grub from the dead
system, there would not be any other bootable drives and the only
game in town would be /dev/sda for the boot record and
/dev/sda1-5 for the boot drive.

Understanding what is supposed to happen isn't
particularly difficult but getting grub to think simple and easy
Putting the drive on another system and hoping for no
contamination seems to be a lot easier said than done.

Martin



Re: Boot Repair

2021-06-03 Thread Martin McCormick
Weaver  writes:
> Well, let us know how it goes, because I've noted a few visually
> disadvantaged users on the list, and they would find the reference
> useful.

I have found out that grub is very accessible if one has
defined a serial console and there is a working serial port on
the target system.  In this case, both conditions are true.

The next thing one needs is a talking terminal which is
no problem if one has another computer equipped with a serial
terminal program like microcom or what I consider the gold
standard, kermit which apparently has too many dependencies to be
part of the Debian distributions any more.  Kermit has a decent
scripting language so one can save the commands that work, even
the commands that involve entering a huge string in which one
typo means completely starting over again.

This means you can completely repeat all the things that
work each time and feed it all in again in a fraction of a
second.  Talk about working smarter as opposed to harder.

While I call kermit the gold standard, the gold standard
for scripting is expect so one can call unix applications from
the login shell to any valid command, read the output and
generate commands as if one was there.  You can even simulate
human typing rhythms to defeat attempts to detect robots.  I'd
love to see a good CAPTCHA solver with OCR that was so good that
CAPTCHA designers would go out and find honest work but I digress.

This is actually a systemic problem these days when
dealing with sick machines.  Nobody is selling new desktops
with RS-232 native serial ports and that is fine as long as
there is an alternative way such as a bluetooth interface or ssh
network connection.  The dream solution would be a local network
login covering all the lights-out conditions such as BIOS
configuration and failure to boot as in this situation where grub
is confused.

Before I retired, some of our newest servers used
management interfaces and ipmitool where one could turn power on
and off, do BIOS setups and other configuration remotely.  It was
so cool to be able to do those things on a system in another town
without leaving the chair or grabbing a go bag and blowing a
whole day just to flip a couple of switches.  Of course,  
if it was that simple, we usually could call someone we trusted
at one of our remote campuses and ask them to flip the switches
but I'm sure you see the advantage of remote management.

For folks who are blind, you treat all those things as if
they were halfway round the Earth instead of sitting less than 1
meter apart.  They are all headless even if I can extend my arms
and touch both machines.

I think the grubdisk2 GUI app is basically a lost cause
but that's the rule when dealing with accessibility.  When
it's done wrong, you chase down endless rabbit holes all day and
muse as to how there must be some way to turn the sausage machine
backwards and have live farm animals running away from the
other end.

There was an American country and Western song back in
the early seventies which had a line at the end of each verse
that went,

"Work your fingers to the bone
What do ya' get?
Bony fingers."

I think the best course right now is to take my bony
fingers and workup a kermit script to interact with grub and get
it to produce one boot and then use the running system and grub
to fix itself.  So far, nothing else is less work.

I do appreciate your telling me about grubdisk2 because
sometimes, these things turn out to be life savers and you have
to try the rabbit holes to know for sure.

Martin



Re: Boot Repair

2021-06-02 Thread Martin McCormick
Weaver  writes:
> https://www.supergrubdisk.org/

The site recommends downloading the hybrid version of
grub2disk so that is what I did because all the Linux boxes I
have are x86 hardware and have CD technology built in.

This is quite an interesting creation.  The ISO image is
a wee bit over 16 MB in size and, as I suspected, the package
includes no screen reader modules whatsoever but I did mount the
CD after burning it and ran

find . -name "*" -print and there are serial modules sprinkled
throughout the distribution.  There are occasional references to
a serial console.

In some of the documentation I have found on the site, I
haven't found one iota of text as to how to make this console
work but if computer users who are blind can access this serial
console, that is like finding gold in them thare hills.

Tomorrow, I will look further for any hints as to how to
make the serial console appear but I actually did read the words
"serial console" on that site.

When I listed all the files on the CD, I also ran across
the following:

./boot/grub/i386-efi/morse.mod
./boot/grub/i386-pc/morse.mod
./boot/grub/x86_64-efi/morse.mod

If this has to do with outputting text in Morse Code, I
know Morse since we amateur radio operators once had to know it
to get our licenses and as long as it is sending at a reasonable
rate which, for me, stops at about 20 words per minute, is
perfectly useful to read the output.

I didn't even see any references to Morse Code on the
site so it's another way to make this useful.

The PC being used to run this CD does have a piezo buzzer
on the mother board so if there is a way to make it sing in
Morse, I may not need the serial console but it certainly would
be nice to know all there is about both of those fall-back
methods.

Thanks to anybody who knows where real sentences are that
explain the serial console or the possible Morse code output.

Martin WB5AGZ



Re: Boot Repair

2021-06-02 Thread Martin McCormick
Weaver  writes:
> On 03-06-2021 03:59, Martin McCormick wrote:
> > Is there any free utility that can run in Linux which helps one
> > rebuild a corrupted boot configuration?
> 
> https://www.supergrubdisk.org/

Thank you very much as you did answer my question
perfectly but I did not stop to think about all the possibilities
of the form the solution might take.

So, as a computer user who happens to be blind, is this
stand-alone application using a linux kernel containing the
speakup modules?

On the Linux live CD's, one can get those to talk by
striking the S key as the system boots up and then one can hear
what is on the screen as one works.

Do you know what kind of kernel it uses?

Martin



Boot Repair

2021-06-02 Thread Martin McCormick
Is there any free utility that can run in Linux which helps one
rebuild a corrupted boot configuration?

I have a disk which is currently out of it's usual place
as the boot drive for a debian system.  The past two times that
Buster updated grub, the drive became unbootable after  the
update.  The drive, itself appears to be perfectly good and I
think the problem which makes the update kill the drive is
related to a dd copy I made some years ago of one drive to
another so most of what is there is normal.

After the second killing of the drive, I started to
determine what is misguiding update-initramfs as grub-install
seems to produce a grub.cfg file that is looking for all the
right UUID's but when the system boots, grub now fails by trying
to find a UUID that must have belonged to a now deceased system
as it no longer appears in the fstab of either the newly-dead
system or another system which is alive and well and being used
to try to revive the injured drive.

Everything needed to produce a valid boot is there if
only I can run something that will reconstitude the boot image so
that it looks for the right UUID's.

I do remember seeing this message as the update ripped
through the new grub:

update-initramfs: Generating /boot/initrd.img-4.19.0-5-686-pae
W: initramfs-tools configuration sets RESUME=UUID=6f6f4373-45a3-4c16-97b4-f62613
fe6d3b
W: but no matching swap device is available.

That UUID should start with a 3, not a 6 as the blkid for
/swap is what should be there.

I am not totally sure where tthe UUID that starts with
6f6f comes from but that's also the UUID one sees when grub
crashes and burns on liftoff when trying to boot from that drive.

Martin



Grub on Dead Disk solved

2021-06-01 Thread Martin McCormick
I missed the INSTALL_DEVICE and now the script works.

The next step is to see if the drive boots but I just
forgot that one important detail.  Sorry to waste anyone's time.

Martin



Grub on Dead Disk

2021-06-01 Thread Martin McCormick
I had this same problem late last Fall on this same drive
and am not sure what is going on because there is another Linux
system here whose drive is arranged exactly the same way.  An
update in March modified grub and I didn't even give it a thought
because that system just works but after an update a couple of
days ago, the dead system starts a boot but grub complains about
neither possible image being bootable.

When I rescued that system last Fall, I was advised on
this list to do the following which worked perfectly by the way:

>If you want a grub-install command that writes /boot/grub files
>somewhere onto /dev/sdd then you will first have to mount the desired
>target boot partiton of /dev/sdd on some mountpoint that you choose,
>and then run a command something like this:
>  sudo grub-install
>--boot-directory=/some/mountpoint/where/is/the/sdd/boot /dev/sdd

I mounted the drive on /mnt so looking at /mnt gives you / and
the directory where the correct files are is then /mnt/boot or
possibly /mnt/boot/grub.

I created the following shell script which I named do_grub.

#!/bin/sh
  sudo grub-install \
--boot-directory=/mnt/boot/

I get the following no matter where I point boot-directory:

./do_grub
[sudo] password for martin:
Installing for i386-pc platform.
grub-install: error: install device isn't specified.

I don't remember doing anything else.

I think this time I may also need to do update-grub on
the currently bootless drive.

As with the last time this happened, the dead drive
passes all fsck tests and the first time I ran fsck  on it,
nothing needed fixing.

This is one of these problems that hardly ever comes up
which means that when it happens, one spends/wastes a lot of
time doing duckduckgo and puzzling.  There should be a way to
automate or at least prompt the person running the recovery
attempt to find the right information to get things up and
running if at all possible.  It's all there such as the grub file
in /etc/default which should have the uuid of the/ and swap
partitions.  Right then, one could see if the uuid's are correct
and get a proper boot going in which one could then rerun
update-grub if necessary.  Right now, it's just fumble and fiddle
and wonder what happened.

I must have something set wrong to cause the apt-get
upgrade to build a non-functional grub since the system in
question made a number of reboots successfully between about last
December 1 and now.

I also remember reading a message about problems with
swap which is on /dev/sda5 when the drive is booted.  I found the
messages log which shows swap as correctly mounted and working
before the upgrade.

Is there another log which might still have that message
from apt-get upgrade.  The message was not captured at the time.

I have been using Debian on several systems for a number
of years and this one system is the only one which seems to fall
down every time grub is touched.  That indicates I need to check
one of the configuration files which probably has a wrong
partition ID or something similar.

I am just glad I have another Linux box to mount the
no-boot drive on and that the drive, itself, does not seem
corrupted just as the last time this happened.

Thanks for any constructive ideas.

Martin McCormick   WB5AGZ



Is there any way to snoop on a USB port?

2021-04-29 Thread Martin McCormick
I have a Windows box that has software on it which programs
two-way radios and it would be nice to know what the radio and
computer are saying to each other.

After trying a Windows application that reportedly can
capture serial port traffic, I find that it doesn't appear to
work with usb ports and unix/linux is my preferred world anyway
so is there any sort of hardware that would pass through a USB
connection from the Windows box to the radio and let me siphon
off the traffic to a linux system and log it?

The Windows app I tried to use has been around for a
decade or more and probably works well with RS-232 ports but the
traffic I need to grab comes from a usb device that creates
/dev/ttyACM0 if plugged in to a Linux box and comm2 on the
Windows system

When I tried it today, it did nothing but complain that
it was not connected.  It finally dawned on me that it probably
sees no serial ports at all as it is supposed to automatically
find and log all port I/O and this is a relatively new HP
Pavilion desktop computer which has no native RS-232 ports or
parallel ports on it and, even if it did, the connection from the
radio to the usb port is a usb plug with the usb hardware in it
and a cable that plugs in to the radio that would most likely
not be practical to tap.

Thanks for any good thoughts.

Martin  WB5AGZ



fail2ban Squawk

2021-03-26 Thread Martin McCormick
I was attempting to setup a systemd timer and checking the syntax
of that when I ran across a complaint from the fail2ban program
which is a bit confusing.  It reads:

/lib/systemd/system/fail2ban.service:12: PIDFile= references path below legacy 
directory /var/run/, updating /var/run/fail2ban/fail2ban.pid → 
/run/fail2ban/fail2ban.pid; please update the unit file accordingly.

So I looked in to that file and the actual line they were
referring 2 is numbered 15 and points fail2ban.pid to
/var/run/fail2ban/fail2ban.pid where it certainly lives with a
recent date.  What is the problem exactly?

Enquiring minds want to know.

Thanks for any and all constructive ideas.

Martin McCormick



Re: Web-bot tarpit aka spider trap (was: swamp rat bots Q)

2020-12-06 Thread Martin McCormick
It's nice to see that I am not the only sick puppy out there.

At 69 years old, I still don't have much trouble with
getting in touch with my inner 12-year-old when it comes to
intrusive marketing which is so prevalent these days.

I found our old dial-up modem in a box of odds and ends 2
years ago and wondered if it could read callerID tones sent after
the first ring.  It can so I started on a perl program that
initializes the modem for callerID and then compares the strings
received with a pair of files, one of which is called scum and
contains callerID name packets of folks we don't want to talk to.
The other is called good and looks for names of friends or anyone
else we like hearing from.  It is actually scanned first and
causes the program to abort.

If anyone's name matches a name in scum, or the caller's
ID appears to be blocked or, in one case, matches a whole
exchange, (first 3 digits after the area code), I call a
subroutine that makes the modem answer for half a second then
drops the call.

We were bombarded with garbage calls all day long until
the US presidential election and it was so satisfying to hear the
program kill the call by answering just as the second ring began.

I also installed subroutines that looked for the word
"SPAM?" just before the name or "ROBO?" also just before the
name.

We now get very few unwanted calls but occasionally,
we'll get a call from lala-land from someone we don't know who
lets the phone ring until the answering machine picks up and then
fails to leave a message and I tell my wife, "I'll go put them on
the juke box." especially if it looks like the name of a business
with which we have no relationship.

Our phone is very quiet these days except for legitimate
calls.

Martin McCormick



Re: Cron Jobs and Time Zones Has Anything Changed?

2020-12-06 Thread Martin McCormick
Andrei POPESCU  writes:
> On Jo, 03 dec 20, 07:39:14, Martin McCormick wrote:
> >
> >   So, I need to read more general information about the
> > differences between systemd and what we've been using up to
> > recently.
> 
> The Wikipedia page and/or https://systemd.io might be a good place to
> start.
> 
> Kind regards,
> Andrei

I've had a chance to investigate this more and the first
thing I did was to go to wikipedia which told me about systemd,
the on-going argument about it VS older ways to build unix-like
systems and a time line when systemd began to take hold which was
around 2015 when I retired from work so it kind of sneaked up on me
and I didn't realize that I've been using it for 5 years, well,
at least I didn't think much about systemd having different
resources.

I've used udev rules in making sound cards come up in the
right order and that's totally a systemd thing.

While searching for ways to use cron with different time
zones, I found out about something called systemd timers just
mentioned in this thread and it appears they definitely will do
the job but one must magically have made the connection between this
concept and the concept that cron, the usual go to resource for
making lighting come on at a certain time, purging stale files or
backing up the system now has a new kid on the block called
systemd timers.

One can even list all the active systemd timers

https://www.maketecheasier.com/use-systemd-timers-as-cron-replacement/

$ systemctl list-timers

And, sure enough, I had a number of them ticking away.

An on-going problem about self-education is that it's
easy to limit the scope so much that we miss connections.
Systemd timers doesn't even sound like a replacement for cron but
think of it as cron on steroids.

One of the things in the wikipedia article about systemd
was a complaint by someone that it's just too complicated.  All I
can say is that maybe or not that is true but that's just life.
Start simple.  Make more and more complexity as problems with
simple show up.  One day, try to make things simple again.  Lot's
of luck with that.

I'm not so sure that being blind makes nearly as much
difference these days as it once did, but making connections that
relate one knowledge base to another in a meaningful way will
always be a problem for us.

Martin



Re: Cron Jobs and Time Zones Has Anything Changed?

2020-12-03 Thread Martin McCormick
> On Wed, Dec 02, 2020 at 01:58:45PM +, James B wrote:
> > This might be wrong, but as far as I understand doesn't systemd
> > now have the ability to manage cron jobs (as well as mount points,
> > home folders and other things)?. Is there anything in this newer
> > functionality that might make such a thing (re the request at the
> > beginning of this thread) possible?
> 
> Yes, I pointed this out to OP last time OP asked this exact question
 just a few days ago, so I don't know why they are asking again.

I am guilty as charged but haven't yet found the relevant information
as to how systemd helps solve this issue.

Systemd is praised to the rooftops by some and cursed
just as vehemently by others and it is what we are now using but
it feels mostly like unix has always felt.

I am obviously suffering from the worst sort of ignorance
syndrome which can really bite in that sometimes, we have an idea
what we don't know and other times, we don't even know that we
don't know and that's really frightening.

So, I need to read more general information about the
differences between systemd and what we've been using up to
recently.

Martin McCormick



Re: Cron Jobs and Time Zones Has Anything Changed?

2020-12-02 Thread Martin McCormick
Greg Wooledge  writes:
> I was vaguely thinking of a similar approach.  Set up a job that runs
> every hour, or across a set of hours that will cover all the possible
> cases that you care about, in your crontab.  Within the job itself,
> set a TZ variable and determine the time in that time zone by whatever
> means necessary, and then either abort or continue based on that time.
> 
> This is also similar to how one approaches a complex date-based task
> such as "run on the second-to-last day of each month".  For that one,
> you can set up the job to run on the 27th through the 30th every
> month.  Then within the job itself, determine whether it's the
> correct day, and abort if it's not.

What I was thinking of is a modification to cron which
should integrate nicely with what cron already does.

Crontab would have a new field at the beginning of each
line which could normally be left at "default" which would be the
normal behavior that we are used to.

If someone wanted to run a job at 15:00 each day in let's
say Japanese time, the first field of the line would read
Asia/Tokyo instead of default.  The line might look like

Asia/Tokyo 28 15 * * 1-5 sh -c ". $HOME/.master.env;beep -f700 -l500"

Since all unix-like systems start out with UTC and use
those /usr/share/zoneinfo data base files to calculate what local
time is, that information is handy  in the time() function.
localtime(time) gets you the adjusted number of seconds for your
locale arranged in a structure containing fields for the current
year, day of month, day of the week plus the hours, minutes and
seconds with the adjustment for Summer or Winter for that zone.

The sample line above would cause cron to grab the
current epoch in seconds (UTC), feed that to localtimebased on
rules for /usr/share/zoneinfo/Asia/Tokyo and then all those
values to match the fields on the rest of the line.

The time of 15:28 or 3:28 PM in Tokyo occurs around 01:28
in the Central US time zone and that's when your computer would
have beeped.

This would happen Monday through Friday Japanese time
which still would be Monday through Friday in the US but early in
the morning.  If the time referenced in Tokyo had been 7:00 in
the morning , it would happen the previous evening in the US.  As
long as one designated the time zone correctly and doesn't forget
that 07:00 on Monday morning in Japan equals 5 or 6 o/clock on
the evening of the previous day, it should just work.

I haven't looked at the C code for cron, but I have
written a few perl scripts that do things with time and dates and
the current epoch-based number of seconds since utc Midnight January
1, 1970 is based on the C modules such that one's current
wall-clock time is time(localtime).  Just a thought

Martin



Cron Jobs and Time Zones Has Anything Changed?

2020-12-02 Thread Martin McCormick
In a recent discussion, someone indicated that there might be a
way to set individual parts such as accounts on a unix system so
that cron could use another time zone if needed to kickoff jobs
on that system based on the time in another country.

As far as I understand cron, one can set the system's
time zone to only one value which is usually one's local clock
time and that works very well since system logs and cron jobs all
agree with what is appropriate for one's location.

I record a news broadcast from one of the BBC services
every week day at 17:45 British time.  When Europe and North
America stop or start shifting daylight in Autumn or Spring,
there's a really good chance of missing some of the broadcasts if
one doesn't think about it since these shifts don't all happen on
the same time.

One can certainly get the time anywhere as recently
discussed by setting the TZ environment variable but, if you tell
cron to trigger a job at 17:45, it only knows when that is based
on the entire system's local time.

Has anything changed recently to make this logic
obsolete?

In my case, I just have an old Linux box for which I set
it's system time zone to Europe/London and call it good but this
could get out of hand if one had more than 2 or 3 such schedules.

One could also setup VM's if you have the memory to spare
but this adds a lot of resource usage and complexity to the job
at hand so my question is basically, has anything fundamentally
changed in the way cron is used?

This is not a complaint at all.  I was first introduced to
unix-like systems in 1989 and immediately knew that this was the
sort of OS I wanted to stick with in amateur radio and technical
tinkering in general.

Martin McCormick   WB5AGZ



Re: Fixing a Grub Foul-up Solved!

2020-12-01 Thread Martin McCormick
David  writes:
> Your lack of success is because the the command you used has designed
> behaviour to install the grub bootloader to the boot sector of
> /dev/sdd, and also install the grub files you listed into the current
> system /boot/grub (which was not on sdd at the time). That is the
> reason why you see those files on /dev/sda1, because it was the boot
> partition at the time you ran the command.

Aha!! that makes perfect sense now that I think a bit.
> 
> If you want a grub-install command that writes /boot/grub files
> somewhere onto /dev/sdd then you will first have to mount the desired
> target boot partiton of /dev/sdd on some mountpoint that you choose,
> and then run a command something like this:
>   sudo grub-install
> --boot-directory=/some/mountpoint/where/is/the/sdd/boot /dev/sdd

I tried it and by Joe, it wrote to the correct drive so I
don't feel quite so paranoid about using grub.

Interestingly, I goofed again and grub ended up in what
is the / directory instead of /boot/grub so it still didn't work
but I knew immediately that the new grub was working because
there was no error message about symbols not found, etc. 

I mounted the drive back on the good system and simply
removed the grub from the top of the tree and then did the
grub-install command again but thihs time, I installed to
/mnt/boot.

It wrote to /boot/grub as it should have and the system
came right up.

There was a minor glitch when I powered the box up as the
keyboard reported a stuck condition and advised me to press F1 to
continue.  I thought this was a bit amusing since the keyboard
appeared to be malfunctioning but F1 did the trick and about a
tenth of a second later, I heard the beep that grub plays when
the kernel is about to fire off.

In short, the faulty grub that made it onto the system
was all that was really wrong.

Thanks to a lot of you, I appreciate grub more as this
has been quite a little mini course in what it does.

Martin



Re: Fixing a Grub Foul-up, Not There Yet.

2020-11-30 Thread Martin McCormick
I am going to respond to one of my earlier posts as it doesn't
help things at all to spread misinformation which I am guilty of,
here.
"Martin McCormick"  writes:
> I appear to be using grub, not grub2.  

No.  It's grub2.  Old Grub is now grub-legacy and is
probably a dead fly on somebody's wall by now.

> There's an extra little wrinkle in that, as a computer
> warier who happens to be blind, grub isn't really accessible in
> that you can not get direct access to it via a serial port and
> terminal, say, from another computer that is actually working.

I was simply wrong there.  Of course, one has to have the lines now
in /etc/default/grub that used to be in menu.lst but the idea is
the same.  If one has a serial port which is available at boot
time, grub should work headlessly.

The issue with the instance of grub that seems to have a
run-time error due to a problem with modules, may be unusual
because it may actually be a goner before it runs since it
doesn't get to load it's modules.

Martin



Re: 780 files in /usr/share/zoneinfo/

2020-11-30 Thread Martin McCormick
Michael Stone  writes:
> The kernel, compressed, is larger than that. The initrd needed to boot the
> kernel is also typically larger than that. A modern system has more CPU
> cache than that. At some point trying to save bytes is a waste of 
> developer
> and administrator effort, and 3.5MB in 2020 is well past that point. If 
> you
> want a minimal system, debian isn't for you. Instead, you'll need to hand
> craft every file to make sure it isn't "wasting space". If that's your
> thing, great. But it's just not a focus for debian.

About the only place one still needs to think this way is
with embedded systems where the computer is there to manage a
machine of some kind, anything from a lathe to a food processor
to a cement mixer, whatever .  

General-purpose computers are optimized to have as many
resources as one can cram in to a higher and higher-density box
so a few MB here or there aren't noticed but embedded systems are
optimized with different priorities and one may discover that
this box may be lightning fast but a bit skimpy on data storage.

I am thinking of things such as cable TV boxes and
dedicated audio-visual appliances that use DSP to emulate complex
and expensive hardware by using mathematical algorithms that
cause the system to decode digital TV signals or route internet
traffic rapidly.

If you aren't in to trying to modify some sort of
embedded system to do something it wasn't originally designed to
do then ram and storage are getting cheaper by the day and some
things just aren't worth worrying about.

Martin McCormick



Re: 780 files in /usr/share/zoneinfo/

2020-11-30 Thread Martin McCormick
Andy Smith  writes:
> Hi Martin,
> 
> On Sat, Nov 21, 2020 at 08:48:51PM -0600, Martin McCormick wrote:
> > find . -name "*" -exec ls -l {} \;  \
> > |grep -F / \
> > | awk ' { total += $5 } END { print total }'
> >
> >   That usually just adds the sizes of all the files it can
> > find all the way through the tree.
> >
> >   If this is not an accurate way to determine how many
> > bytes there are in a directory then that would be the reason for
> > the discrepancy.
> 
> The same file can be reached by multiple names. So by doing this you
> end up, in this case, with a ~256x amplification.
> 
> A simple "du -sh" does a better job here!
> 
> > cron only works in the time zone for wherever the TZ for the
> > system is set.
> 
> Ah, I see. I've never tried it but I believe that systemd timers can
> have a time spec that includes time zone, so you can set timers that
> fire on a different time zone to that used by the rest of the system.
> 
> $ systemd-analyze calendar '11:00 Europe/London'
>   Original form: 11:00 Europe/London
> Normalized form: *-*-* 11:00:00 Europe/London
> Next elapse: Sun 2020-11-22 11:00:00 UTC
>From now: 6h left
> 
> Cheers,

I do appreciate being corrected, here.  What we really want to
know, here, is how much precious disk space is occupied by
whatever data base we are interested in.  Links make copies of
files appear to exist when the data were only written once even

Martin



Re: Fixing a Grub Foul-up

2020-11-29 Thread Martin McCormick
Dan Ritter  writes:
> Here's what you can do:
> 
> On a good system, mount your drive. Let's pretend that it's
> recognized as /dev/sdg, and you have a /boot on /dev/sdg1 and
> a root partition on /dev/sdg2.
> 
> ls -al /dev/disk/by-partuuid/| grep sdg
> 
> will get you the partition UUIDs for that disk. One of them will
> be for /dev/sdg1 and another for /dev/sdg2.
> 
> The kernel really likes these as root filesystems identifiers.
> The kernel parameter that you put in /etc/default/grub is
> 
> ROOT=PARTUUID=dddf0dd6-dd6b-d542-9eac-015a765cd6f6
> 
> although you will want to substitute in the appropriate
> part-uuid for /dev/sdg2.
> 
> Finally, you can run
> 
> grub-install /dev/sdg
> 
> to get a new copy of grub into the master boot sector of the
> disk.
> 
> Hope that helps,
> 
> -dsr-

This does help a lot and I have read similar examples how
to work on a drive that has been mounted on a different system
than the system on which it will ultimately be used but I am
still doing something wrong and the results are dangerous to say
the least.

At one time, the otherwise good drive was mounted on
/dev/sdd with the root partition on /dev/sdd1.

I typed sudo grub-install /dev/sdd.  It ran for a few
seconds, announced that grub was installed without any errors and
exited.

After looking at /dev/sdd1/grub and seeing no updated
date stamps, I had a sinking feeling and looked at /dev/sda1
which is the boot partition on the system I haven't killed yet
and, sure enough, grub-install had run on that drive.

$ ls -lt /boot/grub
total 2372
drwxr-xr-x 2 root root   12288 Nov 29 11:26 i386-pc
drwxr-xr-x 2 root root4096 Nov 29 11:26 locale
-r--r--r-- 1 root root7276 Sep  3 05:43 grub.cfg
-rw-r--r-- 1 root root 2396122 Sep  3 05:43 unicode.pf2
-rw-r--r-- 1 root root1024 Jun 29  2019 grubenv
drwxr-xr-x 2 root root4096 Jun 29  2019 fonts

It didn't even touch any part of /dev/sdd1.  With
trepedation, I rebooted the good system and thankfully, it came
right up since I hadn't modified /etc/default/grub.  That was a
bit of good luck but I thought it was supposed to write to /dev/sdd1
which would translate to /dev/sda1 when the drive was connected
to the controller of the system that is presently belly up.

I suspect the problem is the issue with the modules which
another poster described.

What am I failing to do to make the changes occur on the
designated drive?  Having it write this kind of stuff to drives
other than the desired target is scary.

Thanks for a good explanation and I may not be so lucky next
time.

Martin



Re: Fixing a Grub Foul-up, Not There Yet.

2020-11-21 Thread Martin McCormick
Dan Ritter  writes:
> in /boot/grub/menu.lst
> 
> serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
> terminal serial
> 
> (yes, that's two lines)
> 
> I hope that helps.
> 
> If you want the option of either serial or console access,
> replace the second line with
> 
> terminal --timeout=10 serial console
> 
> The default will be serial, but if you press a key on the
> console within 10 seconds, it will go there instead.
> 
> -dsr-

Thank you.  That is a tremendous thing to know.  I
thought there was something serial in grub but I couldn't
remember.  This is the first time I ever had any real trouble
with grub and I can put this drive back on the working linux box
and modify that file, assuming the change would take place on the
next run of grub.

Martin



Re: 780 files in /usr/share/zoneinfo/

2020-11-21 Thread Martin McCormick
Andy Smith  writes:
> Hi Martin,
> 
> Are you sure about this? There is no Debian or Ubuntu host I have
> access to that has a /usr/share/zoneinfo/ that contains more than
> 4MiB of data. For yours to have 256 times this much is quite an
> aberration. What did you type to determine that your
> /usr/share/zoneinfo/ has 1GiB of data in it?

find . -name "*" -exec ls -l {} \;  \
|grep -F / \
| awk ' { total += $5 } END { print total }'

That usually just adds the sizes of all the files it can
find all the way through the tree.

If this is not an accurate way to determine how many
bytes there are in a directory then that would be the reason for
the discrepancy.

> 
> >   I've wished one could just set certain parts of the
> > computer to other times but I can also understand why this could
> > be a problem.
> 
> You can set any process to have a different time zone by use of
> environment variables.
> 
> $ date
> Sat 21 Nov 21:34:55 UTC 2020
> $ TZ=America/Los_Angeles date
> Sat 21 Nov 13:35:04 PST 2020

That is very true but cron only works in the time zone
for wherever the TZ for the system is set.

On the system I have set to British time, my local login
shell has TZ=America/Chicago so I read Central Standard Time for
file time stamps but if I set a cron job, it runs on either
British Summer Time or British standard time which is the same as
UTC during Winter.


> Cheers,
> Andy



Re: Fixing a Grub Foul-up, Not There Yet.

2020-11-21 Thread Martin McCormick
Felix Miata  writes:
> Save yourself many keystrokes by using the symlinks in the root directory 
> instead
> of the long-winded full version-named /boot/vmlinuz-4.19.0-5-686-pae

This is wonderful to know and in the root or / directory of this
disk, there is 
initrd.img, initrd.img.old, vmlinuz and vmlinuz.old

Those all point to valid targets.  I presently have the
no-boot disk mounted on a working linux system where it's root
directory is /dev/sde1 and the current links plus the old links
are as follows:

lrwxrwxrwx   1 root root32 Jun 26  2019 initrd.img -> 
boot/initrd.img-4.19.0-5-686-pae
lrwxrwxrwx   1 root root31 Jun 26  2019 initrd.img.old -> 
boot/initrd.img-4.9.0-9-686-pae
lrwxrwxrwx   1 root root29 Jun 26  2019 vmlinuz -> 
boot/vmlinuz-4.19.0-5-686-pae
lrwxrwxrwx   1 root root28 Jun 26  2019 vmlinuz.old -> 
boot/vmlinuz-4.9.0-9-686-pae

I finally have found something that may be a clue to
what's actually wrong. While trying to manually make that drive
boot, I got this:

grub rescue> set prefix=(hd0,1)//boot/grub
grub rescue> insmodnormal
Unknown command `insmodnormal'.

That was a good old syntax error so I tried

insmod normal with a space
grub rescue> insmod normal
error: symbol `grub_calloc' not found.

I'm pretty sure that shouldn't happen at all and is
what's behind the failure to boot.

I haven't found any uuid's that are different although I
first thought I had as I looked at some links which had uuid's
but they were good when I looked at the actual partition.  It's
easy to go down a rabbit hole if one doesn't watch out.

I think there may be something about grub that got left
out or changed during the upgrade.

Martin

Martin



Re: 780 files in /usr/share/zoneinfo/

2020-11-21 Thread Martin McCormick
 writes:
> Suppose a hacker logs into your computer from far, far away, say
> from somewhere in Nepal.
> 
> Surely you'd want this person to see the time adapted to their
> locale? That's the least courtesy you can be expected to provide?
> 
> ;-P
> 
> Now putting my tongue out of my cheek again: in Unix, a computer
> "has" no time zone or language -- people have those. And since,
> again in Unix, several people can be logged in [1] at the same time,
> it's up to the user's environment [2] to decide on time zone,
> language, etc.
> 
> This concept is surprising at first coming from other cultures,
> where Microsoft was happy to sell you another complete version
> of Windows if you wanted your computer to talk to you, e.g.
> Portuguese (and yet another for Brazilian Portuguese, greedy as
> they are).
> 
> Of course, Microsoft has caught up (they are trying since the
> mid-90s), but not without some spectacular messups. Remember that
> one where (I think it was Windows 95), while trying to automate
> the spring DST transition were spotted dithering endlessly between
> 2AM and 3AM?
> 
> Unix has had this abstraction always: there's the internal time,
> and there's the time shown to the user, which depends on the user.
> 
> There's the error itself, and there's the error message shown to
> the user. And so on.
> 
> Cheers

I just cd'd to that directory and it looks like there's
about 1 GB there.  I think it is cool to have all that info and I
even configured a linux system for BST so cron would record shows
I was interested in from the BBC.

It works perfectly when we go from Summer time to
standard time in Winter because North America and the UK don't
switch at the same time but it all works.

I've wished one could just set certain parts of the
computer to other times but I can also understand why this could
be a problem.

By the way, I have never been outside the United States
but am an amateur radio operator and learned at a very young age
to appreciate those time zones if one wants to know when to
listen for interesting things.

Martin



Fixing a Grub Foul-up, Not There Yet.

2020-11-21 Thread Martin McCormick
I did some duckduckgo-ing about grub rescue and found useful
things but am still dead in the water.

I appear to be using grub, not grub2.  One of the
articles I found had an example of how to use grub rescue that all
works except, of course, for the actual booting of the kernel.

There's an extra little wrinkle in that, as a computer
warier who happens to be blind, grub isn't really accessible in
that you can not get direct access to it via a serial port and
terminal, say, from another computer that is actually working.  A
really clumsy work-around does work off of the dead computer in
that it is old enough that the Print-screen key dumps an ASCII
character dump of the screen to the parallel printer output every
time you press Print-screen.  I found out after connecting a
second computer to a parallel-to-serial converter that I was in 
grub rescue>  mode.

Each time one types on a keyboard attached to the dead
computer, one then must hit Print-screen to find out whether it
goes or blows.

This is slow and awkward because there is no
character-by-character feedback so if you hit the n instead of
the m, you don't find out that it's a no go until you read the
whole screen.

Also the Tabs you hit don't show up in the output so
it'salloneunbrokenline.

Is there a way I can write the commands in to a text file
that I can call to at least know what commands I am executing in
grub rescue and do in a tenth of a second what it takes minutes
to do otherwise?

What I have right now is a text file called stuffcommands
and it is sitting in the boot level of the dead boot disk.
When I had the drive mounted on a working system, I did chmod +x
stuffcommands but since there are no shells running, I just put
the following lines in the file.  Everyone of these commands
works when typed in except for the final one which boots the
kernel.

What I need to type in with, of course, no mistakes looks
like:

set root=(hd0,1)
linux   (hd0,1)/boot/vmlinuz-4.19.0-5-686-pae   root=/dev/sda1

#I have yet to see this one work.

initrd (hd0,1)/boot/initrd.img-4.19.0-5-686-pae boot

Here is a screen capture of what pressing Print-screen
produces  The first line is that error message and is probably
the clue as to what went wrong.  The successful commands were
laboriously typed in by hand once again to prove they work
although by now, I know the kernel version number about as well
as my last name.

error: symbol `grub_calloc' not found.  

That's the smoke that the booster is going to blow up on the
launch pad.

Entering rescue mode... 
grub rescue> ls 
(hd0) (hd0,msdos5) (hd0,msdos1) (fd0) (fd1) 

The root partition is Partition #1.

grub rescue> (hd0,1)/boot/stuffcommands 
Unknown command `(hd0,1)/boot/stuffcommands'.   

Ah, if only.  Those few lines would make each retry so much more
efficient.

grub rescue> set root=/de/sda1  

It worked.

grub rescue> linux(hd0,1)/boot/mlinuz-4.19.0-5-686-paeroot=/de/sda1 

And that one worked!

grub rescue>

That much works and it would be so nice not to have to repeat
those steps every time.  Is there a way to call that
stuffcommands text file so that grub thinks it's coming from the
keyboard?


I think I'd like a keyboard that one can store commands
like this in so as to keep the donkey work down to the problem
lines.

Actually, if only grub could be made to operate remotely,
I'd just script all the stuff that works and also know if I
fat-fingered anything when it happens so one could backspace and
fix it the way we fix any typing error.

Before I retired in 2015, I occasionally had to setup new
servers and these had lights-out minicomputers that helped one 
remotely access even a powered-down box in another state,
province or country.  The linux kernel, itself can easily be
configured to be accessible via a serial port or on the local
console so grub sorely needs headless capabilities for those rare
times where stuff just doesn't come back from a reboot.

I appreciate the good suggestions I have gotten from
several of you so far.

Martin McCormick



Re: Fixing a Grub Foul-up

2020-11-16 Thread Martin McCormick
Dan Ritter  writes:
> Here's what you can do:
> 
> On a good system, mount your drive. Let's pretend that it's
> recognized as /dev/sdg, and you have a /boot on /dev/sdg1 and
> a root partition on /dev/sdg2.
> 
> ls -al /dev/disk/by-partuuid/| grep sdg
> 
> will get you the partition UUIDs for that disk. One of them will
> be for /dev/sdg1 and another for /dev/sdg2.
> 
> The kernel really likes these as root filesystems identifiers.
> The kernel parameter that you put in /etc/default/grub is
> 
> ROOT=PARTUUID=dddf0dd6-dd6b-d542-9eac-015a765cd6f6
> 
> although you will want to substitute in the appropriate
> part-uuid for /dev/sdg2.
> 
> Finally, you can run
> 
> grub-install /dev/sdg
> 
> to get a new copy of grub into the master boot sector of the
> disk.
> 
> Hope that helps,

It certainly does!
First, thanks to all who answered so far.  I think you have
perfectly described what is causing the problem although grub is
not high in my knowledge base like it probably should be.

When I read /boot/grub/grub.cfg, I see
references to a uuid that isn't any of the partitions that have
UUID's.  On my disk, Partition 1 is / and blkid spits out a
number that starts with 9F.  Partition 2 was created to get an
extended partition of 5 which is swap space so 1 and 5 have
UUID's.  The UUID referenced in grub.cfg starts with 3.
The rest of this message consists
of grub.cfg.

Martin

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
insmod all_video
  else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
  fi
}

serial --speed=115200 --unit=1 --word=8 --parity=no --stop=1

terminal_input serial
terminal_output serial
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
set timeout=5
  fi
fi
play 480 440 1
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu 
--class os $menuentry_id_option 
'gnulinux-simple-3584c851-6616-464f-8a8e-2d634fca5969' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 
--hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  
3584c851-6616-464f-8a8e-2d634fca5969
else
  search --no-floppy --fs-uuid --set=root 
3584c851-6616-464f-8a8e-2d634fca5969
fi
echo'Loading Linux 4.19.0-5-686-pae ...'
linux   /boot/vmlinuz-4.19.0-5-686-pae 
root=UUID=3584c851-6616-464f-8a8e-2d634fca5969 ro console=tty0 
console=ttyS0,115200n8 quiet
echo'Loading initial ramdisk ...'
initrd  /boot/initrd.img-4.19.0-5-686-pae
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 
'gnulinux-advanced-3584c851-6616-464f-8a8e-2d634fca5969' {
menuentry 'Debian GNU/Linux, with Linux 4.19.0-5-686-pae' --class 
debian --class gnu-linux --class gnu --class os $menuentry_id_option 
'gnulinux-4.19.0-5-686-pae-advanced-3584c851-6616-464f-8a8e-2d634fca5969' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; 
fi
insmod part_msdos
insmod ext2
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root 
--hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  
3584c851-6616-464f-8a8e-2d634fca5969

Fixing a Grub Foul-up

2020-11-16 Thread Martin McCormick
I have goofed, I think.  There is a serca-2000-vintage Dell
Optiplex that has been working fine up to yesterday when I did
the usual apt-get update followed by the apt-get upgrade on
buster.  The update and upgrade appeared to work.

One of the things that got visited was grub and it was
then that I was reminded that there was another drive in the
system that had a bootable image of buster on it also.  Grub
reported seeing it on /dev/sdc which is coorrect.

This particular system has a zip drive that always shows
up as /dev/sdb so the next hard drive after /dev/sda is /dev/sdc.

I rebooted to make sure all was well and waited and
waited . . .

The system sits there like a bump on a log.

I have a usb device that lets one mount IDE and SATA
drives that are outside the system so I pulled the sata drive
which is the boot drive for the now dead system and plugged it in
to the usb converter.

the drive breezes through fsck and looks perfectly
normal.

I looked at /boot/grub/grub.cfg which one is not supposed
to edit as grub builds it based on /etc/default/grub which one
does edit.

If I was to mount that partition on a working system, it,
of course, will have a different device number such as /dev/sde1
instead of /dev/sda1 which it should have when booting up the
system it normally runs in.

Is there a safe way to mount this drive, possibly using
chroot, re-run grub-config and get the drive bootable again?

If I look at grub.cfg and /etc/default/grub, everything
looks as if it should work but it doesn't.

I think boot problems are some of the most agrevating
issues.  They are true show stoppers.

I've got backups but that's beside the point.  Unless I
can fix whatever happened, it's going to be quite a time waster.

Thanks for any constructive suggestions.

Martin McCormick



Re: Newbie

2020-06-30 Thread Martin McCormick
=?euc-kr?b?yLK6tMjx?=  writes:
> Hi Arun,
> 
> Yes this is question place.
> 
> Sincerely, Byung-Hee
> 
It is one of the most helpful groups I know of as
sometimes, there are questions that don't lend themselves to a
search engine string although one can get really lucky if you try
to not use words that easily can mean several things at once.

Occasionally, we dazzle ourselves with our own brilliance,
thinking our search terms should be so concise as to drill right
down through all the Ebay pitches and mercantile flotsam to see
the answer to our question on the first link to pop up only to
find we have asked a question similar to "Can birds fly?"

When my wife was getting her Master's in library science,
she related a story about a person walking in to a library and
asking that question.

It turned out that the patron was interested in whether
or not birds could be carried on an airplane and how do you do
this?

The search engines are as good as we are so if you ask
duckduckgo if birds can fly and also ask Google the same
question, you probably won't get quality answers from either
search but with one of the two, your spam level won't change.
Three guesses as to which engine changes your spam quantity.

I do amaze myself at how many searches go off the tracks
because there are many ways to interpret the same question and,
when you see what you got, one can usually also see why.  If you
like puns, you may be thinking like a search engine.

For those not familiar with English, a pun is a play on
words in which one word has many different meanings.  The punster
intends for you to notice the other meaning.

 If you have questions about debian buster or redhat or freebsd, 
it cuts through a lot of jungle if you put the operating system you are asking 
about as the first
word so that something like 

debian buster end of line character

will instantly weed out how Windows does it as an example.  If it
doesn't completely remove all the irrelevant info, the unwanted
things tend to be near the bottom of your search.

Martin



Re: Looping Shell Scripts and System Load

2020-06-24 Thread Martin McCormick
Greg Wooledge  writes:
> All-caps names are reserved for environment variables (HOME, PATH),
> and internal shell variables (IFS, PWD, HISTFILE).
> 
> Avoiding all-caps names allows you to avoid collisions with a variable
> name that might be used for something else.  Most of the time.  This
> being the Unix shell, there are *always* stupid exceptions (http_proxy
> and friends on the environment side, and auto_resume and histchars in
> bash).

Thank you.  I learned something today that I didn't
expect to learn which is why I posted the question in the first
place.  I just wasn't thinking, I guess and used the all-caps
names to indicate that they stood for files.  If one collided
with an environment variable name, it could make the script fail
in strange ways that would be totally unpredictable, depending on
which variable one preempted.

Martin



Looping Shell Scripts and System Load

2020-06-24 Thread Martin McCormick
I wrote a shell script that unzips documents and I originally
wrote it such that it gets document #1, unzips it then gets
document #2, etc and it does that just fine so I wondered if I
could make it run faster by starting several processes at once,
each one unzipping a file.  It's certainly still running and will
eventually finish but I created a monster because it starts as
many processes as there are items to unzip.

#!/bin/sh
unarchive ()  {
 unzip $1
return 0
}
MEDIADIR=`pwd`
mountpoint /mags >/dev/null  ||mount /mags
mountpoint /mags >/dev/null || exit 1
cd /mags
#rm -r -f *
 for MEDIAFILE in `ls $MEDIADIR/*`; do
dirname=`basename $MEDIAFILE`
mkdir $dirname
cd $dirname
unarchive $MEDIAFILE &
cd ../
done
wait
cd ~
umount /mags
exit 0

If there are 3 zipped files, it's probably going to be ok
and start 3 unzip processes.  This directory had 13 zip files and
the first 2 or 3 roared to life and then things slowed down as
they all tried to run.

I expected this and I've been doing unix shell scripts
for literally 31 years this Summer so it is no mystery as each
new job spawns a whole new set of processes to unzip the file it
is working on while all the others are still grinding on.

Miscreants have been known to deliberately create
loops that keep starting processes until the system crashes.

Fortunately, this is one of my systems but this made me
wonder before I reinvent the wheel if there is a way to make a
shell script throttle itself based on current load so it keeps
slurping resources until the next iteration starts too many and
things start to bog down.  When some of the earlier or shorter
processes finish, the loop can restart and start some more unzips
until all are done.

Right now, uptime looks like:

 11:48:07 up 26 days, 23:10,  7 users,  load average: 16.15, 15.60, 10.65

That's pretty loaded so ideally, one could start the
looping script and it would fire up processes until things got
really busy and then not allow any more new procs to start until
some have stopped so cron and other system utilities don't stop
running which is what happens when systems get too busy.

Thanks for any constructive suggestions.

Martin McCormick   WB5AGZ



Re: What Needs to be Done here?

2020-05-27 Thread Martin McCormick
Andrei POPESCU  writes:
> apt(-get) is informing you that a configured repository has changed one
> of its values (in this case the 'Version', but could be any other
> field). This is to provide a safeguard against repositories changing
> values behind your back, possibly with security consequences.
> 
> Just imagine a malicious (or just incompetent) third-party repository
> suddenly claiming to be "buster-security" on a system configured to
> install security updates automatically.

It makes perfect sense to me.  Thanks to all who responded and
the fix worked as previously stated.

Martin McCormick



What Needs to be Done here?

2020-05-26 Thread Martin McCormick
$sudo apt-get update
[sudo] password for martin:
Get:1 http://security.debian.org buster/updates InRelease [65.4 kB]
Get:2 http://ftp.us.debian.org/debian buster InRelease [121 kB]
Get:3 http://ftp.us.debian.org/debian buster-updates InRelease [49.3 kB]
Get:4 http://security.debian.org buster/updates/main i386 Packages [201 kB]
Get:5 http://security.debian.org buster/updates/main Translation-en [109 kB]
Get:6 http://ftp.us.debian.org/debian buster/main i386 Packages [7,862 kB]
Get:7 http://ftp.us.debian.org/debian buster/main Translation-en [5,969 kB]
Get:8 http://ftp.us.debian.org/debian buster-updates/main i386 Packages [7,380 B
]
Get:9 http://ftp.us.debian.org/debian buster-updates/main Translation-en [5,166
B]
Fetched 14.4 MB in 54s (267 kB/s)
Reading package lists... Done
N: Repository 'http://ftp.us.debian.org/debian buster InRelease' changed its 'Ve
rsion' value from '10.0' to '10.4'

I think I saw this once before but don't remember how to
make it good.

Thanks

Martin McCormick



Re: Output from date command defaults to 12-hour in Buster.

2020-04-29 Thread Martin McCormick
Greg Wooledge  writes:
> It's an intentional change.  It's a "feature" from the libc developers'
> point of view.  As far as they are concerned, Americans use 12-hour
> clocks, so the en_US.utf8 locale is supposed to present times in 12-hour
> format by default.

This American is an amateur radio operator and before
that was a short wave listener since the age of around eleven and
grew to like the 24-hour clock since any given time occurs
exactly once per day.

One day, at work several years ago, I saw an outage
announcement for one of our departments for a service and started
to heat up under the collar because the outage was going to be
between 11:00 and 12:30 or something like that but the thermal
rise around the neck line soon cooled when I realized that it was
PM and AM so nothing terrible was about to happen as this would
have been cause for mutiny if it was the middle of the day.
> 
> The fact that many of us *don't* want times shown in that format is a
> preference, so it falls on us to configure our own environments according
> to our own tastes.

That's fine now that I know what is really happening and
everybody can go home happy.

I remember grousing to a coworker of mine as to when
would we start telling time like grownups around here,bla,bla,bla
and her response was,

"If you think we're going to start using military time, it's
never going to happen.

She, by the way, wasn't involved with the outage so we
were just having a conversation and I was glad I caught the AM
and PM parts before making a fool of myself which is easily done.

Martin



Re: Output from date command defaults to 12-hour in Buster.

2020-04-29 Thread Martin McCormick
Greg Wooledge  writes:
> On Tue, Apr 28, 2020 at 10:53:25PM -0600, Charles Curley wrote:
> > Adding
> >
> > alias date='date +"%a %b %d %T %Z %Y"'
> >
> > to one's .bashrc or /etc/bashrc should get the OP what he wants.

It did make just the date command work as desired.  I
actually tried that very thing maybe a year or so ago
and it worked, sort of.

Greg Wooledge continues:

> No, this is not a viable solution.  It will completely hinder your
> ability to use date with other format arguments, and it will not
> address the underlying problem, which is in the locale definition used
> by strftime(3) and similar pieces of libc.  (There are other programs
> that are affected by this, not just date(1).)
> 
> Setting LC_TIME=C is a much better answer.

I do appreciate the help.  I remember setting up the
alias, cheering when the date command worked, and then about 10
or 15 seconds later, swearing when something else, I forget what,
filled the screen with a cacophony of error messages and I
immediately realized why and put things back the way they had
been.

Martin



Re: Output from date command defaults to 12-hour in Buster.

2020-04-29 Thread Martin McCormick
Reco  writes:
> Hi.

> If you need it systemwide, consider doing this (will require relogin, at
> least):
> echo 'LC_TIME=C' >> /etc/default/locale

That was what I needed.  /etc/default/locale did not contain that
line but did contain 

#  File generated by update-locale
LANG="en_US.UTF-8"
> 
> If you need it for your user only (will require a new terminal emulator),
> 
> echo 'LC_TIME=C' >> ~/.bashrc


Many thanks to all who responded.

I had thought all along that I was dealing with a feature
rather than a bug because one of the beautiful things about the
philosophy of unix-like operating systems is that new
capabilities tend to layer on top of older behaviors so one can
enjoy the best of all worlds when it is practical and safe to
have this capability.

My first thought after making the change was that it had
had no effect but I was not completely logging out.  I run the
screen utility and so I stopped screen but was still logged in.
After getting down to the login prompt, logging in with the usual
username and password, not only did this installation work but I
happen to be running 2 other installations of buster on  other
old PC's and since the environment variable is exported with each
new screen window, their responses to the date command magically fixed
themselves.

Martin



Output from date command defaults to 12-hour in Buster.

2020-04-28 Thread Martin McCormick
In every flavor of unix I have used since I began learning unix
in 1989, the date command would produce a string containing the
current time in 24-hour format
similar to

Tue Apr 28 20:25:11 CDT 2020

If you run the date command in buster, you get

Tue 28 Apr 2020 08:26:24 PM CDT

One can cause date to run in 24-hour format but you have
to run date as follows:

date +"%a %b %d %T %Z %Y"

Some people have set their locale to British English and
now get the older-style 24-hour date format but setting the
locale is kind of an extreme way to do things.

Is there any environment variable or local configuration
variable which will make date produce the 24-hour time stamp
similar to past implementations of date?

Martin McCormick



Re: Microcom; What's this Script Feature?

2020-04-07 Thread Martin McCormick
I will reply to both excellent responses.  Thank you.
Dan Ritter  writes:
> Time to learn the awesome power of Linux.
> 
> Three ways to do this:
> 
> 1. shell script
> 
> Create a text file with the following two lines of code:
> 
> #!/bin/sh
> exec microcom -f -p/dev/ttyUSB4 -s9600
> 
> Name it something short and memorable, like serial
> 
> Then
> 
> chmod a+rx serial
> 
> And from then on, it's a program you can run.
> 
> 2. shell alias
> 
> Most shells have aliases available. In bash, you can stick them
> in your .bashrc file. Add this line:
> 
> alias serial='microcom -f -p/dev/ttyUSB4 -s9600'
> 
> and then re-evaluate your .bashrc (which is done automatically
> on login):
> 
> . .bashrc
> 
> Now you have a new command.
> 
> 3. shell function
> 
> Most shells have functions available, too. The difference
> between an alias and a function is that an alias is just a
> substitution, but a function can take arguments and perform
> complicated feats of logic. In this case, a function is
> overkill, but it's still easy to drop in to your .bashrc.
> 
> function serial {
> microcom -f -p/dev/ttyUSB4 -s9600
> }
> 
> 
> There you go.


Reco  writes:
> Hi.
> 
> Judging from the source it it should open a text file on your side (i.e.
> "x filename") and feed its contents line by line to the other side.
> So whatever you'll write in the file is specific to the device you're
> connecting to.
> 
> Reco

I could have done a better job of frasing my question as
I love the power of unix and use shell scripts and aliases
all the time.

What is confusing me about scripts in microcom is the
following situation:

I wanted to output device-specific commands and at least
see the responses much like the send/expect pairs in the expect
utility or the OUTPUT and INPUT commands in kermit scripts.

One starts the script while in the command mode of
microcom and it seems that your script should only contain
commands for microcom such as defining the port, speed, etc,
basically what the help screen says one can do.

It doesn't seem like you can put device-specific commands
in the script file.

I wrote a little script that exited command mode with the
exit command and then typed a command that was meant for the
device and then I typed x ./tester while in command mode.

It ran the "exit" command which put one in the terminal
window.  You could type things then and each thing you type went
right to the device.  I then removed the exit command and left a
command for the device.

It interpreted that command as being meant for microcom
so did not do anything but respond that it did not understand the
command.

microcom does work with expect but can't see the Carriage
Returns at the end of the lines returned by the device.  If you
know how the response should end, expect does see the ASCII
characters and moves on.  Otherwise, one must allow a reasonable
time such as 1 second for the timeout.

I was hoping there was some way to duplicate expect or
kermit with just the microcom app but this is not a show stopper
at all.  At least there is still a serial terminal that can talk
to devices whose only connection to the outside world is a RS-232
cable.

Again, thanks for everybody's help.

Martin McCormick



Re: Fwd: Serial Port Issues

2020-04-07 Thread Martin McCormick
deloptes  writes:
> Chris Rhodin wrote:
> 
> > Tonight I'll look at the serial port ioctls and see if I can spot a
> > difference there.  I also try enabling flow control and fiddling with 
> the
> > signals to see if that unstops it.
> 
> Are you sure that this is enabled in the BIOS, also some serial ports like
> HP have special connectors and layouts.
> Best would be to look at the manual first.
> 
> I have attached a USB to the server. From there I can log in to the
> firewall. I can not use the same port in the opposite direction.
> 
> However it is strange that you do get the connection only in one 
> direction.
> It could be some kind of special connector
> 
> Otherwise I used those to enable the service
> 
> https://wiki.debian.org/systemd#Virtual_and_serial_console_changes
> 
> https://www.thegeekdiary.com/centos-rhel-7-how-to-configure-serial-getty-with-systemd/
> https://wiki.archlinux.org/index.php/Working_with_the_serial_console

Another possible fly in the ointment could be a hardware
issue.  Some RS-232 ports are old-school and aren't happy with
any voltage range other than +12 for one state and -12 for the
other while there are serial ports that can handle state changes
of + or - 3 volts so they safely handle logic-level signals and
also can handle the old-school RS-232 levels.  Then there are
some that handle logic-level signals and would figuratively melt
if you hit them with +-12 volts.

Martin



Microcom; What's this Script Feature?

2020-04-07 Thread Martin McCormick
While working with Microcom, I tried the "help" feature while in
command mode and it works but there doesn't seem to be much other
information.  Here is a screen shot of a command I sent to a
serially-connected two-way radio followed by the Help screen for
microcom:  I put a * in front of the script command.


connected to /dev/ttyUSB4
Escape character: Ctrl-\
Type the escape character to get to the prompt.
VF 016250,0,0,0,0,0,0,00,00,000,,0,0
Enter command. Try 'help' for a list of builtin commands
-> help
speed - set terminal speed
exit - exit from command processing
flow - set flow control
dtr - set dtr value
rts - set rts value
break - send break
quit - quit microcom
help - show help
* x - execute a script
log - log to file
# - comment
md - Display memory (i.MX specific)
mw - write memory (i.MX specific)
mwb - write memory byte (i.MX specific)
mwh - write memory 2 byte (i.MX specific)
upload - upload image (i.MX specific)
connect - sync communication to Processor (i.MX specific)
sniff - sniff and dissect communication from ATK (i.MX specific)
->

Everything seems to work as far as I can tell but what
does a script look like?

I am sure it's kind of like expect or the old kermit
scripts but I haven't yet been able to send anything it liked.

The system I have been hacking on sends only carriage
returns in it's responses so what one gets on the screen is one
long line that gets over-written but that's no mystery.

The unix convention of typing the Up-Arrow and starting
microcom is very handy since one does not have to type

microcom -f -p/dev/ttyUSB4 -s9600
each time.  Actually, I usually get away with !mic followed by
Enter and it starts.  Good work to everybody who created this
useful little terminal program.

Martin McCormick

WB5AGZ since Oct of 1969



Re: I Miss ckermit in Buster.

2020-04-05 Thread Martin McCormick
I installed microcom and like it as it is very similar to
the functionality I had with ckermit.

I briefly thought of compiling from source but laziness
got the better of me and I am happy with microcom.

Expect is what I am using for scripting so I just took my
kermit scripts and saved the important strings and put those in
to an expect script.

This is what I love about unix.
I have had a little trouble getting the expect scripts to
be happy with the output from microcom but when you can exactly
define what should be there either literally or via a RE, it
works beautifully.

For some reason, "\r" and "\n" seem to never match and I
even tried "\r\n" and it just times out so the project I was
working with is accomplished by setting timeout in expect to 1
second but hopefully I can figure out what is wrong and make it
run at it's maximum speed.

Martin

The Wanderer  writes:
> On 2020-04-03 at 17:40, elvis wrote:
> 
> > On 3/4/20 11:04 pm, Martin McCormick wrote:
> >
> >> The only thing that I truly miss after upgrading to buster is that
> >> the package known as ckermit has fallen beside the road.
> >>
> >> I had a hard-drive fail on one system so installed buster from
> >> installation media and the ckermit package apparently isn't part of
> >> the distribution any more.
> >
> > Have you tried compiling from source? Just because it wasn't
> > packaged, doesn't mean that you can't try installing it yourself...
> > does it say why it was dropped anywhere?
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=918061 and
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921098 are the best
> I've found on it.
> 
> Basically, no maintainer activity in years, and multiple RC bugs.
> 
> If there's an upstream active enough that any upstream aspects of the RC
> bugs can be addressed, and if someone were to volunteer to maintain it
> and fix any packaging-related aspects of the RC bugs, there's probably
> no reason this couldn't be reintroduced. Depending on what those bugs
> were (I haven't bothered digging for that info), that might be a tall
> order, or it might be trivial.
> 
> --
>The Wanderer
> 
> The reasonable man adapts himself to the world; the unreasonable one
> persists in trying to adapt the world to himself. Therefore all
> progress depends on the unreasonable man. -- George Bernard Shaw
> 
> 
> <>
> 



Re: I Miss ckermit in Buster.

2020-04-03 Thread Martin McCormick
Greg Wooledge  writes:
> On Fri, Apr 03, 2020 at 08:14:12AM -0500, John Hasler wrote:
> > Look at gkermit.  It's evidently a GPL rewrite of ckermit.  Also take a
> > look at screen.
> 
> Yeah, I did an "apt-cache search ckermit" too.
> 
> The package description for gkermit says,
> 
>   The non-free package ckermit adds connection
>   establishment, character-set translation and scripting features.
> 
> Looks like that sentence is out of date now.  But it's not clear whether
> the additional functionality has been merged into gkermit, or is simply
> *gone*.

I appreciate the responses.  It looks like gkermit is
just the file transfer which is good that it still exists but I
want the stuff that is gone such as scripting and the ability to
type things that go out over the serial port and receive
anything that comes in without having to write a whole new
program each time.


John Hasler  writes:
 > look at screen.

I use screen all the time and maybe I am missing
something but what you get with screen is a new shell in each
window, very useful but nothing to do with RS-232 ports.

Martin



I Miss ckermit in Buster.

2020-04-03 Thread Martin McCormick
The only thing that I truly miss after upgrading to
buster is that the package known as ckermit has fallen beside the
road.

I had a hard-drive fail on one system so installed buster
from installation media and the ckermit package apparently isn't
part of the distribution any more.

There are 2 other buster systems sitting here that still
have kermit because they got their buster upgrades the nice way
and didn't commit suicide so if I knew a little more, I could
obviously  copy the .deb package over to the kermitless system
and make things right or could I?

I am not really interested in the kermit file transfer
protocol although it is always possible one might need it but the
kermit VTxx terminal emulator made it easy to talk to and receive
from a RS-232 port.

One thing one could do with ckermit was write rather
clunky scripts that could mechanize RS-232 communications if you
needed to do that.

Basically, what is the best way in command-line mode to
deal with serial comm ports these days?

Thanks.

Martin McCormick



Re: Things Kids Shouldn't Do at Home

2020-04-02 Thread Martin McCormick
My thanks to all those who theorise that it was this particular
drive's time to die.  It is several years old and I was thinking
along the lines that the rest of you were thinking.  One thing I
haven't done yet is to see if the clock crystal  that drives the
internal usb controller is still active.  I am not sure what
frequency it should free run on but one can sometimes hear the
clock on a general-coverage short wave radio receiver or
scanner-type receiver.

What one hears is a signal that usually sounds like a
continuous carrier with no modulation.  It's there when the drive
is powered up and goes away when the drive is disconnected.


Thanks.

Martin
WB5AGZ

local10  writes:
 On 2020-04-01 18:07, Martin McCormick wrote:
> 
> >>  Out of curiosity, I wondered what might happen if I had
> >> two thumb drives containing the same UUID.
> >>
> 
> Nothing bad really unless the system is supposed to boot from one of them 
> and both are present in the system at boot time.
> 
> I have two HDDs (main one and backup one) where partitions on the backup 
> HDD have the same UUIDs as partitions on the main HDD. This was done on 
> purpose to simplify backups and to have backup HDD to be readily 
> available to replace the main HDD. I copied data between the two of them 
> many times without any issues whatsoever.
> 
> If necessary, you can change UUID with tune2fs:
> # tune2fs /dev/{device} -U {uuid}
> 
> Regards,
> 
> 



Things Kids Shouldn't Do at Home

2020-04-01 Thread Martin McCormick
I have killed an 8 GB thumb drive while doing an experiment.

I had 2 8 GB PNY drives.  One has a FAT 32 file system
and the other had no partitions on it as I had deleted the ones
that were there.

The good drive had it's UUID tagged to mount on a
directory I called /flash.  The fstab entry is

UUID="3453-A839" /flash vfat rw,user,noauto  0   0
#UUID="5A0D-76AA" /flash vfat rw,user,noauto  0   0

I decided to make a full copy of the good drive to an
identical PNY 8 GB drive which was the one with all the
partitions deleted.

The good drive was /dev/sde and the soon to be murdered
drive was /dev/sdd so my copy command was:

dd if=/dev/sde of=/dev/sdd

It worked and I now had two drives with the same UUID.

I mounted the doomed drive as /flash and did a rm -r
/flash/* so now I had an empty drive whose UUID is the same as
the good drive.

Out of curiosity, I wondered what might happen if I had
two thumb drives containing the same UUID.

After plugging both in to a usb extender, the good drive
is still good.  That's the one whose files I did not delete.

The drive I killed now does not register anything at all.
It's as if nothing had been plugged in to any USB port.  I
plugged it in to another debian system that didn't witness any of
what I had just done and absolutely nothing happened there
either.

There is no data emergency here, but what on Earth did I
do to the empty drive to make it not even show an error in
syslog?

I am sure that having two devices with the same UUID is
not good, but I expected some sort of error message, not a total
destruction of one of the two drives.

The now dead drive was behaving normally until I plugged
them both in at once.

I was going to do a mount /flash and see what the system
did but it appears that just having both drives plugged in was
sufficient to draw some blood, so to speak, somewhere.

The good drive contains some ebooks and I was planning
to put different ebooks on the dead drive but that is not going
to happen unless I can make the dead drive show up again.

Are there any open-source rescue programs in Linux that
one can run to mess with the on-board controller of the thumb
drive?  This obviously killed the target drive since it was
working right up to when it stopped working.

    Thanks.

Martin McCormick
WB5AGZ



Re: Running virtual systems

2020-02-12 Thread Martin McCormick
I ran Freebsd as a virtual system on a Mac Pro at work
for a year or so (I don't remember exactly how long) and it
worked very well with vbox until one day when Apple updated MacOS
and poof! my vm died.

The only problem I had before that was one most people
wouldn't have in that the low-level setup of the VM sent it's
output in video rather than text so anyone who uses a screen
reader can't rescue it easily if it gets in to trouble at that
point.

As soon as the VM boots, the output you would see on a
console or serial terminal appears in the host's output and one
can run it normally from there.

The one lesson is Linux or FreeBSD is probably a better
host platform because stuff that works under either of those two
OS's tends to stay longer and isn't apt to fall casualty to
commercial whims.

I still mostly like MacOS and even Windows these days but
having the machine my mail was on just suddenly vaporize without
any warning soured me a bit and I never put another VM on that
Mac.

Martin

David Christensen  writes:
> I typically enable all CPU virtualization features in CMOS Setup, and
> assume the various virtualization solutions will make use of them.
> 
> 
> 
> I use FreeBSD and jails for 24x7 services (CVS and Samba).
> 
> 
> 
> I have used VirtualBox on Debian Xfce and macOS hosts over the past 
> several
> years. The GUI manager is convenient for a few VM's, but would be a 
> problem
> for many VM's. I recall setting up headless VM's for services, but for get
> the details. I ran a Debian Xfce graphical desktop VM in VirtualBox on
> macOS for nearly a year, but key mapping/ binding was a constant nuisance
> and graphics was adversely impacted (especially multimedia). Graphical
> desktop environments, such as Xfce and Windows, are best installed 
> directly
> on hardware. Be sure to pick hardware for which Windows 10 is actively
> supported by the manufacturer.
> 
> 
> 
> David
> 
> 



Re: Using a Debian Live image to Invoke a Rescue Shell

2020-02-12 Thread Martin McCormick
Andrei POPESCU  writes:
> From memory, I'm aware of two methods:
> 
> 1. Any time after starting the installer, press Ctrl+F2 and there will
> be a prompt to press Enter to enable the console. Ctrl+F1 returns to the
> installer.
> 
> If using the graphical installer you will need Ctrl+Alt+F2 and Ctrl+F5
> will should get you back to the installer.
> 
> 2. Start the installer in "rescue mode". After doing some basic
> configuration it will ask you about the root and will offer to start a
> shell. For your purposes chose "open a shell in the installer
> environment", because you don't want to touch your system.
> 
> As mentioned above, this is all from memory, it's been a while since I
> used the installer.

The Control-F2 did it although there was no prompt, at
least I didn't hear one.  The console showed a shell prompt and I
started poking around.  This was the buster image and the only
disappointment was no fdisk.  I found /dev/sda, /dev/sdb and,
after plugging in the 1 TB target drive, /dev/sdc.

As a card-carrying coward, I made sure that /dev/sdc was
the device that wasn't there just a few seconds ago and is here
now.

This particular PC is of the HP Pavilion family and I was
surprised to find 2 hard drives in a stack as Windows is on a
single 1 TB logical drive.  One would have had to disassemble the
system to be able to see the drives and since this is a fairly
new system as of February, 2019, it seemed prudent to take as
little apart as possible.

My heart sank when I saw /dev/sda and /dev/sdb.  If this
is some sort of software raid, it might be that /dev/sda and
/dev/db would be parts of the system and using dd from sda to sdc
would yield a useless dump of stuff that only would be useful if
you also dumped /dev/sdb and then used some software to combine
them back to 1 drive, but read on.

I dumped /dev/sda to /dev/sdc

dd if=/dev/sda of=/dev/sdc

After a deep breath, I hit Enter.  The dump started at about 4:30
PM and was still churning along at 9:30 last night.

When I checked on it a bit after 05:00 this morning, it had
stopped, showing the same number of records in and out and no
squawks.

There are 5 partitions in the image and it looks like
Partition 3 is the user work space.

After setting the debian system to be able to mount ntfs,
it mounts read-only with some complaints about it being uncleanly
mounted but one does appear to be able to read everything.

So, What was /dev/sdb?

It's a linux image put there by the installer, I guess to
use as a virtual disk when one installs it to a new system.

Since I don't have another 1 TB drive, I put a 128-GB
drive in and after

dd if=/dev/sdb of=/dev/sdc

as /dev/sdc was now the 128-GB drive, I got a finish after a few
minutes.  Mounting that drive, I saw the Linux image and the
README.txt file said what it was.

I am so thankful for the fact that many linux images can
be made to boot with the screen reader able to work as I was able
to do all of this without needing anybody to look at the screen.

The tinkering environment in Windows is still not
anywhere near as solid as it is in unix.

About the only thing these days that is still
inaccessible on most computers that aren't enterprise servers,
etc, is the BIOS setup and selection of boot sources.  That's
still back in the stone age.

Many thanks to everyone who helped with information.

Martin



Re: usb Confusion

2020-02-11 Thread Martin McCormick
Things are much better here.  Tech Support at Crucial insisted
that every drive they ship out contains 1 usb-C to usb-C cable
and an adapter to make it fit a usb-A port.  I figure it had
accidentally been discarded as trash or was really left out but I
kept looking and found the little box the drive came in.

There is a small pocket in the tray containing a pamflet
that one suddenly realizes is too deep to be just the booklet.

Everything was there and I do believe that is the first
usb-C cable I have ever encountered.

Again, thanks for clearing up the confusion.

Martin McCormick



Re: usb Confusion

2020-02-11 Thread Martin McCormick
Dan Ritter  writes:
> If I recall correctly, Martin doesn't see well, which explains a
> chunk of the confusion here.

Well, my wife has excellent vision and we were talking
about how pictures can be almost worthless after a certain point.
Several of those small connectors look similar.  A Lightning
connector is about the same size as a microusb but the microusb
has 2 little key ways on one side that insure it can only be put
in facing one way.
> 
> Martin: Crucial is probably describing the other end of the
> cable they supplied -- assuming they supplied a cable. It might
> be proprietary at one end and USB type A at the other. But what
> you are describing could also be USB type C at one end.

There was nothing in the box except the drive which is
the reason for the confusion.

I thought the microusb with the 2 key ways was a type C
and that's when I learned it wasn't when one of those wouldn't
fit either way.

> 
> >   What is the correct nomenclature for the most common usb
> > connector that has been around for 25 or 30 years and fits the
> > vast majority of devices using usb?
> 
> USB type A is rectangular and common on PC ends.
> 
> USB type B is trapezoidal, almost square, and common on printers
> and other largish peripherals.

That's what I always thought.  This makes all the sense
in the world.

> 
> USB type B-mini is trapezoidal, very small, and has distinct
> indentations on the top left and right sides. It was common for
> small peripherals like MP3 players.
> 
> USB type B-micro is flatter than B-mini and does not have
> indentations. It is common for cell phones and small
> peripherals.
> 
> USB type C is about the size of a lightning connector, rounded
> on both sides, and is designed to go in upside down or rightside
> up without causing problems.

I guess I was confused about the microusb versus the usb-C.

I am about to call Crucial Tech Support and get straight
on the end that goes in the drive.

Anyway, I appreciate the information.  Thank you.

Martin



usb Confusion

2020-02-11 Thread Martin McCormick
After recently ordering and receiving a new 1 TB external
SSD drive, I realized I had no way to connect it.  It has a small
rectangular slot about 8 MM or a quarter of an inch long.  A Mac
lightning connector is almost exactly the same size but
fortunately doesn't plug in but that's the size of whatever fits.
Crucial says it is usb-A .

What is the correct nomenclature for the most common usb
connector that has been around for 25 or 30 years and fits the
vast majority of devices using usb?

I'll need a cable that fits the old standard usb port on
one end and the disk drive on the other.

There's an old saying:  "Standards are great.  Everybody
should have one."

Thanks.

Martin McCormick



Using a Debian Live image to Invoke a Rescue Shell

2020-02-11 Thread Martin McCormick
I don't know if things have changed or I forgot how to do this
but I want to boot in to a Debian image and not install it but
invoke a shell so as to clone the hard drive on a Windows machine
to an external hard drive.

For computer users who are blind, this is a real boon in
situations like this because most Linux systems these days can be
made to boot talking by striking S when the OS starts to boot.

You hear, in English first, "Choose your language."

It is, of course, the same setup screen everybody sees so
one needs to set language, keyboard and general location to get
started.

If one wants, they can go through the setup and install
the whole works but, in this case, I am doing this because I had
a stupid moment and wiped out my Windows home directory
after a batch file (shell script) got away from me and zapped
every file in my home directory instead of one folder I was
trying to zero out.  Go ahead and laugh.

The idea is to clone the internal drive and then try
recovering the deleted files.  If something further goes wrong,
I've still got all the pieces.

I remember doing this same thing a few years ago and
there is some way to break out of the setup screen and invoke a
bash-like shell in order to run mount/umount and dd.  Since I
boot it talking, all these applications still talk.  After all,
it's unix and the speech synthesizer was patched in to standard
output right from boot.  I don't remember exactly what special
key sequence I hit to invoke the shell but need to refresh my
memory or learn the new procedure.

After learning how to get a relatively new HP Pavilion to
boot from a usb device, I think that most all the UFI-bootable
images will boot.  The one I just tried which did boot is
debian-10.2.0-amd64-DVD-1.iso

I've also got

debian-live-10.2.0-amd64-mate.iso and debian-10.3.0-amd64-netinst.iso

The netinst image is only 350 MB while the dvd-1 image is
about 4 GB.  The mate image is around 2.5 GB.

Thanks for any and all constructive suggestions as to how
to go from Setup to recovery shell.

Martin McCormick



So Far No usb Boot HP Pavillion

2020-02-08 Thread Martin McCormick
Here is the system info:

OS Name:   Microsoft Windows 10 Home
OS Version:10.0.17763 N/A Build 17763
OS Build Type: Multiprocessor Free
System Model:  HP Pavilion Desktop 590-p0xxx
System Type:   x64-based PC
Processor(s):  1 Processor(s) Installed.
   [01]: AMD64 Family 23 Model 17 Stepping 0 
AuthenticAMD ~1600 Mhz
BIOS Version:  AMI F.15, 7/24/2018

In order to theoretically make this system boot from a
usb port, one must go in to BIOS settings and disable secureboot
then change the boot sequence order such that the first boot
device is usb/CDROM/floppy followed by the inturnal hard drive.

We did all that and, when you do that, the system puts
out a code that you enter on next boot, okaying the change.

A friend and I did all that and it still works booting
Windows, but I want to boot debian in order to mount the hard
drive and make a clone to another usb-mounted 1 TB drive because
I deleted some files I'd like to get back and better safe than
sorry.  Fortunately, the drive only had 60 GB out of 1 TB  used
and the Recycle Bin had not been emptied so it's possible I
should get back the 2 or 3 files I really want, the rest being
expendable but a clone drive to play with is better than playing
with the internal drive.

Here is the iso image I got to boot Debian:

debian-live-10.2.0-amd64-mate.iso

The iso image is about 2.5 GB and I have tried both a 4
and an 8 GB thumb drive, using the command

sudo dd if=debian-live-10.2.0-amd64-mate.iso of=/dev/sde

Of course the OF= command will vary depending on how many drives
are connected to your PC.

When starting from power off, the system blows by the usb
boot drive like it wasn't there.  End of story.

The system otherwise still works as before.  I did try a
bootable CDROM and heard a slight convulsion of activity in the
CDR drive but then realized it was a 32-bit version so of course
it didn't boot.

Any other ideas as to how I can get this project off of
high center?  It might be interesting to try an old-school CDROM
of any of the recent debian versions if I can find an image that
fits on a 650-MB disk as I don't have any writable DVD's and am
not sure if any of the drives I have can burn a DVD.  The image
would also need to be for AMD64.

Any constructive suggestions are much appreciated.

Martin McCormick



debian format usb drive that a Mac likes

2020-02-04 Thread Martin McCormick
If one is on a debian system and formatting a usb drive
that will be recognized by a Mac, I know that xfs is usually a
good choice for the file system but
what type of partition are we supposed to use to enclose that xfs
file system?

I know if you plug a linux thumb drive in to a Mac, the
Mac says it can't read the disk and immediately offers to
initialize it for you.

Thanks.

Martin McCormick



Pub Key Exchange Between Buster and Windows10

2019-12-31 Thread Martin McCormick
It was great news to find out that Windows10 includes an
openssh client and server and I got the Windows10 system and one
Debian Buster system to communicate via ssh/scp which is all
good.  The final step of getting them to connect via shared
public keys is good from the Windows box to the debian box but
not completely the other way around as in debian trying to log in to
Windows10.

On the Windows box via powershell, I ran ssh-keygen -trsa
which gave the usual prompts for a passfrase and produced the
usual public and private keys in .ssh so I then  copied
id_rsa.pub from my .ssh directory on the Linux box to
authorized_keys on the Windows box after running it through
unix2dos to fix \n.

I then ran dos2unix on the new Windows box's
.ssh/id_rsa.pub to make it suitable for unix and added it to
.ssh/authorized_keys.

Both machines have each other's key in .ssh/known_hosts.
Here's what happens.

Going from Windows to Linux, no password is needed to
remotely execute commands on the Linux system.  For some reason,
right now, if I try to execute Windows commands remotely from the
Linux box, I must always enter the password to the Windows box
and the command runs so the glass is 75% full.

The Win10 box generated an id_rsa.pub key which is 404
bytes long.  The id_rsa.pub key I generated back in 2016 on the
Linux box is 395 bytes long.  Each files is one byte longer in
Windows because of the \n convention being 0x0d0a in Windows and
0x0a in unix.

Any idea as to why the Windows box doesn't seem to accept
the Linux credentials?  When I do enter the password, everything
runs fine but I would rather not use the password in scripts on
one system that are running commands on the other.

What I have got right now is usable but not right.  Any
constructive ideas are appreciated.

Thank you

Martin McCormick



Re: Easiest Way to forward an email Message from Linux to a Mac

2019-11-04 Thread Martin McCormick
Greg Wooledge  writes:
> Either you didn't run "apt-get update" first, or your mirror is out of
> sync.  The current version of dovecot-core in buster is 
> 1:2.3.4.1-5+deb10u1.

Thank you.  It was the former.  I failed to run apt-get
update but I didn't just forget.  Ever since I upgraded to
buster, I see a line in syslog that goes:

Nov  4 06:10:01 wb5agz systemd[1]: Starting Daily apt upgrade and clean 
activities...

Before buster, I would run sudo apt-get update and then sudo
apt-get upgrade.  I thought the cron job had done this
automatically this morning when it ran.  After running apt-get
update, all was quite well.

Martin



Re: Easiest Way to forward an email Message from Linux to a Mac

2019-11-04 Thread Martin McCormick
Bob Weber  writes:
> Why not create a user on the Linux box to receive such emails and have the
> MAC client connect to that user on the Linux box.  You might have to
> install a pop server (popa3d ... easiest to install and configure) or imac
> server (dovecot-imapd ... harder to configure and probably more than you
> need) on the Linux box if one isn't installed already.

It looked for a bit like this should just work in that I entered:

apt-get install dovecot-imapd

The following NEW packages will be installed:
  dovecot-core dovecot-imapd libexttextcat-2.0-0 libexttextcat-data
  liblua5.3-0 libstemmer0d ssl-cert
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,344 kB/5,750 kB of archives.
After this operation, 14.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] yes

Then the wheels flew off:

Err:1 http://ftp.us.debian.org/debian buster/main i386 dovecot-core i386 1:2.3.4
.1-5
  404  Not Found [IP: 208.80.154.15 80]
Err:2 http://ftp.us.debian.org/debian buster/main i386 dovecot-imapd i386 1:2.3.
4.1-5
  404  Not Found [IP: 208.80.154.15 80]
E: Failed to fetch http://ftp.us.debian.org/debian/pool/main/d/dovecot/dovecot-c
ore_2.3.4.1-5_i386.deb  404  Not Found [IP: 208.80.154.15 80]
E: Failed to fetch http://ftp.us.debian.org/debian/pool/main/d/dovecot/dovecot-i
mapd_2.3.4.1-5_i386.deb  404  Not Found [IP: 208.80.154.15 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-mis
sing?


I ran the following to be safe:

wb5agz martin tmp $ sudo apt-get purge dovecot-imapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'dovecot-imapd' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

At least nothing got partly installed but stuff is
obviously not quite right.

Is it safe to try that suggestion?

Martin



Re: Easiest Way to forward an email Message from Linux to a Mac

2019-11-02 Thread Martin McCormick
Bob Weber  writes:
> 
> 
> Why not create a user on the Linux box to receive such emails and have the
> MAC client connect to that user on the Linux box.  You might have to
> install a pop server (popa3d ... easiest to install and configure) or imac
> server (dovecot-imapd ... harder to configure and probably more than you
> need) on the Linux box if one isn't installed already.
> 
> 
> 
> Your MAC would have to have an email client capable of connecting to a pop
> or imac mailbox at the ip of the Linux box or host name in the hosts file
> corresponding to the Linux box.

Thank you.  That is essentially what I am thinking of.  I
setup a similar setup before I retired.  The only difference was
that all of the hosts at work had fully-qualified domain names
but dovecot worked fine on the Linux box and the mac received any
mail I sent without any problem.

Martin McCormick



Easiest Way to forward an email Message from Linux to a Mac

2019-11-02 Thread Martin McCormick
Here is the setup.  We are on a private vlan as in 192.168.x.x.
All local host names are resolved via hosts files.  Messages to
go to the big wide world must go through Suddenlink's SMTP
smarthost and I definitely don't want to break that.

On rare occasions, I want to forward an email to the Mac
which normally doesn't send or receive emails.  What would be the
simplest way to "forward" an email from the Linux box to the
Mac's mailer?

The Mac only needs to be able to receive, not send any
email.

Thank you

Martin WB5AGZ



PrintScreen Key on Older Dell

2019-10-10 Thread Martin McCormick
I have connected a parallel-to-serial converter to a Dell
Dimension and am getting output which I can save on another
system using kermit.  I want to go through the BIOS setup
routine while capturing the session.  Here is a sample of the
opening screen of the BIOS setup


Dell Computer Corporation (www.dell.com)
 Page 1 of 2   Precision WorkStation 210 MT Setup BIOS Version: A07 
³   
 Time:  21:33:54   Date:  Thu Oct 10, 2019  ³ This category sets the time in
³ 24-hour format (hours:minutes:
  Diskette Drive A:   3.5 inch, 1.44 MB ³ seconds) for the internal clock/  
  Diskette Drive B: Not Installed   ³ calendar. 
³   
 Drives:³ To change the value in a field,   
 Primary   Type Cyls Hds  Pre   LZ Sec Size ³ enter a number or use the left-   
  Drive 0: AutoEIDE Drive 65533 ³ or right-arrow key.   
  Drive 1: None ³   
 Secondary  ³ Changes take effect immediately.  
  Drive 0: None ³   
  Drive 1: None ³   
³   
   Reserved Memory: NoneÃÄÄÄ
 CPU Speed:600 MHz  ³  Pentiumø III Processor - 600MHz  
  Num Lock:  On ³ CPU ID: 681   
 Chassis Intrusion:  Not Detected   ³  Level 2 Cache: 256 KB Integrated 
 Thermal Power-off:Enabled  ³  System Memory: 1024 MB SDRAM 
   Video DAC Snoop:  Off³Service Tag: H8UD1 
³   
ÁÄÄÄ
 Tab,Shift-Tab change fields³ change values³Alt-P next³Esc exit³Alt-B reboot 

The printer interface is obviously working even if what
comes out is a bit de-formatted but I seem to recall, there may
be a key sequence one can hit to cause printscreen to essentially
stay in effect and echo a continuous log as one does things such
as go through the setup.

What you saw was what happens when striking the PrintScrn
Key.  I tried Control-Printscrn and got nothing.  Shift-printscrn
just did the same thing as printscrn by itself.

Is there anything else I can try?

Martin McCormick



gzip and old files Solved.

2019-08-20 Thread Martin McCormick
This exercise was a good training session and was sort of
a trip down Memory Lane.  I am thankful that floppy disks are
mostly history but as long as the hardware is still there, it was
good to get useful tools that can on rare occasions, get one out
of a jam.

One of the things I learned while working with tomsrtbt
is that while it is possible to format 1.4 MB floppies to 1.7
megabytes, we must take care to make sure we know we are working
with one of the over-stuffed disks.

If you use the normal mount command such as

mount /media/floppy or some variation of that theme, the OS will
try to mount it as a 1.4 MB diskette and the mount will succeed
but nothing else will.

If you write to such a disk, you'll probably ruin it's
contents so if it is a valuable archive of some kind, you will
have trashed it.

If in doubt, slide the Write-Protect tab so that the hole
it covers is open.  That way nothing can trigger a write.

You can add a device to /dev that makes the drive run on
21 sectors/82 tracks as in

#sudo mknod /dev/fd0u1722 b 2 60
#sudo mount /dev/fd0u1722 /media/floppy

When you mount it properly, it behaves like all the other
possible formats.  If you mount a 1.72 disk the wrong way so the
system thinks it is 1.4 MB, an empty diskette will show lots of
dots .

$mount /media/floppy
mount: /media/floppy0: WARNING: device write-protected, mounted read-only.
$ls /media/floppy
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
.÷÷÷  .÷÷÷  .÷÷÷  .÷÷÷
$umount /media/floppy

That was a 1.7 MB mounted wrongly as 1.4 MB.  Here is the same
empty diskette mounted correctly.

$sudo mount /dev/fd0u1722 /media/floppy
mount: /media/floppy0: WARNING: device write-protected, mounted read-only.
$ls /media/floppy
$df -h /media/floppy
Filesystem  Size  Used Avail Use% Mounted on
/dev/fd0u1722   1.7M 0  1.7M   0% /media/floppy0
$exit

If the disk is empty, df -h will still show it as 1.7
which is okay but a populated 1.7 MB diskette will lie to you by
not showing it's capacity.

Here is a full disk mounted wrong.

$mount /media/floppy
mount: /media/floppy0: WARNING: device write-protected, mounted read-only.
$ls /media/floppy
boot.b  bz2bzImage  map  rc.custom.gz  settings.s
$df -h /media/floppy
Filesystem  Size  Used Avail Use% Mounted on
/dev/fd0862K  836K   26K  97% /media/floppy0
$exit

There was nothing shown for capacity.

The rc.custom.gz file that was corrupt was really not
corrupt when mounted correctly and writing the modified zip file
back to the disk worked perfectly as long as the disk has no bad
sectors.

Let's see.  If I was going to backup the hard drive on my
main Linux box, I'd need about 300-thousand of these storage
items so I thought I'd put it in a modern perspective.

The last floppy backup I did was around 2006 or so and I
don't miss not doing them at all, especially now with 512 GB hard
drives.

If you ever end up recovering any data with floppies,
write protect them especially if you are not sure how they were
made in the first place.  

Martin McCormick



gzip and old files Partly Solved

2019-08-19 Thread Martin McCormick
Greg Wooledge  writes:
> Sounds unlikely.
> 
> > $ gzip -d rc.custom.gz
> >
> > gzip: rc.custom.gz: not in gzip format
> 
> Where did you get this file?

tomsrtbt-2.0.103

Here's what happened:

The rc.custom.gz file you posted is 961 bytes long.  My
corrupt copy is also 961 bytes long and file describes it as
data.

>  What does file(1) say about it?

$ file rc.custom.gz
rc.custom.gz: data

>  How about
> gzip --test?

$ gzip --test rc.custom.gz
gzip: rc.custom.gz: not in gzip format

> I think it's more likely that your file is corrupt, than that gzip has
> decided to become incompatible with itself.

Fortunately, this turns out to be correct.

The file you posted unzipped with gzip -d on my system
with no issue at all.

The good file has a checksum of
10349 1

The bad version of the same file's checksum is

13550 1.

I mounted tomsrtbt.raw with 
mount -o loop tomsrtbt.raw  /mnt
and that rc.custom.gz also has a checksum of
10349 1

The install.s script has one to put a blank floppy in to
the drive and does dd if=tomsrtbt.raw of=/dev/fd0 with a record
count and somehow, that original diskette passed all the tests,
seems to boot right up and let me start a serial console on it
without so much as a single error.

There is enough of this that is enough different from
today's world that I thought things were much worse than they
turned out to be.  I am amazed that the corrupted disk worked at
all.

    Thanks for clearing up the confusion.

Martin McCormick



gzip and old files

2019-08-19 Thread Martin McCormick
I am trying to unzip rc.custom.gz from tomsrtbt so I can
give it a serial console. All you need do is modify /etc/inittab
and add a line defining one of the serial ports as a console
login. 

Normally, this is trivial and one should just give the
command

gzip -d rc.custom.gz

and, assuming /etc/inittab becomes accessible, edit it and gzip
it back up and replace the old rc.custom.gz with the new one.

The problem is that in 2002, gzip apparently worked
differently so if you use modern gzip on it, it just complains

$ gzip -d rc.custom.gz

gzip: rc.custom.gz: not in gzip format

I tried tar zxf as some suggested in searches of
discussion lists so the problem is most likely related to
different libraries used back then compared with ones we have now.

For those who may not know, tomsrtbt is a clever bit of
obsolete technology that crams an incredible amount of Linux on
to a 1.7 MB floppy.  That is actually a standard 1.4 MB floppy
which is formatted with the sectors squeezed more tightly
together, giving you 82 tracks and 21 sectors per track as well
as a warning that it could harm your floppy drive although most
just work fine without complaint.

Is there a reasonable way to uncompress this archive?

The documentation written with tomsrtbt contains a line
stating,

Of course, you have to uncompress rc.custom with gzip -d
to edit anything within, but the impression I get is that this
command worked back then.

He also mentioned all the tools on the disk worked
against libc5 so one probably needs a $LOAD_LIBRARY_PATH pointing
to a working version of that lib.

I got a serial console going on tomsrtbt by booting it
up, going in to /etc/inittab and adding a serial tty which
one must activate by kill -HUP 1.  It worked but I would like to
make a disk that just starts that way.

Any good ideas are appreciated.

If I could find the right rock to turn over, I might find
a libc5 to wakeup what's already on the disk.

This is certainly not urgent but I feel like this is a
good training session if nothing else.

Most of the standard unix utilities like ls, mount cd and
a bunch more are there and work properly as nearly as I can tell.

Martin McCormick



Re: .uvc WebCam Data

2019-08-12 Thread Martin McCormick
Dan Ritter  writes:
> fswebcam is a package that captures images from V4L2 devices.
> It's command-line driven and has a few useful features like
> resizing, averaging multiple frames, and skipping early frames
> for devices that take a while to focus. It writes JPEG or PNG.
> 
> Remember to make yourself part of the video group.

Oh, yes.  Interestingly enough, I am part of that group.  I was
going to do that and first did groups martin and, what do you
know, I'm already in the group.  How I got there I do not know.

So, here's what has happened and it's all good so far.

After much soul-searching which should precede any outlay
of 400 US Dollars, I bit the bullet and bought an Epiphan
AVIO-HD.

The linux kernel immediately recognized it and then the
fun started.

I finally got fswebcam setup after some fumbling around
an plugged the VGA cable in to the appropriate socket on the
video card.

I captured a picture and sent it to my wife's iPhone and
she said it was just a black screen.  I knew it should have
basically been a screen shot of my Linux box since I was logged
in via tty1, I think, but it's the first console anyway.

That was yesterday afternoon when the AVIO arrived so
this morning, I moved the VGA connection to another Linux box
whose VGA card only has one output.

Interestingly, the AVIO-HD generates frames of nothing
even when the VGA cable is disconnected and hanging in space or
lying on the table.  The JPG files are about 4 KB in size and
fswebcam says it harvested however many frames one asked for.

I made this discovery the way I discover a lot of stuff,
sort of like oh  wow! It makes the same length file plugged in as
it is making with the end of the cable in my hand.

When plugged in to the VGA socket on the other Linux box,
I was encouraged because the size of the captured frames always
showed about 10 K instead of 4 K.

I also downloaded tesseract and several other utilities
such as sane plus a jpg from a site which has sample scans taken
with real cameras and paper pages.

The tesseract utility flawlessly converted the sample jpg
in to ASCII text so I tried that
other Linux box's VGA port.  This certainly looks like not much
of anything but I was happy to get it:

Debian GNU/Linux 10 audios tty

audio3 login: [43431.294393] print_req_error: 1/0 error, dev fd0, sector 0
[43431.338633] print_reqerror: 1/0 error, dev fdo, sector 0

I guess I may have stuck a blank disk in to the drive or
something as it looks like it is complaining about being unable
to read the floppy disk.  It also may be left over from booting
as the floppy is the first boot source and empty.

I also have a small device that closely resembles an
infant-sized PC tower that I payed a whole Dollar for at a flea
market.  The back panel has two usb ports, two RS-232 DB9 ports,
audio jacks, a DB25 printer port , RJ45 Ethernet socket
and a VGA socket just like PC's of 15 or 20
years ago.  If you plug headphones in to the Line-out jack, you
get a short beep after pressing the power button.  What would
it's VGA jack say?

Acute Network Technologies

ThinCast 5000

I looked that up and it is a client terminal-like device
that is meant as a work station in some institution.

Depending on how many resources it has, one might be able
to load a Linux kernel but I am not holding my breath.

Anyway, I want to thank everybody who supplied helpful
information.  The tesseract OCR, so far, exceeds my expectations
of it's ability to decode the VGA text from just 1 frame of
capture.  I think I can do BIOS setups, probably much more
slowly, but still it beats wasting other people's time especially
when one runs in to a situation where stuff isn't quite right and
one has to revisit the same task several times before things
shake out correctly.  It is also possible to save the screen
shots for posterity which is nice if you haven't done some task
in a year or so and are having to remind yourself what you did.

By the way, the black screen on the first Linux system
was due to the fact that the video card has a VGA socket and
possibly a DVI socket.  The video is on the DVI socket most
likely and the VGA socket has no signal, explaining the black
screen of nothing.

    Thanks to all!

Martin McCormick



Re: .uvc WebCam Data

2019-08-09 Thread Martin McCormick
Dan Ritter  writes:
> Martin was just sense-of-wondering at modern technology. I'm
> guessing his eventual project will snap frames for OCR on
> demand, then send the output through a braille terminal or
> a speech synthesizer.

Our messages basically crossed due to the time lag here
between fetches of mail from our ISP but you said it much better
than I did.

I have no idea at all what this project is going to look
like when it is done but it will be something like what you
describe.  Snap a picture.  Try to evaluate it as quickly as
possible.  Snap another and soforth.

The ideal solution would make the person using it feel like
he or she is on a serial console without this layer of complexity
and is simply interacting with the screen.

The reality is that it will more likely feel like what it
is, a work-around that barely solves the problem, better than
nothing but not much.

If it lets me reconfigure the occasional wayward BIOS on
an old system without having to bother my dear wife or a friend,
I will call it good enough. If we let perfect kill good enough,
nothing ends up getting done.

Martin McCormick WB5AGZ

I will have been WB5AGZ for 50 years in October.



Re: .uvc WebCam Data

2019-08-08 Thread Martin McCormick
deloptes  writes:
> I still don't get it how you want to capture and process video to text to
> audio - perhaps deduplicate frame content etc. - how many frames per 
> second
> do you want to process, cause I did not get this with the 4Mhz and how it
> is relevant. I was thinking your display is running at 60Hz, which is most
> common nowdays. This means you have 60 images/sec  hmmm how do you
> process 60/sec?
> I am really wondering.

You have actually asked about the only questionI can
intelligently answer at this point and I am greatful for that.

I was marveling at how fast the analog-to-digital A/D
converter has to work.

I don't know yet whether I must run at 60 frames per
second all the time and simply grab one frame when ready or if I
can tell the video extraction application to just take one still
picture but I need at least 1 good full screen shot.

After getting the shot, I should have a jpg or similar
digital image which will look like a freeze frame of the screen.

It's not quite useful yet but the OCR engine turns it in
to ASCII text.

Computer users who are blind either use text-to-speech or
text to Braille text applications to finally extract intelligence
from the text resulting from the OCR output.

This "reading" of the ASCII dump will let the user of the
system know what is on the screen.

One presses buttons to change a setting and then it's
time to take another picture and OCR that to see what one just
changed.

I really won't need to take more than one picture every
couple of seconds as it probably takes that long to process each
still and listen to the output.

Also, I am hoping to be able to compare the most recent
screen grab with the previous grab to see what changed rather than
read all the unchanged portions of the screen.

Keep in mind that this is not motion video and a blinking
cursor is probably the only change over many seconds.

Martin



Re: .uvc WebCam Data

2019-08-08 Thread Martin McCormick
Dan Ritter  writes:
> UVC means USB Video Class. The Video For Linux 2 driver system
> should recognize it as a V4L2 device.
> 
> fswebcam is a package that captures images from V4L2 devices.
> It's command-line driven and has a few useful features like
> resizing, averaging multiple frames, and skipping early frames
> for devices that take a while to focus. It writes JPEG or PNG.
> 
> Remember to make yourself part of the video group.
> 
> -dsr-

Thank you very much.  I started using unix-like OS's 30
years ago in June but the digital video field is new to me so I
still have a lot of learning to do.

As an electronics and amateur radio enthusiast, I am
astounded at how fast that A/D converter has to work along with
the Nyquist filtering to properly digitize the video.

With North American NTSC color video, the dot clock rate
is 3.7945 million plus a few more decimal places per second and
PAL along with SECAM are just above 4 MHZ.  The A/D converter has
to sample at twice that rate to keep Mr. Nyquist from haunting
anybody from his grave.

Martin McCormick



Re: Raspian ntp manual invocation?

2019-08-08 Thread Martin McCormick
Sven Joachim  writes:
> Or systemd-timesyncd, which is shipped with systemd since version 213
> and enabled by default in Debian since version 219-1.
> 
> Cheers,
>Sven
> 
> 
I have a Raspberry Pi 2 which was running jessie in 2016
and then I upgraded to stretch in 2018.  The Pi runs 24/7 and
I've not had a bit of trouble with ntp keeping it to within a
second which is about as good as it normally gets on any
unix-like system.

Martin McCormick



.uvc WebCam Data

2019-08-08 Thread Martin McCormick
I am trying to fit all the pieces together in a project I
need to do which is to capture VGA video text screens and turn
them in to ASCII text via OCR.

The OCR program is meant for people to feed in video from
a camera or flat-bed scanner which will process the images and
decode text from printed pages.

I suspect that the image the OCR program is expecting to
see is a raster.

The video capture device is an Epifan AVIO-HD video
digitizer and one of it's modes is VGA conversion with all video
sent in the  .uvc or webcam  format.

The part I don't know yet is what needs to happen to
convert .uvc in to something that looks like it came from a
digital TV camera or flat-bed scanner?

Thanks for any and all constructive ideas.

Martin McCormick



Re: Easiest way to do VGA to Text

2019-08-02 Thread Martin McCormick
rhkra...@gmail.com writes:
> I know this is off point (because you are not the original poster, who, 
> iirc,
> is blind or partially blind), but, if the only reason to reconfigure the 
> BIOS
> is to set the correct date and time, an alternate would be to boot with 
> the
> wrong time, then use, set the (software) clock to the correct time 
> (possibly
> using the utility that syncs to the atomic clocks in Colorado or 
> wherever, and
> then using  that other utility that lets you set the hardware clock from 
> the
> software clock.

Raspberry Pi's do exactly what you are describing when
they run Linux.  They have no running internal clock so when they
power up, they can only reference seconds that start from 0 in
their timer register.  Instead of a big bang, we are talking
about a little pop.

At some point, the Pi gets a network connection going and
goes out to pool.ntp.org where there are thousands of unix boxes
all over the world that can give you UTC or coordinated universal
time to within a second or so if you use a pool near where you
live.  Search for pool.ntp.org.

Very briefly, servers connected to actual atomic clocks
are Stratum 1 servers.  You can even become one of those by
having your own atomic clock or by using a receiver that can sync
to the atomic clocks carried by such systems as GPS.  These are
incredibly accurate.

For the rest of us, not trying to crowd source a radio
telescope or do some other task that requires accuracy to umteen
decimal places, ntpd can get you there to within a second when
configured correctly.

Ntpd even has routines that check your clock against all
the others and add or delete fractions of seconds so the longer
your clock runs, the more accurate it gets to a certain point.

If you do have a hardware clock, Linux automatically
updates it.  If you look at system shutdown messages, that's one
of  them as processes are being shut off.

Martin McCormick WB5AGZ



Re: Easiest way to do VGA to Text

2019-08-02 Thread Martin McCormick
Felix Miata  writes:
> Are these old Dells continuously connected to power whether booted or not?

Yes.

> I have a bunch of old Dells. When left unconnected to power, some wear 
> down the
> 2032 coin cell CMOS batteries with unusual haste. Once this happens and 
> the
> battery is replaced, reconfiguring the BIOS is required, unless 100% use 
> of
> defaults proves acceptable, which because of the date and time at least, 
> for me is
> never.

I know what you mean.

Some time before I retired in 2015, we had a Dell server
at work that  must have had bad steering diodes somewhere on the
mother board because it could drain one of those 2032's in just a
few hours.  Nobody even knew there was a problem until it was
shut down for some length of time and then it would come up wrong.
Trying to remember what all happened is a bit difficult now but I
seem to remember that one could power it up and it would start
immediately for 10 or 15 seconds and then shut off at which time
one could press the Start button and it would run with all the
defaults.  Good servers just remember what power states they were
in when last shut down or maybe there is a BIOS setting that you
can set to determine this behavior but there is none of this
business of running for a few seconds and then going in to
shutdown.

The department that actually owned the server decided to
replace it with a new one and that's the end of that story as far
as I can relate.

The university would have put the defective server in
Surplus and state law required that it be sold at auction at
which point, some poor bloak would buy it and make the same
discovery we had made.:-)

Martin



Re: Easiest way to do VGA to Text

2019-08-01 Thread Martin McCormick
David Christensen  writes:
> What about using a computer whose CMOS Setup utility is accessible via the
> serial port? This article indicates the Dell 2450 is capable:
> 
> 
> http://tldp.org/HOWTO/Remote-Serial-Console-HOWTO/rhl-biosserial.html
> 
> 
> David
> 
> 

Thanks for the information but None of the Dells I have
are that model.  They are all traditional eyeballs-only style.  I
even have a card that was manufactured many years ago that
replaces the VGA card in a number of PC models but not, of
course, the ones I have.

I had bought it to use at work and it did work fine in a
system there but the card will not physically fit the connector
on the one system that has a removable video output card and the
others all have VGA integrated in to the mother board.

You fight the war withthe weapons you have, not what you
wish you had.

The other possibility touches on a comment that another
poster to this thread mentioned.

I do own an iPad which has a commercial OCR program on it
that while driving one crazy with it's limitations, can sometimes
work quite well.

If you use the iPad's rear-facing camera and shoot a
photo of the monitor screen, it sometimes produces useful results
but it is normally kicking and screaming every step of the way.

The OCR program is really meant to photograph pieces of
paper under light that doesn't flicker.

The monitor screen is a classic CRT which flickers at the
frame rate of 60 FPS with no setting to increase exposure time
which might solve the problem.

I waited until night, clamped the iPad in to a tripod
fixture aimed at the CRT and observed that it continuously cycled
in and out of error mode due to the flicker.  A LCD-type monitor
might work much better as they have almost no flicker.

This is definitely one of those projects in which one
must not let perfect be the enemy of good enough.

Thanks for the good ideas.

Martin



Re: Easiest way to do VGA to Text

2019-08-01 Thread Martin McCormick
john doe  writes:
> On 7/30/2019 7:01 PM, Martin McCormick wrote:
> >
> >   I have 4 older PC's that generally work well running
> > debian but Right now, 3 of them need varying degrees of attention
> > to their BIOS setups as Dell motherboards and possibly other
> > brands will occasionally modify their boot sequences for some
> > reason and the only way one can boot from a CDROM is to get in to
> > the BIOS setup and yank the boot order back to one where the CD
> > drive is ahead of the hard drive or put an unbootable hard drive
> > in.  Six or eight months later, one will suddenly discover that
> > the boot sequence has fallen back to  the useless one where the
> > floppy drive is first, followed by the hard drive followed by the
> > CDROM.
> >
> 
> Why not "simply" deconnecting the hdd  once booted reconnecting it?
> Granted, it's clearly not ideal! :)

I chuckled when I read your message.  Not because there
was anything at all wrong with the suggestion but because that
was the first thing I tried years ago when I stumbled across the
problem.  Since the boot drive  was disconnected, the computer
just gave me that nasty little double high-pitched beep which
says the game is over before it even started.

It seems that there has to be a drive in place that would
boot if only it could.

Again many thanks.

Martin



Re: 3 phase power (was Re: Wireless home LAN - WiFi vs Bluetooth?

2019-08-01 Thread Martin McCormick
rhkra...@gmail.com writes:
> An update | correction | recollection ;-)
> 
> On Tuesday, July 30, 2019 11:34:43 AM rhkra...@gmail.com wrote:
> > I have seen diagrams in NEC code books for a different arrangement to 
> get
> > 120 volt 3 phase power, but I don't recall ever actually encountering 
> that
> > in real life.
> 
> Oh, wow, how quickly I forget -- I did encounter systems like that, often 
> for
> lighting in industrial applications,  And, further, iirc, we could (and 
> did)
> buy and install florescent light (and maybe HID?) fixtures designed to 
> work on
> 208 volts, which we connected phase to phase in that kind of system.
> 
> Of course, I could be misremembering.
> 
> > In that case, iirc, 120 volt loads are connected from a hot
> > tap to the neutral wire (the 4th wire of the 3 phase arrangement), and 
> you
> > get (nominally) 208 volts (RMS) connecting phase to phase.  I have seen
> > things like motors that were rated like 240 / 208 volts (or something 
> like
> > that).
> 

That's the way I understand it too.  One of the buildings
we worked in at Oklahoma State University had low-voltage wiring
to the light switches.  Pressing the On button turned on the
overhead light, accompanied by the click of a latching relay.
Pressing Off released the relay with another audible click from
above.

I asked one of the electricians as to why the fancy light
switches.

The building had 3-phase wiring for the air handlers and
the lights were powered phase-to-phase at 208 volts.  This would
have been dangerous if someone took the plate off of a switch for
any reason because every wire would be hot between it and
anything else.

Martin



  1   2   3   4   5   >