front | idx | new | login |
 

xterm titles

If you want to set terminal title to keep track of the ones not in tmux/screen, remove the automatic title setting from .bashrc, and alias or add a title script as:

/bin/echo -ne "\033]0;$1\007"

#note #public

 

Raspberry Pi 4 notes

Apt complains about release info change with This must be accepted explicitly before updates for this repository can be applied. -> run sudo apt-get --allow-releaseinfo-change update.

Sshd is not running after installing openssh-server package -> do raspi-update and enable SSH from there.

Owl bootstrap 60s. Nice.

#public

 

Qemu/KVM CentOS guest quest

Some workarounds and fixes for getting CentOS to run as guest in Qemu/KVM.

Kernel crash at startup:

  • increase memory (-m 1G)
Installation hangs showing only logo:
  • revert to text on installation
  • boot, tab in grub, add text as a new kernel parameter and press enter
CentOS hangs at startup, cannot log in:
  • wait a few minutes
Cannot ssh to guest / no network:
  • edit /etc/sysconfig/network-scripts/ifcfg-eth0 and replace ONBOOT=no with ONBOOT=yes
Cannot ssh to guest II:
  • check your .ssh/authorized_keys permission bits. CentOS seems to give group write permission by default for new files
#public
 

Nested SSH tunnels

So you need to get with SSH to host C via A and B. One intermediate host is frequently taken care of by giving a separate proxycommand, but this approach leads to a horrible mess of nested quotation if you need more jumps along the route.

A good solution is to use -J, which is massively awesome.

 $ ssh -J user@A:22,user@B:22 user@C

#public

 

Chrome https localhost

In case your localhost certificate isn't valid but you want Chrome to accept it anyway, enable this flag and restart Chrome.

chrome://flags/#allow-insecure-localhost

#public #note

 

regaining sudo

"Username is not in the sudoers file. This incident will be reported."

In case this happens, you may have removed yourself from the corresponding group, or the some of the configuration files are otherwise broken.

You can regain root access at least as follows:

  • boot the machine
  • press e in grub boot menu
  • add init=/bin/sh to linux boot parameters (the line starting linux )
  • press Ctrl-x to boot
  • get root prompt
Then you can add yourself back to the group or otherwise fix the files.

#public #note

 

Debian alternatives

Commands in Debian, that is.

Example: add /usr/bin/led as an alternative to vi.

$ sudo update-alternatives --install /usr/bin/vi vi /usr/bin/led 1
$ sudo update-alternatives --set vi /usr/bin/led
$ vi --help | head -n 1
Usage: led [flags] [file] ...

#public #note

 

qemu with serial output

Problem: You want to run a virtual machine in a terminal, tmux or screen.

Solution:

  • Disable graphics
  • Have a serial console in virtual machine
  • Use the serial console from host terminal

Enabling serial console in Debian

  • vm$ vi /etc/default/grub
  • add console=ttyS0 to GRUB_CMDLINE_LINUX_DEFAULT
  • vm$ sudo update-grub

Starting qemu/kvm with serial console

  • $ kvm -nographic -serial mon:stdio -hda yourimage.img -smp 2 -m 1G
  • kernel messages and login appear to terminal after a few seconds
#public #note
 

arduino device setup

stty -F /dev/ttyACM0 9600 raw -clocal -echo -icrnl

#arduino #note #public

 

arduino sensor battery stats

no advanced sleep, led blinks, sensor report every 3s, bme280 sensor @ I2C, binary protocol over 433MHz, 1200mAh 3.7V lipo, transmit 5, measure all 3

3.7.2017

  • 13:00 started, sensor reports 4.20V
  • 18:10 4.12V
4.7.2017
  • 08:30 4.00V
sleepdog sleep, radio sleep, no led, sensor report every 10s, same sensor & proto, transmit 5
  • 4.7.2017: 09:30 4.20V
  • 5.7.2017: 11:00 4.18V
  • 6.7.2017: 21:30 4.14V
  • 8.7.2017: 19:30 4.11V
  • 11.7.2017: 07:00 4.07V
  • 14.7.2017: 14:30 4.02V
  • 15.7.2017: 20:30 4.00V
  • 25.7.2017: 9:30 3.91V
#public
akihe@gitlab