Changing AllStar screen resolution

December 25, 2018

The Problem

I recently became interested in AllStarLink, and had a HamVoip image installed on a Raspberry Pi. (I was using “RPi2-3 includes 3B+ Image Version 1.5rc19”.)

The AllStarLink image booted to 1366×768, which was the screen’s default resolution. However, the screen itself was a 7 inch HDMI screen. That was hard to read.

Things that didn’t work

I decided to change the resolution by editing /boot/cmdline.txt. My first attempt was to add:

framebuffer_width=720
framebuffer_height=400

before the root= line at the beginning of the file. That resulted in a kernel panic:

Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

After a while, I realized that root= had to come first. Then I tried:

root=/dev/mmcblk0p2 rw rootwait bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=400
console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0
smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop
hdmi_safe=1
hdmi_group=1
hdmi_mode=1

but my cmdline.txt values seemed to be ignored.

Finally I wised up: apparently when the Pi reads the root line it starts booting, ignoring everything after it in cmdline.txt. So, I had to pass the video size as a kernel parameter instead.

I did:

cat /proc/cmdline

and saw:

8250.nr_uarts=0 bcm2708_fb.fbwidth=1366 bcm2708_fb.fbheight=768
bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000
root=/dev/mmcblk0p2 rw rootwait console=ttyS0,115200 console=tty1 selinux=0
plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyS0,115200 elevator=noop

The Solution

(For Linux / AllStarLink newbies: in order to get to the terminal, I picked menu item 9 – open a bash shell.)

I went into /boot/cmdline.txt with a text editor:

nano /boot/cmdline.txt

and inserted the following two parameters on the existing line that begins with “root=”:

bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=400

I put these right after the rootwait parameter, so in /boot/cmdline.txt I now had:

root=/dev/mmcblk0p2 rw rootwait bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=400
console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0
smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop

(Note that root line is all one long line – not broken up with line separators!)

Once I did that and saved it, the Raspberry Pi booted up in glorious 80×25 text. Now we could read it!

Advertisements

Let me know (mail me) when there’s an error

September 5, 2018

I’ve got a shell script where I’d like to know when an error happens. Typically when that happens, something gets written to stdout or stderr – and I’d like to see that. But when things are just peachy, I don’t want to be bothered.

Here’s an easy way to achieve that. At the beginning of my script, I have:

WEATHEROUT=`/bin/mktemp`
WEATHERERR=`/bin/mktemp`

(Did I mention this is a script for a weather station? Yep.)

Then in the body of the script, I have:

/usr/local/bin/do-the-thing > ${WEATHEROUT} 2> ${WEATHERERR}
/usr/local/bin/do-the-other-thing >> ${WEATHEROUT} 2>> ${WEATHERERR}

Finally, at the end of the script, there’s:

if [ -s ${WEATHERERR} -o -s ${WEATHEROUT} ]; then
   cat ${WEATHEROUT} ${WEATHERERR} | /usr/bin/mail -s "Weather command error" me@myaddr
fi

That’s all!


Ubiquiti AP enters reset state but never leaves

July 20, 2018

I did something dumb recently. I had a network failure at my ISP, so I had to kill my dhclient and restart it. After restarting, everything seemed cool – until I reset my Ubiquiti AP. At that point, the AP entered the “Restarting” state and never came out.

After a few minutes of poking around on the Ubiquiti management screen, I saw this:

Screenshot from 2018-07-20 13-09-11

Apparently I killed off my DHCP server too. Oops.

One restart of the DHCP server later, my AP was back online (it detected when the DHCP server started). Some day I really should put the AP on its own static IP. That’s what I get for being lazy…


What’s up with mod_security and User-Agent? (406 Not Acceptable)

May 1, 2018

So… what’s the deal with mod_security and User-Agent? I tried to browse to HandheldRadio.net using Lynx, and was greeted with this 406 error:

                            Not Acceptable

   An appropriate representation of the requested resource / could not be
   found on this server.

   Additionally, a 406 Not Acceptable error was encountered while trying
   to use an ErrorDocument to handle the request.

A few searches and I discovered this was due to Apache mod_security.

I don’t get it. Why would you exclude based on User-Agent? That’s something that can be changed at will by any program that decides to be nefarious. This seems like security theatre rather than real security.

Even in the best case, this kind of “security” just turns into a red queen’s race to the bottom where everything will now lie about what it is because someone screwed up a config file somewhere.

And so I’ve started lying (in my .bashrc):

alias lynx='lynx -useragent="Mozilla/5.0 (X11; Ubuntu Lynx; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0"'

Damn, that’s stupid.


Setting a user and group for Samba drives

April 14, 2018

The last time I tried to set a user and password on my Samba drive, I ran into a strange problem: even though my credentials were correct, I was still using the user and group I was logged in as, rather than the one I’d stored with the Samba config.

Luckily, these days there’s an easy way around it in /etc/fstab:

//mysvr/music /music cifs uid=1000,gid=1000,credentials=/etc/samba/credentials/mysvr

 

Simply adding the uid= and gid= lines fixed up the problem for me.


What the hell, Gnome? Canonical?

January 1, 2018

Today when I started working on my desktop, I saw a crash in gom-media-tracker. What? Why is there a media tracker on my desktop?

I learned this is part of Gnome (what? Why is there a media tracker in Gnome?) and it’s included in Ubuntu 16.04 LTS (why is Canonical including tracking software in Ubuntu?)

Screw that. I removed it.

$ sudo apt remove gnome-online-miners
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  gnome-documents gnome-online-miners gnome-photos ubuntu-gnome-desktop
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 6,472 kB disk space will be freed.
Do you want to continue? [Y/n] y
dpkg: warning: files list file for package 'fonts-gfs-complutum' missing; assuming package has no files currently installed
(Reading database ... 493027 files and directories currently installed.)
Removing ubuntu-gnome-desktop (0.58.3) ...
Removing gnome-documents (3.18.3-0ubuntu0.16.04.1) ...
Removing gnome-photos (3.18.2-1) ...
Removing gnome-online-miners (3.14.3-1ubuntu2) ...
Processing triggers for libglib2.0-0:amd64 (2.48.2-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
$ 

Now that I’ve done that, I don’t appear to have lost anything I use. (Why is an optional packages forcing other packages out?)

I don’t want random tracking software on my machine.

wiki.gnome.org/Projects/Tracker, you suck. Gnome, you suck. Canonical, you suck.


Updating to the latest TeX on Ubuntu 16.04

November 20, 2017

I had problems running the TeXLive package manager tlmgr on my Ubuntu 16.04 LTS install. Apparently the package manager changed formats in 2016, so the version that is included with Ubuntu is out of date (and presumably so is TeX/LaTeX).

Luckily, there’s a repo with the latest TeX as described here:
tipsonubuntu.com/2016/09/16/install-tex-live-2016-ubuntu-16-04-14-04/

In short, if you have TeX already installed, do this:

sudo add-apt-repository ppa:jonathonf/texlive
sudo apt update; sudo apt upgrade

After that you’ll run into the following bug:
bugs.debian.org/cgi-bin/bugreport.cgi?bug=824137
 
You’ll need to do the following to get around it:

sudo apt -f remove texlive-base texlive-fonts-recommended texlive-latex-extra texlive-latex-recommended texlive-pictures texlive-pstricks texlive-base-bin prosper texlive-fonts-recommended-doc texlive-fonts-extra-doc texlive-latex-base texlive-generic-recommended texlive-latex-base-doc texlive-latex-extra-doc texlive-latex-recommended-doc texlive-pictures-doc texlive-pstricks-doc tipa

sudo apt install texlive-base texlive-fonts-recommended texlive-latex-extra texlive-latex-recommended texlive-pictures texlive-pstricks texlive-base-bin prosper texlive-fonts-recommended-doc texlive-fonts-extra-doc texlive-latex-base texlive-generic-recommended texlive-latex-base-doc texlive-latex-extra-doc texlive-latex-recommended-doc texlive-pictures-doc texlive-pstricks-doc tipa

After that, you should be running the latest TexLive.