Aug 24, 2017

(bash): The most useless commands(10)


After talking about
  1. rev
  2. yes
  3. sl
  4. cowsay
  5. cmatrix
  6. cal
  7. rig 
  8. pi
here another pretty useless command:
~$ figlet apt-get update
             _                   _                     _       _      
  __ _ _ __ | |_       __ _  ___| |_   _   _ _ __   __| | __ _| |_ ___
 / _` | '_ \| __|____ / _` |/ _ \ __| | | | | '_ \ / _` |/ _` | __/ _ \
| (_| | |_) | ||_____| (_| |  __/ |_  | |_| | |_) | (_| | (_| | ||  __/
 \__,_| .__/ \__|     \__, |\___|\__|  \__,_| .__/ \__,_|\__,_|\__\___|
      |_|             |___/                 |_|                        
Manpage:
DESCRIPTION
       FIGlet  prints  its input using large characters (called ``FIGcharacters'')made up of ordinary screen
       characters (called ``sub-characters'').  FIGlet output is generally reminiscent of the sort of ``sig‐
       natures''  many  people like to put at the end of e-mail and UseNet messages.  It is also reminiscent
       of the output of some banner programs, although it is oriented normally, not sideways.

       FIGlet can print in a variety of fonts, both left-to-right and right-to-left, with adjacent  FIGchar‐
       acters  kerned  and ``smushed'' together in various ways.  FIGlet fonts are stored in separate files,
       which can be identified by the suffix ``.flf''.  In systems with UTF-8 support FIGlet may  also  sup‐
       port  TOIlet  ``.tlf''  fonts.  Most FIGlet font files will be stored in FIGlet's default font direc‐
       tory.

       FIGlet can also use ``control files'', which tell it to map certain input characters to certain other
       characters,  similar to the Unix tr command.  Control files can be identified by the suffix ``.flc''.
       Most FIGlet control files will be stored in FIGlet's default font directory.

       You can store FIGlet fonts and control files in compressed form.  See COMPRESSED FONTS.

Aug 22, 2017

Customizing a CoreOS image/iso: Ignition

After the first steps with coreos (virtualbox installation) and a successful ssh login, it is clear, that the coreos image has to be customized. If not, every reboot will clean up every configuration provided after reboot.

CoreOS provides a coreos-install script to do this.
coreos-install -help
Usage: ./coreos-install [-C channel] -d /dev/device
Options:
    -d DEVICE   Install Container Linux to the given device.
    -V VERSION  Version to install (e.g. current) [default: current]
    -B BOARD    Container Linux board to use [default: amd64-usr]
    -C CHANNEL  Release channel to use (e.g. beta) [default: stable]
    -o OEM      OEM type to install (e.g. ami) [default: (none)]
    -c CLOUD    Insert a cloud-init config to be executed on boot.
    -i IGNITION Insert an Ignition config to be executed on boot.
    -b BASEURL  URL to the image mirror (overrides BOARD)
    -k KEYFILE  Override default GPG key for verifying image signature
    -f IMAGE    Install unverified local image file to disk instead of fetching
    -n          Copy generated network units to the root partition.
    -v          Super verbose, for debugging.
    -h          This ;-)

This tool installs CoreOS Container Linux on a block device. If you PXE booted
Container Linux on a machine then use this tool to make a permanent install.
First you have to add a 8GB partition to your core os installation:

 

Then enable ssh login (please refer to this posting). And transfer the coreos-install script and the following ingnition.json file:
{
  "ignition": {
    "version": "2.0.0",
    "config": {}
  },
  "storage": {},
  "systemd": {},
  "networkd": {},
  "passwd": {
    "users": [
      {
        "name": "core",
        "sshAuthorizedKeys": [
          "ssh-rsa AAAAB3NzaC....  "
        ]
      }
    ]
  }
}
Please use this validator to check your ignition.json!
And here we go:
core@localhost ~ $ ./coreos-install -d /dev/sda -i ignition.json
./coreos-install: Target block device (/dev/sda) is not writable (are you root?)
Ok.
sudo bash
bash-4.3#./coreos-install -d /dev/sda -i ignition.json
Downloading the signature for https://stable.release.core-os.net/amd64-usr/1409.6.0/coreos_production_image.bin.bz2...
wget --no-verbose -O /tmp/coreos-install.JROwzOsi1W/coreos_production_image.bin.bz2.sig https://stable.release.core-os.net/amd64-usr/1409.6.0/coreos_production_image.bin.bz2.sig
2017-08-22 19:01:28 URL:https://stable.release.core-os.net/amd64-usr/1409.6.0/coreos_production_image.bin.bz2.sig [543/543] -> "/tmp/coreos-install.JROwzOsi1W/coreos_production_image.bin.bz2.sig" [1]
Downloading, writing and verifying coreos_production_image.bin.bz2...
2017-08-22 19:02:31 URL:https://stable.release.core-os.net/amd64-usr/1409.6.0/coreos_production_image.bin.bz2 [288249718/288249718] -> "-" [1]
gpg: Signature made Thu Jul  6 01:34:01 2017 UTC
gpg:                using RSA key 07FA9ED31CB5FA26
gpg: key 50E0885593D2DCB4 marked as ultimately trusted
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: Good signature from "CoreOS Buildbot (Offical Builds) " [ultimate]
Installing Ignition config ignition.json...
Success! CoreOS Container Linux stable 1409.6.0 is installed on /dev/sda
Then umount the cd drive from your coreos virtual machine:



and reboot:
But this does not work:

Failed to start Ignition (disks)
and
See 'systemctl status ignition-disks.service'

Hmmm... I found nothing with google, so i file an issue at github:
https://github.com/coreos/bugs/issues/2118
And got a the solution within 6 minutes!!!

I missed the closing quite in line 14:
"ssh-rsa AAAAB3NzaC....  "
And now it worked:


Really cool...

If you are interested in more details please check this site:


Other posts around this topic: Core OS

  • Installing CoreOS on Virtualbox
  • Core OS - a minimal linux? A quick overview: diskspace, mounts, commands, kernel, ...
  • How to login via ssh (default password?!)
  • structure of the ISO image
  • Customizing a CoreOS image/iso: Ignition

  • CoreOS: structure of the ISO image

    After some first steps with CoreOS ("First step to micorservices: CoreOS on virtualbox") my problem is, how to customize CoreOS. After each reboot all changes are gone (tmpfs / squashfs).

    There are some tutorials which recommend the usage of etcd, but even this has to be configured into the CoreOS linux...

    The first idea: what about customizing the ISO image...

    mount -o loop coreos_production_iso_image.iso /media/iso
    Inside this:
    $ ls
    coreos  isolinux  syslinux
    du -sh *
    276M    coreos
    1,9M    isolinux
    2,5K    syslinux
    and inside the coreos directory:
    ls -l coreos
    insgesamt 282349
    -r--r--r-- 1 root root 253738975 Jul  6 03:47 cpio.gz
    -r--r--r-- 1 root root  35385632 Jul  6 03:47 vmlinuz
    Hmmm.
    $ gunzip cpio.gz
    $ cat cpio | cpio -idmv
    .
    usr.squashfs
    etc
    The directory etc is empty. And usr.sqashfs can be mounted:
    mount usr.squashfs /media/sqashfs
    and here we go:
    du -sh *
    221M    bin
    34M    boot
    512    lib
    240M    lib64
    18M    libexec
    2,5K    local
    0    lost+found
    512    postinst
    29M    sbin
    69M    share
    512    tmp
    I think modifying these files is not really helpful. Although there is no home directory to install my authorized_keys file.

    CoreOS itself states:
    But i hope there is another way without ignition to modify the coreos. Stay tuned ;-)


    Other posts around this topic: Core OS

  • Installing CoreOS on Virtualbox
  • Core OS - a minimal linux? A quick overview: diskspace, mounts, commands, kernel, ...
  • How to login via ssh (default password?!)
  • structure of the ISO image
  • Customizing a CoreOS image/iso: Ignition
  • Aug 20, 2017

    CoreOS: How to login via ssh (default password?!)

    After the installation of a coreos you want to login via ssh (because of wrong localization inside your virtualbox/vmware console and no client tools installed (copy/paste not working, etc...)?
    If you ask your preferred search engine, you will get many answers that there is not default password...
    (Of course! The idea behind containers and container schedulers is, that everything works automatically and typing passwords does not fit in this mantra).

    But no worries, only 4 steps are needed to get a login via ssh:

    1. on your laptop
      1. $ ssh-keygen
        Generating public/private rsa key pair.
        Enter file in which to save the key (/home/schroff/.ssh/id_rsa):
        Enter passphrase (empty for no passphrase):
        Enter same passphrase again:
        Your identification has been saved in /home/schroff/.ssh/id_rsa.
        Your public key has been saved in /home/schroff/.ssh/id_rsa.pub.
        The key fingerprint is:
        SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxx schroff@zerberus
        The key's randomart image is:
        +---[RSA 2048]----+
        xxxxxx
        +----[SHA256]-----+
      2. cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
    2. inside the coreos vm
      1.  scp schroff@:/.ssh/authorized_keys /home/core/.ssh
        schroff@xxxxxxx's password:
        authorized_keys                                               100%  398     0.4KB/s   00:00   
    3. on your laptop
      1. ssh core@
    With executing step 3.1 the login into the coreos machine works without a password, BUT ONLY up to the next reboot, because the home-directory is a tmpfs filesystem, which looses its content with each reboot...
    (Although you have to clean up your known hosts file, because the machine starts up with a new ssh key.)


    Other posts around this topic: Core OS

  • Installing CoreOS on Virtualbox
  • Core OS - a minimal linux? A quick overview: diskspace, mounts, commands, kernel, ...
  • How to login via ssh (default password?!)
  • structure of the ISO image
  • Customizing a CoreOS image/iso: Ignition