Sunday, August 11, 2019

48 Hours with a Raspberry Pi 4 / 4GB


Ordered, delivered, unpacked, installed.

[

Replying to
So
had starter kits in stock. I've committed. Thanks for the encouragement.

https://twitter.com/jspath55/status/1157650054506848258?s=20

https://twitter.com/jspath55/status/1159488294415163393?s=20

https://twitter.com/jspath55/status/1159536192980955137?s=20
]

Jul 10 01:42:09 raspberrypi lightdm[863]: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files
Jul 10 01:42:10 raspberrypi kernel: [   20.873773] fuse init (API version 7.27)
Jul 10 01:42:22 raspberrypi rfkill: unblock set for type wifi
Jul 10 01:44:33 raspberrypi kernel: [  164.150011] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Aug  9 04:35:36 raspberrypi mtp-probe: checking bus 1, device 3: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3"
Aug  9 04:35:36 raspberrypi mtp-probe: bus: 1, device: 3 was not an MTP device

Somewhere in there, the wifi connected and the date jumped from an internal 10-Jul to a real world 09-Aug-2019.

The box wanted to update itself once I had finished a bootstrap sequence.


(11:18 pm)

Initial set up was pretty straightforward, nice notes from CanaKit. First problem was the TV with HDMI input I tried to use showed the menus slightly offscreen. After trying to move the menus around, I gave up and moved it to another HDMI TV.

The image above was one of a couple hiccoughs in the starting steps. I just hit "Back" and did it again, with better results.

Connection to the home wifi also took 2 tries. Don't think I fat-fingered but could be.

The dmesg command shows this is a pretty fresh piece of silicon.

[

[    0.000000] Linux version 4.19.58-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1245 SMP Fri Jul 12 17:31:45 BST 2019

]

I created a password for the default pi user and was off to the races. Some config for keyboard and language set to US, though later I found the timezone was UK (BST) and am still seeing some locales for GB that I'd prefer to be US.

First application to install, after searching for what was there, and what wasn't: lynx. An open source program I contributed to way back, and am still a frequent user, though no longer contributing.  I had worked on autoconfigure, ports to different platforms, and the initial baby steps in non-English message catalogs.

Bash history log:

    2  apt-get install lynx
    3  sudo apt-get install lynx

The next few applications to be included ranged from network utilities to editors to whatever came to mind. No specific plan other than knowing a few of the UNIX programs I tend to use regularly, if not often.

  Menu-driven included programs such as VLC and LibreOffice went for quick runs.



(12:00)

Replying to
and
Took me a little while to recall where UPnP menus are in VNC. Working nicely!


In no particular order of importance, but chronological per shell history, apps:

[
   22  sudo apt-get install ntpd
   23  sudo apt-get install ntp
   25  sudo apt-get install ntpd
]

I don't recall why I hit this three times. But I flicked the ntpd.conf file from the included list to one of my liking:

[
-rw-r--r-- 1 root root 2162 Mar 21 18:42 /etc/ntp.conf.df
-rw-r--r-- 1 root root 2249 Aug  9 00:17 /etc/ntp.conf

> server us.pool.ntp.org
> server ca.pool.ntp.org
> server mx.pool.ntp.org

]

I think that's when I saw the timezone needed to get to New York.

[

   61  sudo apt install xclock
   62  sudo apt install x11-apps


... 
However the following packages replace it:
  x11-apps

E: Package 'xclock' has no installation candidate

]

Um, no xclock, and not an application of its own, so installed a whole suite. There's another I may look for called xchrono that I haven't used in ages, pun intended.

[

   72  sudo apt install mysql
   73  sudo apt install mysql-client
   74  sudo apt install mariadb-client-10.0

]

I tried for a mysql client and found it with the forky name of mariadb. Though the executable or otherwise entry point is still mysql. Didn't see the point of putting a server on this little postage stamp but connected to one on my existing NetBSD AMD machine and it went right ahead with a minor grant statement.

[

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.26 Source distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>

]

Some muddling about with ssh, sshd, rpc, mountd and nfsd to get network uplifted. And a host rename. Mmmm, Lemon Meringue.

[

  106  sudo apt install mpg123

-bash: nslookup: command not found

]

Oh, yeah, trusty nslookup is mistrusted in this world. Probably no dig either. Back to the apt drawing board.

[

  119  sudo apt install nslookup
  120  sudo apt install dnsutils

]

With audio working (chromium browser had no problems hitting some of my favorite streams, including WWOZ New Orleans...





[
 201  sudo apt install mp3blaster
]

Minor issue with this code not displaying a few characters correctly (‘X’ - single quotes, accents, etc.) but I like the quick and easy startup of MP3Blaster. [ http://www.mp3blaster.org/ ]

[

  298  sudo apt install ntfsfix
  299  sudo apt install ntfs-3g

]


After plugging in a wheezing drive from an old Windows machine to test out external hard drive I/O, the device came online but the drivers decided the bits were misaligned and put it into read-only mode. Searches suggested booting it back into Windows and doing a series of hokey-pokey-clean-shutdown incantations. Or run NT filesys commands to clear the bits, possibly damaging the data beyond repair. Hey, sounds fun, let's go.

[

$ sudo ntfsfix /dev/sda2
Mounting volume... The disk contains an unclean file system (0, 0).
FAILED
Attempting to correct errors... 
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sda2 was processed successfully.

pi@lemon:/mnt/audio/Tangerine Dream/Encore $

]


[
E: Package 'flac123' has no installation candidate
https://sourceforge.net/projects/flac-tools/files/flac123/
]

FLAC support seemed surprisingly slight. Or I looked at it wrong. Could not build the above code after trying a bunch of compiler, library, and other tools. Eventually figured out gst123 is a worthy stand-in.

./conftest: error while loading shared libraries: libao.so.4: cannot open shared object file: No such file or directory

pi@lemon:/mnt2/AUDIO/Tangerine_Dream/rubycon $ ~/bin/flac123 1.rubycon.flac 
flac123 version 0.0.12   'flac123 --help' for more info
No fallback libao driver found, exiting.


[

  386  sudo apt install gst123

  399  sudo apt-get install xscreensaver

]

Funny stories about XScreensaver. For another day. But here's one link from the author (of xscreensaver and tons of other work--not me):


Now the fun stuff.  ? Benchmarks and more. It's what I used to do. And still do, I guess. I have a library of benchmark code I've collected, and run, since the early 1980s. My first published article was a Computer Shopper review of a C Compiler, and I believe I included timings for the (infamous) Byte Magazine benchmarks, or perhaps the Sieve of Eratosthenes (prime number finder). Alas, the DEC Alpha and IBM Power (to name just a couple) UNIX machine results were left behind at my old job. But I have notes on runs I did at home, or on publicly accessible machines (HP had a "test" rack of machines you could register for).

I wanted to see what this tiny machine could do.


[

   #    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
   #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
   #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
   #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
   #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
    ####   #    #  #  #    #          #####   ######  #    #   ####   #    #

   Version 5.1.2                      Based on the Byte Magazine Unix Benchmark

   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      Sunnyvale, CA, USA
   December 22, 2007                  johantheghost at yahoo period com
]

I started with "FLOPS", to see if old code worked at all.
Yes, it does.

[

/*****************************/
/*          flops.c          */
/* Version 2.0,  18 Dec 1992 */
/*         Al Aburto         */
/*      aburto@nosc.mil      */
/*****************************/

/*
   Flops.c is a 'c' program which attempts to estimate your systems
   floating-point 'MFLOPS' rating for the FADD, FSUB, FMUL, and FDIV
   operations based on specific 'instruction mixes' (discussed below).

]

More details later, once I get through some temperature impacts to be mentioned below.

[

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND       8945 pi        20   0    1856    340    284 R 100.0   0.0   0:58.31 


 $ vmstat 1 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 4  0      0 2091312 173468 1410744    0    0     2     4   45   50  8  2 89  0  0
 1  0      0 2091312 173468 1410744    0    0     0     0  264  117 25  0 75  0  0

flops  pi@lemon:~/src/testdrive/flops $ grep "MFLOPS(1)" flops-rpi*log
flops-rpi-20190810-A.log:   MFLOPS(1)       =  1039.2238
flops-rpi-20190810-B.log:   MFLOPS(1)       =  1048.3980
flops-rpi-20190810-C.log:   MFLOPS(1)       =  1048.7392

]

This code used one of four CPU cores (so not a parallel test).

 Quite an improvement over an i386 from 15 years or so ago. As we would hope and expect.

flops/flops-netbsd-i386-20041120.log:   MFLOPS(1)       =   381.4513
flops/flops-netbsd-i386-20050205.log:   MFLOPS(1)       =   185.4685

  But not quite par with an Itanium of that vintage.

flops/flops-suse-icc-ia64-20041120.log:   MFLOPS(1)       =  1728.1142



The Byte benchmark code started off like this (xload display):



But not long after, when running 8 parallel shell scripts, went kinda off the chart.


  On the plus side, the suite finished, didn't crash the machine, and the only downside was a temperature increase visible on the main X display as a flashing red thermometer icon.

  Research time. Overload causes temperature increase, which leads to a throttling back of processor speed. Good design, though these benchmark results may be skewed by such behavior. So I will skip most of the results pending cooling experiments. The board has 3 heat sinks provided by CanaKit, and it could be a fan or other option is merited.

[

   BYTE UNIX Benchmarks (Version 5.1.2)

   System: lemon: GNU/Linux
   OS: GNU/Linux -- 4.19.58-v7l+ -- #1245 SMP Fri Jul 12 17:31:45 BST 2019
   Machine: armv7l (unknown)
   Language: en_US.utf8 (charmap="ANSI_X3.4-1968", collate="ANSI_X3.4-1968")
   CPU 0: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
   CPU 1: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
   CPU 2: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
   CPU 3: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   17040747.2   1460.2

an x86 Linux box from around 2005:
(Linux * 2.6.5-7.97-default #1 Fri Jul 2 14:21:59 UTC 2004 i686 i686 i386 GNU/Linux)

Dhrystone 2 using register variables         116700.0    3437974.9    294.6


System Benchmarks Index Score                                         395.1 (run 1)
System Benchmarks Index Score                                         394.1 (run 2)

]

More googling, to find 2 commands to show temperature (and also CPU frequency)

pi@lemon:~/src/bytebench/unixbench-5.1.2 $ /opt/vc/bin/vcgencmd measure_temp
temp=81.0'C

pi@lemon:~/src/...$ cat  /sys/class/thermal/thermal_zone0/temp
81315

All right, now I need to record these data so that I can compare the built-in throttling to the benchmark results. Presuming I get better cooling working, the CPU will get the work done without slowing down.  The indicator will be temperature rising. And I can measure the frequency.

pi@lemon:~/src/...$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
1500000
pi@lemon:~/src/...$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
600000

Enter RRDtool. A great piece of work that I've used for network ping sweeps, as well as other system variables like this.

Along the way I set up my preferred XTERM font. Well, sort of.

xterm: cannot load font "-Sony-Fixed-medium-R-*-*-24-170-100-100-C-240-ISO10646-1"

Workaround is to highlight the text and pick "Selection" as the font. Trouble for another day.

Quickly stumbled across this nicely packaged pair of shell scripts, with tutorial and crontab (Vixie) entries:


Simple enough to throw down some more applications. Sigh.

sudo apt-get install rrdtool apache2


Never one to simply copy and paste, I decided to install this as a non-root user. The instructions were to add shell scripts, data directories, and cron jobs as root. I hesitated from years of (in)security..  There's a www-data user, so I set up rrdtool database and the resulting PNG graphs to be owned by that user. It seemed to work right away.

Only no data points.

Hm.  I isolated the rrd update statement, which was simple enough, and ran it on the command line.

But first, editing a crontab file on this OS doesn't allow "vi"? Sigh. Emacs it is.

[

no crontab for * - using an empty one

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest="" font="">
  2. /usr/bin/vim.tiny
  3. /usr/bin/emacs
  4. /bin/ed
]
The email from cron gave a few clues.

ERROR: creating '/var/www/data/cputemp.rrd': File exists
ERROR: /var/www/data/cputemp.rrd: Function update_pdp_prep, case DST_GAUGE - Cannot convert 'init' to float


$ sudo rrdtool update /var/www/data/cputemp.rrd 1565564727:85.0

With the command line update action complete, one data bar/column showed up on the graph. I added echo statements near where the source has one commented out.

debug VCHI initialization failed init 1565565121
debug rrdtool update /var/www/data/cputemp.rrd 1565565121:init

The "init" string is simply pulled from the results of vcgencmd. Sort of a violation of the Perl mantra always check system call output. But easy enough to fix, after a side trip to the search bar.



[



You need to be in group "video" so that vcgencmd can access /dev/vchiq. But "cat /sys/class/thermal/thermal_zone0/temp" requires no privileges.

]

I'll leave the group add command for the student to complete. ;-)

Now we have data and pictures thereof.



I think some of the xscreensaver hacks, er, programs, are resource intensive. Next test is to disable that from running and see what happens.


No comments:

Post a Comment