Dietrich Schroff

Subscribe to Dietrich Schroff feed
Dietrich Schroffhttps://plus.google.com/101232877473830670008noreply@blogger.comBlogger365125
Updated: 13 hours 48 min ago

CoreOS: structure of the ISO image

Tue, 2017-08-22 14:40
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/isoInside this:
$ ls
coreos  isolinux  syslinux
du -sh *
276M    coreos
1,9M    isolinux
2,5K    syslinuxand 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 vmlinuzHmmm.
$ gunzip cpio.gz
$ cat cpio | cpio -idmv
.
usr.squashfs
etcThe 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    tmpI 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 ;-)

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

Sun, 2017-08-20 14:25
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.)

Linux Containers - Container LInux: Core OS - a minimal linux? A quick overview: diskspace, mounts, commands, kernel, ...

Fri, 2017-08-18 13:43
Virtualization techniques can be grouped into two categories
  1. os virtualization like VMware, Virtualbox, etc.
  2. container virtualization like Docker, etc.

Everybody is familiar with the first category. Creation of virtual machines is well known and most of us have created already tens or hundreds of such machines. (and deleted and lost them after some weeks). One of the benefits is, that it is easy to run additional machines on our laptops / workstations.
The second category is rarely used on laptops / workstations. This is something for computer rooms or data centers only.

Both categories reduce the amount of hardware needed - but management of all theses virtual entities has still to be done.

But for some workloads solutions are proposed like Kubernetes or Apache Mesos. Never heard about? ;-)

Kubernetes orchestrates containers and Core OS is providing a minimal Container Linux operating system, which can be used by Kubernetes.
Here my first expiriences with this minimal Linux system (for installation please refer to this posting):
$ uname -a
Linux localhost 4.11.9-coreos #1 SMP ......
Diskspace used is only 244 megabytes:

Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        361M     0  361M   0% /dev
tmpfs           499M     0  499M   0% /dev/shm
tmpfs           499M   13M  486M   3% /run
tmpfs           499M     0  499M   0% /sys/fs/cgroup
tmpfs           499M  8.0M  491M   2% /
/dev/loop0      244M  244M     0 100% /usr
tmpfs           499M     0  499M   0% /media
tmpfs           499M     0  499M   0% /tmp
tmpfs           100M     0  100M   0% /run/user/500Filesystems:
...
tmpfs on / type tmpfs (rw,relatime,seclabel,mode=755)
/usr.squashfs (deleted) on /usr type squashfs (ro,relatime,seclabel)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,seclabel)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel)
...
Available commands /bin (/bin is a softlink to /usr/bin):
core@localhost ~ $ ls /bin
'['                                 ip                 rview
actool                              ipcmk              rvim
arch                                ipcrm              scanelf
arping                              ipcs               scanmacho
attr                                iptables-xml       sclient
aulast                              isosize            scmp_sys_resolver
aulastlog                           join               scp
ausyscall                           journalctl         script
autopoint                           jq                 scriptreplay
auvirt                              js-config          sdiff
awk                                 k5srvutil          sechecker
base32                              kadmin             secon
base64                              kbxutil            sed
basename                            kdestroy           sediff
bash                                kernel-install     seinfo
bashbug                             keyctl             semodule_deps
block-until-url                     kill               semodule_expand
bootctl                             kinit              semodule_link
bsdcat                              klist              semodule_package
bsdcpio                             kmod               semodule_unpackage
bsdiff                              kpasswd            seq
bsdtar                              krb5-config        sesearch
bspatch                             ksba-config        setarch
bunzip2                             ksu                setfacl
busctl                              kswitch            setfattr
bzcat                               ktutil             setsid
bzcmp                               kvno               setterm
bzdiff                              last               sftp
bzegrep                             lastb              sg
bzfgrep                             lastlog            sh
bzgrep                              ldapadd            sha1sum
bzip2                               ldapcompare        sha224sum
bzip2recover                        ldapdelete         sha256sum
bzless                              ldapexop           sha384sum
bzmore                              ldapmodify         sha512sum
c_rehash                            ldapmodrdn         shlibsign
cal                                 ldappasswd         shred
captest                             ldapsearch         shuf
captoinfo                           ldapurl            sim_client
cat                                 ldapwhoami         slabtop
catchsegv                           ldbadd             sleep
cgpt                                ldbdel             sntp
chacl                               ldbedit            sort
chage                               ldbmodify          sotruss
chattr                              ldbrename          split
chcon                               ldbsearch          sprof
chfn                                ldd                sqlite3
chgrp                               lddtree            ssh
chkcon                              less               ssh-add
chmod                               lessecho           ssh-agent
chown                               lesskey            ssh-copy-id
chroot                              lesspipe           ssh-keygen
chrt                                libassuan-config   ssh-keyscan
chsh                                libgcrypt-config   sss_ssh_authorizedkeys
cksum                               liblinear-predict  sss_ssh_knownhostsproxy
clear                               liblinear-train    stat
cmp                                 link               stdbuf
col                                 linux32            strace
colcrt                              linux64            strace-log-merge
colrm                               ln                 stty
column                              locale             su
comm                                localectl          sudo
containerd                          localedef          sudoedit
containerd-shim                     locksmithctl       sudoreplay
coredumpctl                         logger             sum
coreos-cloudinit                    login              symcryptrun
coreos-install                      loginctl           symtree
coreos-metadata                     logname            sync
cp                                  look               systemctl
csplit                              ls                 systemd-analyze
ctr                                 lsattr             systemd-ask-password
curl                                lsblk              systemd-cat
curl-config                         lscpu              systemd-cgls
cut                                 lsipc              systemd-cgtop
date                                lslocks            systemd-delta
dbus-binding-tool                   lslogins           systemd-detect-virt
dbus-cleanup-sockets                lsmod              systemd-escape
dbus-daemon                         lsns               systemd-firstboot
dbus-launch                         lsof               systemd-hwdb
dbus-monitor                        lsscsi             systemd-inhibit
dbus-run-session                    lsusb              systemd-machine-id-setup
dbus-send                           lzcat              systemd-mount
dbus-test-tool                      lzcmp              systemd-notify
dbus-update-activation-environment  lzdiff             systemd-nspawn
dbus-uuidgen                        lzegrep            systemd-path
dd                                  lzfgrep            systemd-resolve
delv                                lzgrep             systemd-run
df                                  lzless             systemd-socket-activate
dgawk                               lzma               systemd-stdio-bridge
diff                                lzmadec            systemd-sysusers
diff3                               lzmainfo           systemd-tmpfiles
dig                                 lzmore             systemd-tty-ask-password-agent
dir                                 machinectl         systemd-umount
dircolors                           makedb             tabs
dirmngr                             mayday             tac
dirmngr-client                      mcookie            tail
dirname                             md5sum             tailf
dmesg                               mkdir              tar
dnsdomainname                       mkfifo             taskset
dnssec-dsfromkey                    mknod              tdbbackup
dnssec-importkey                    mkpasswd           tdbdump
dnssec-keyfromlabel                 mktemp             tdbrestore
dnssec-keygen                       modinfo            tdbtool
dnssec-revoke                       more               tee
dnssec-settime                      mount              test
dnssec-signzone                     mountpoint         tic
dnssec-verify                       mpicalc            tickadj
docker                              msgattrib          timedatectl
docker-containerd                   msgcat             timeout
docker-containerd-shim              msgcmp             tload
docker-proxy                        msgcomm            toe
docker-runc                         msgconv            toolbox
dockerd                             msgen              top
domainname                          msgexec            touch
du                                  msgfilter          tpmd
dumpelf                             msgfmt             tpmown
dumpsexp                            msggrep            tput
e2size                              msginit            tr
echo                                msgmerge           true
egrep                               msgunfmt           truncate
eject                               msguniq            tset
env                                 mv                 tsort
envsubst                            namei              tty
etcd2                               ncat               tzselect
etcdctl                             ncurses5-config    udevadm
ex                                  ncursesw5-config   ul
expand                              net                umount
expiry                              netcap             uname
expr                                netstat            uname26
factor                              networkctl         uncompress
faillog                             newgidmap          unexpand
fallocate                           newgrp             uniq
false                               newrole            unlink
fgrep                               newuidmap          unlzma
filecap                             ngettext           unshare
find                                nice               unxz
findcon                             nisdomainname      unzip
findmnt                             nl                 unzipsfx
fleet                               nohup              update-ssh-keys
fleetctl                            nproc              update_engine_client
fleetd                              npth-config        uptime
flock                               nsenter            usb-devices
fmt                                 nslookup           usbhid-dump
fold                                nspr-config        users
free                                nss-config         utmpdump
funzip                              nsupdate           uuclient
gapplication                        ntp-keygen         uuidgen
gawk                                ntpdc              vdir
gdbus                               ntpq               vi
gencat                              ntptime            view
getconf                             numfmt             vim
getent                              od                 vimdiff
getfacl                             oldfind            vmstat
getfattr                            openssl            w
getopt                              passwd             watch
gettext                             paste              watchgnupg
gettext.sh                          pathchk            wc
gettextize                          pcap-config        wdctl
gflags_completions.sh               pcprofiledump      wget
gio-querymodules                    pcre-config        whereis
git                                 pcregrep           which
git-cvsserver                       pcretest           who
git-receive-pack                    pg                 whoami
git-shell                           pgawk              whois
git-upload-archive                  pgrep              x86_64
git-upload-pack                     pidof              x86_64-cros-linux-gnu-curl-config
glib-compile-resources              pinentry           x86_64-cros-linux-gnu-gpg-error-config
glib-compile-schemas                pinentry-curses    x86_64-cros-linux-gnu-krb5-config
glib-genmarshal                     pinentry-tty       x86_64-cros-linux-gnu-libgcrypt-config
glib-gettextize                     ping               x86_64-cros-linux-gnu-nspr-config
gmsgfmt                             ping6              x86_64-cros-linux-gnu-nss-config
gobject-query                       pinky              x86_64-cros-linux-gnu-pcre-config
gpasswd                             pkaction           x86_64-cros-linux-gnu-xml2-config
gpg                                 pkcheck            xargs
gpg-agent                           pkexec             xenstore
gpg-connect-agent                   pkill              xgettext
gpg-error                           pkttyagent         xml2-config
gpg-error-config                    pldd               xmlcatalog
gpg2                                pmap               xmllint
gpgconf                             pr                 xmlwf
gpgparsemail                        printenv           xtrace
gpgscm                              printf             xz
gpgsm                               prlimit            xzcat
gpgtar                              protoc             xzcmp
gpgv                                ps                 xzdec
gpgv2                               pscap              xzdiff
grep                                pspax              xzegrep
gresource                           ptx                xzfgrep
groups                              pwd                xzgrep
gsettings                           pwdx               xzless
gss-client                          quota              xzmore
gtester                             quotasync          yes
gunzip                              randstat           ypdomainname
gzexe                               rbash              zcat
gzip                                readlink           zcmp
head                                realpath           zdiff
hexdump                             recode-sr-latin    zdump
hmac256                             rename             zegrep
host                                renice             zfgrep
hostid                              replcon            zforce
hostname                            reset              zgrep
hostnamectl                         rev                zic
i386                                rkt                zip
iconv                               rm                 zipcloak
id                                  rmdir              zipgrep
ifconfig                            rngtest            zipinfo
igawk                               rootdev            zipnote
indexcon                            route              zipsplit
infocmp                             rpcgen             zless
infotocap                           rsync              zmore
install                             runc               znew
ionice                              runcon
 Available commands /sbin (/sbin is a softlink to /usr/sbin):
core@localhost ~ $ ls /sbin/
adcli                getfilecon         modinfo                          sm-notify
addgnupghome         getpcaps           modprobe                         ss
addpart              getpidcon          mount.nfs                        sserver
agetty               getsebool          mount.nfs4                       sshd
applygnupgdefaults   getseuser          mpathpersist                     sss_cache
arp                  groupadd           multipath                        sss_debuglevel
auditctl             groupdel           multipathd                       sss_groupadd
augenrules           groupmems          nameif                           sss_groupdel
autrace              groupmod           newusers                         sss_groupmod
avcstat              grpck              nfsidmap                         sss_groupshow
badblocks            grpconv            nfsstat                          sss_override
blkdeactivate        grpunconv          nologin                          sss_seed
blkdiscard           gss-server         nscd                             sss_useradd
blkid                halt               nstat                            sss_userdel
blockdev             hwclock            ntpd                             sss_usermod
brctl                iconvconfig        ntpdate                          sssd
bridge               ifcfg              nvme                             start-statd
btrfs                ifstat             open_init_pty                    sulogin
btrfs-convert        init               osd_login                        swaplabel
btrfs-debug-tree     insmod             pam_tally                        swapoff
btrfs-find-root      ip6tables          pam_tally2                       swapon
btrfs-image          ip6tables-apply    pam_timestamp_check              switch_root
btrfs-map-logical    ip6tables-restore  parted                           sysctl
btrfs-select-super   ip6tables-save     partprobe                        tc
btrfs-show-super     ipmaddr            partx                            tcsd
btrfs-zero-log       ipset              pdata_tools                      telinit
btrfsck              iptables           pivot_root                       testsaslauthd
btrfstune            iptables-apply     plipconfig                       thin_check
cache_check          iptables-restore   pluginviewer                     thin_dump
cache_dump           iptables-save      policyvers                       thin_metadata_size
cache_metadata_size  iptunnel           poweroff                         thin_repair
cache_repair         iscsi-iname        pvchange                         thin_restore
cache_restore        iscsi_discovery    pvck                             thin_rmap
capsh                iscsiadm           pvcreate                         togglesebool
cfdisk               iscsid             pvdisplay                        tpm_hostpolicy
cgdisk               iscsistart         pvmove                           traceroute6
chcpu                kadmin.local       pvremove                         tune2fs
checkarray           kadmind            pvresize                         umount.nfs
chgpasswd            kdb5_util          pvs                              umount.nfs4
chpasswd             kdump              pvscan                           unix_chkpwd
compute_av           kexec              pwcheck                          unix_update
compute_create       key.dns_resolver   pwck                             update-ca-certificates
compute_member       kpartx             pwconv                           update_engine
compute_relabel      kprop              pwunconv                         update_engine_stub
compute_user         kpropd             quot                             useradd
consoletype          kproplog           quotacheck                       userdel
convertquota         krb5-send-pr       quotaoff                         usermod
coreos-postinst      krb5kdc            quotaon                          uuidd
coreos-setgoodroot   ldattach           quotastats                       uuserver
coreos-tmpfiles      ldconfig           rarp                             veritysetup
cryptsetup           lnstat             raw                              vgcfgbackup
ctrlaltdel           load_policy        readprofile                      vgcfgrestore
ctstat               logoutd            realm                            vgchange
debugfs              logrotate          reboot                           vgck
delpart              logsave            repquota                         vgconvert
depmod               losetup            request-key                      vgcreate
dhcpcd               lshw               resize2fs                        vgdisplay
dmeventd             lsmod              resizepart                       vgexport
dmsetup              lspci              restorecon                       vgextend
dmstats              lvchange           rmmod                            vgimport
dumpe2fs             lvconvert          rngd                             vgimportclone
e2freefrag           lvcreate           routef                           vgmerge
e2fsck               lvdisplay          routel                           vgmknodes
e2image              lvextend           rpc.idmapd                       vgreduce
e2label              lvm                rpc.mountd                       vgremove
e2undo               lvmchange          rpc.nfsd                         vgrename
e4defrag             lvmconf            rpc.rquotad                      vgs
ebtables             lvmconfig          rpc.statd                        vgscan
ebtables-restore     lvmdiskscan        rpcbind                          vgsplit
edquota              lvmdump            rpcdebug                         vigr
era_check            lvmetad            rpcinfo                          vipw
era_dump             lvmsadc            rtacct                           visudo
era_invalidate       lvmsar             rtcwake                          vmcore-dmesg
era_restore          lvreduce           rtmon                            warnquota
ethtool              lvremove           rtpr                             wipefs
exportfs             lvrename           rtstat                           xfs_admin
fdisk                lvresize           run_init                         xfs_bmap
filefrag             lvs                runlevel                         xfs_copy
findfs               lvscan             runuser                          xfs_db
fixparts             matchpathcon       saslauthd                        xfs_estimate
fsadm                mcstransd          sefcontext_compile               xfs_freeze
fsck                 mdadm              selinux_check_securetty_context  xfs_fsr
fsck.btrfs           mdassemble         selinuxexeccon                   xfs_growfs
fsck.cramfs          mdmon              semodule                         xfs_info
fsck.ext2            mii-tool           sestatus                         xfs_io
fsck.ext3            mke2fs             setcap                           xfs_logprint
fsck.ext4            mkfs               setenforce                       xfs_mdrestore
fsck.ext4dev         mkfs.bfs           setfilecon                       xfs_metadump
fsck.minix           mkfs.btrfs         setfiles                         xfs_mkfile
fsck.xfs             mkfs.cramfs        setpci                           xfs_ncheck
fsfreeze             mkfs.ext2          setquota                         xfs_quota
fstrim               mkfs.ext3          setsebool                        xfs_repair
gdisk                mkfs.ext4          sfdisk                           xfs_rtcp
genhomedircon        mkfs.ext4dev       sgdisk                           xqmstats
genl                 mkfs.minix         showmount                        xtables-multi
getcap               mkfs.xfs           shutdown                         zramctl
getconlist           mkhomedir_helper   sim_server
getdefaultcon        mklost+found       slattach
getenforce           mkswap             sln

First step to micorservices: CoreOS on virtualbox (1)

Sun, 2017-08-13 03:41
I read some articles about microservice architecture and about kubernetes / apache mesos.
My conclusion from these articles is, that lightweigt servers are a key point to this microservice architecture. Just to learn how tiny such a OS could be, i will try to install CoreOS inside virtualbox.

There is an easy way to get CoreOS running ("booting CoreOS container linux from ISO"), but there some limitations stated on the CoreOS website:

  1. There is no straightforward way to provide an Ignition config.
  2. A mininum of 1024M of RAM is required to boot Container Linux via ISO.
So just download the iso image coreos_production_iso_image.iso and create a virtualbox vm:





 Then mount the coreos_production_iso_image.iso as boot cd/dvd
 and here we go:
At this point we have something like a live cd running. Because nothing was installed on the hdd and it is not possible to umount the ISO image.

How to get from this point to a installed operating system on disk, i will show in a following posting.

(bash): The most useless commands (9)

Thu, 2017-08-10 13:03
After talking about
  1. rev
  2. yes
  3. sl
  4. cowsay
  5. cmatrix
  6. cal
  7. rig
here another pretty useless command:



$ pi 10
3.141592653Manpage:
DESCRIPTION
       The  pi  command  prints  100 decimal digits of Archimedes' constant pi or a number of
       digits specified by an integer parameter on the command line.

Ingress: Level 16 reached...

Mon, 2017-07-24 17:00
After long time playing google/niantic's ingress (the predecessor of pokemon go - all the arenas are portals in ingress, most of them created by ingress players) i reached the last level:



And the usual welcome package:


I am wondering, wether i should continue playing or quit the game for now or ever.
Perhaps reading this discussion (What do lvl 16 players play for?) may help me.

(bash): The most useless commands (8)

Wed, 2017-07-19 14:57

After talking about

  1. rev
  2. yes
  3. sl
  4. cowsay
  5. cmatrix
  6. cal
 i found another funny command:
rigIts manpage tells the following:
DESCRIPTION
       Rig  is a utility that will piece together a random first name, last name, street num‐
       ber and address, along with a geographically consistant (ie, they all match  the  same
       area) city, state, ZIP code, and area code.

       It is suitable for such applications as feeding the NY times registration page to fend
       off junk (snail) mail and telemarketers, or for registering  on  BBS's  to  which  you
       don't wish to reveal your real information.I am not sure if this tool is banned by the NSA ;-) but here we go:
schroff@zerberus:~$ rig
Carmelo Suarez
947 East Parson St
Alton, IL  62002
(708) xxx-xxxx
schroff@zerberus:~$ rig
Janna Stewart
970 Potter Rd
Auburn, NY  13021
(315) xxx-xxxx
schroff@zerberus:~$ rig
Bernadine Collins
27 Willow Rd
Seattle, WA  98109
(206) xxx-xxxx

OpenJDK 9: Jshell - Using Swing / doing GUI stuff

Sat, 2017-07-15 13:40
After the buitin commands of jshell and how to load and save scripts i tried to get swing components running.

I created a script  HelloWorld.java
import javax.swing.*;       

JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
frame.pack();
frame.setVisible(true);
But this does not work with Ubuntu:
jshell HelloWorld.java
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f61041bb009, pid=7440, tid=7442
#
# JRE version: OpenJDK Runtime Environment (9.0) (build 9-internal+0-2016-04-14-195246.buildd.src)
# Java VM: OpenJDK 64-Bit Server VM (9-internal+0-2016-04-14-195246.buildd.src, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libjava.so+0x1d009]  JNU_GetEnv+0x19
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to /home/schroff/core.7440)
#
# An error report file with more information is saved as:
# /home/schroff/hs_err_pid7440.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
|  State engine terminated.
|  Restore definitions with: /reload restore
|  Resetting...
|  Welcome to JShell -- Version 9-internal
|  For an introduction type: /help intro
Hmmm. This does look good.

On a Windows 10 host it works without any problem:


I hope this bug will be fixed soon...
EDIT: After downloading a new version from java.net it worked:

./java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+178)
Java HotSpot(TM) 64-Bit Server VM (build 9+178, mixed mode)


Bash: enabling Eclipse for Bash Programming | Plugin basheclipse (debugging) part 1

Fri, 2017-07-14 14:45
In my last posting i showed how to install the plugin shelled and its configuration options.

Now the next step is to install basheclipse, which enables eclipse in conjunction with shelled to debug bash scripts.

Step 1: Download basheclipse

Step 2: Do not copy the jar file to the plugins directory if you are using Eclipse Neon. Copy them to the dropins directory.

Step 3: Restart eclipse (and wait. I had to wait nearly 5 minutes with a cpu usage of 100%)

Step 4: Change the Shell interpreter in shelled (->window->preferences->shell script->interpreters):

Step  5: Create a new Shell Script Project:
 


 Step 6: Create a Shell Script File:

Step 7: Copy _DEBUG.sh into your project directory
Step 8: Add _DEBUG.sh at the beginning of your file with full qualified directory name:
 ~/devel/workspace/MyShellScriptProjekct/_DEBUG.shStep 9: Go to ->run->debug configurations and create a new configuration inside "bash script"
 You have to select your scriptfile here:
But after doing all this steps i was not able to set breakpoints.
I tried
  • java 1.5 with
    Eclipse Juno


    But this did not work.
  • java 1.9 with
    Eclipse Neon


    Did neither work (this posting)

But: Java 1.6 with Eclipse Luna works!


Read the next posting how to debug a bash scripts in eclipse...

EDIT: After changing from OpenJDK to Oracle's JDK it even works with Eclipse Neon.



























OpenJDK 9: Jshell - how to load scripts and how to save/persist finished snippets

Fri, 2017-07-14 13:07
In my last posting i showed the builtin jshell commands and how to start working with the java shell.

What about loading and saving scripts?

I created a file myshell.txt with this content:
class MyClass {
 private int a;
 public MyClass(){a=0;}
 int getA() {return a;};
 void setA(int var) {a=var; return;}
}
MyClass ZZ;
ZZ = new MyClass();
ZZ.setA(200);
The help shows the following:
-> /help /open

|  /open

|  Open a file and read its contents as snippets and commands.

|  /open
|      Read the specified file as jshell input.
so i tried this one:
-> /open myjshell.txthmmm. No feedback inside jshell. But no news is good news:
-> /list

   1 : class MyClass {
        private int a;
        public MyClass(){a=0;}
        int getA() {return a;};
        void setA(int var) {a=var; return;}
       }
   2 : MyClass ZZ;
   3 : ZZ = new MyClass();
   4 : ZZ.setA(200);
 Saving your work is quite easy:
-> /help /save

|  /save

|  Save the specified snippets and/or commands to the specified file.

|  /save
|      Save the source of current active snippets to the file.

|  /save all
|      Save the source of all snippets to the file.
|      Includes source including overwritten, failed, and start-up code.

|  /save history
|      Save the sequential history of all commands and snippets entered since jshell was launched.

|  /save start
|      Save the default start-up definitions to the file.
And also no news is good news:
-> /save myjshell2.txtand like expected:
$ cat myjshell2.txt
class MyClass {
 private int a;
 public MyClass(){a=0;}
 int getA() {return a;};
 void setA(int var) {a=var; return;}
}
MyClass ZZ;
ZZ = new MyClass();
ZZ.setA(200);
But what about this /save start ?
-> /save start myjshell3.txtand the content of this file is:
$ cat myjshell3.txt

import java.util.*;
import java.io.*;
import java.math.*;
import java.net.*;
import java.util.concurrent.*;
import java.util.prefs.*;
import java.util.regex.*;
void printf(String format, Object... args) { System.out.printf(format, args); }
 To load a scipt on startup just type
jshell myjshell.txt


OpenJDK 9: JShell - an interactive java interpreter shell | builtin commands

Wed, 2017-07-12 14:33
One of the new features of java 9 is jshell (JEP 222).

On my ubuntu system the installation was quite easy:
# apt-get install openjdk-9-jdk-headlessand you can find
$ ls /usr/lib/jvm/java-9-openjdk-amd64/bin/
idlj       jcmd    jmap        jstatd       schemagen
jar        jdb     jmod        keytool      serialver
jarsigner  jdeps   jps         orbd         servertool
java       jhsdb   jrunscript  pack200      tnameserv
javac      jimage  jsadebugd   policytool   unpack200
javadoc    jinfo   jshell      rmic         wsgen
javah      jjs     jstack      rmid         wsimport
javap      jlink   jstat       rmiregistry  xjc
 (in the third column, sixth row: jshell)

After a startup jshell comes up with this prompt:

$ /usr/lib/jvm/java-9-openjdk-amd64/bin/jshell
|  Welcome to JShell -- Version 9-internal
|  For an introduction type: /help intro


->
 The most important command is
/exitto leave the jshell (Strg-C works also, but i think /exit should be used).

There is no syntax highlighting but this does not matter.

The following builtin commands are allowed:
-> /help
|  Type a Java language expression, statement, or declaration.
|  Or type one of the following commands:

|     /list [all|start|]                       -- list the source you have typed
|     /edit                                    -- edit a source entry referenced by name or id
|     /drop                                    -- delete a source entry referenced by name or id
|     /save [all|history|start]                      -- Save snippet source to a file.
|     /open                                          -- open a file as source input
|     /vars                                                -- list the declared variables and their values
|     /methods                                             -- list the declared methods and their signatures
|     /classes                                             -- list the declared classes
|     /imports                                             -- list the imported items
|     /exit                                                -- exit jshell
|     /reset                                               -- reset jshell
|     /reload [restore] [quiet]                            -- reset and replay relevant history -- current or previous (restore)
|     /classpath                                     -- add a path to the classpath
|     /history                                             -- history of what you have typed
|     /help [|]                          -- get information about jshell
|     /set editor|start|feedback|newmode|prompt|format ... -- set jshell configuration information
|     /? [|]                             -- get information about jshell
|     /!                                                   -- re-run last snippet
|     /                                                -- re-run snippet by id
|     /-                                                -- re-run n-th previous snippet

|  For more information type '/help' followed by the name of command or a subject.
|  For example '/help /list' or '/help intro'.  Subjects:

|     intro     -- an introduction to the jshell tool
|     shortcuts -- a description of shortcuts
With /list the source code, which you provided, is shown:
-> /list 5

   5 : class MyClass {
       private int a;
       public MyClass(){a=0;}
       int getA() {return a;};
       void setA(int var) {a=var; return;}
       }

Everytime you create an Object, you will see the following:
-> ZZ = new MyClass();
|  Variable ZZ has been assigned the value MyClass@28d25987

-> ZZ.getA();
|  Expression value is: 0
|    assigned to temporary variable $8 of type int

-> ZZ.setA(200);

-> ZZ.getA();
|  Expression value is: 200
|    assigned to temporary variable $10 of type int With /vars the variables are shown:
-> /vars
|    MyClass ZZ = MyClass@28d25987
|    int $8 = 0
|    int $10 = 200
Listing the classes (ok it is getting boring):
-> /classes
|    class MyClass
 and last but not least /methods:
-> /methods
|    printf (String,Object...)void
|    getA ()int

Bash: enabling Eclipse for Bash Programming | Plugin Shelled (shell editor)

Mon, 2017-07-10 14:14
After writing several posts about useless shell commands i tried to enable Eclipse for working with the bourne again shell.

First step is to get a plugin for syntax highlighting. The plugin shelled
https://sourceforge.net/projects/shelled/ is very easy to find. Just download the zip

and in Eclipse go to "help --> install new software".
There you have to add the archive:
And all other clicks are straight forward:





After the installation of the plugin you have to restart your Eclipse IDE and then the editor understands bash commands:


The configuration can be done via -> window -> preferences

If you want to setup your own coloring scheme, you can customize it within -> Shell Script -> Editor -> Syntax coloring




(bash): The most useless commands (7)

Sat, 2017-07-01 03:14

After talking about
  1. rev
  2. sl
  3. cowsay
  4. cmatrix
here another pretty useless command:
calToday with every smartphone having its own calendar app or every e-mail program with integrated time planning function this command is no more needed. The manpage says:
NAME
     cal, ncal — displays a calendar and the date of EasterAnd here we go:
$ cal 2000
                            2000
       Januar               Februar                 März        
So Mo Di Mi Do Fr Sa  So Mo Di Mi Do Fr Sa  So Mo Di Mi Do Fr Sa
                   1         1  2  3  4  5            1  2  3  4
 2  3  4  5  6  7  8   6  7  8  9 10 11 12   5  6  7  8  9 10 11
 9 10 11 12 13 14 15  13 14 15 16 17 18 19  12 13 14 15 16 17 18
16 17 18 19 20 21 22  20 21 22 23 24 25 26  19 20 21 22 23 24 25
23 24 25 26 27 28 29  27 28 29              26 27 28 29 30 31  
30 31                                                          
       April                  Mai                   Juni        
So Mo Di Mi Do Fr Sa  So Mo Di Mi Do Fr Sa  So Mo Di Mi Do Fr Sa
                   1      1  2  3  4  5  6               1  2  3
 2  3  4  5  6  7  8   7  8  9 10 11 12 13   4  5  6  7  8  9 10
 9 10 11 12 13 14 15  14 15 16 17 18 19 20  11 12 13 14 15 16 17
16 17 18 19 20 21 22  21 22 23 24 25 26 27  18 19 20 21 22 23 24
23 24 25 26 27 28 29  28 29 30 31           25 26 27 28 29 30  
30                                                              
        Juli                 August              September      
So Mo Di Mi Do Fr Sa  So Mo Di Mi Do Fr Sa  So Mo Di Mi Do Fr Sa
                   1         1  2  3  4  5                  1  2
 2  3  4  5  6  7  8   6  7  8  9 10 11 12   3  4  5  6  7  8  9
 9 10 11 12 13 14 15  13 14 15 16 17 18 19  10 11 12 13 14 15 16
16 17 18 19 20 21 22  20 21 22 23 24 25 26  17 18 19 20 21 22 23
23 24 25 26 27 28 29  27 28 29 30 31        24 25 26 27 28 29 30
30 31                                                          
      Oktober               November              Dezember      
So Mo Di Mi Do Fr Sa  So Mo Di Mi Do Fr Sa  So Mo Di Mi Do Fr Sa
 1  2  3  4  5  6  7            1  2  3  4                  1  2
 8  9 10 11 12 13 14   5  6  7  8  9 10 11   3  4  5  6  7  8  9
15 16 17 18 19 20 21  12 13 14 15 16 17 18  10 11 12 13 14 15 16
22 23 24 25 26 27 28  19 20 21 22 23 24 25  17 18 19 20 21 22 23
29 30 31              26 27 28 29 30        24 25 26 27 28 29 30
                                            31                    
 Or "the date of Easter":
$ ncal -e 2018
 1 April 2018

(bash): The most useless commands (6)

Sat, 2017-06-24 08:35
After talking about
  1. rev
  2. sl
  3. cowsay
 i found another funny command:
cmatrixThe manpage says:
NAME
       CMatrix - simulates the display from "The Matrix"and it is true:

(bash): The most useless commands (5)

Wed, 2017-06-21 15:17
In a comment Albert Godfrind pointed out, that the commands i was talking about like
  1. rev
  2. sl
  3. cowsay
are not really bash commands (in a way that they will be installed within the installation of the bash shell). They are commands, which can be used from on every shell. So my headline is a little bit missleading - thanks for this notice.

Just for clarification here a list with all bash builtin commands:
  • alias
  • bind
  • builtin
  • caller
  • command
  • declare
  • echo
  • enable
  • help
  • let
  • local
  • logout
  • mapfile
  • printf
  • read
  • readarray
  • source
  • type
  • typeset
  • ulimit
  • unalias
and the bourne shell builtins:

  • break
  • cd
  • continue
  • eval
  • exec
  • export
  • getopts
  • hash
  • pwd
  • readonly
  • return
  • shift
  • test
  • times
  • trap
  • umask
  • unset
Still missing:

Bash: The most useless command (4)

Sun, 2017-06-18 14:04
The blog statistics show, that there are many people reading the posts about useless commands. And there is the next candidate:
cowsayNow you are thinking, what is cowsay?
DESCRIPTION
       Cowsay  generates  an  ASCII picture of a cow saying something provided by the user.  If run with no arguments, it accepts standard input, word-wraps
       the message given at about 40 columns, and prints the cow saying the given message on standard output.
?

Okay. Here we go:
$ echo what a cool command | cowsay
 _____________________
< what a cool command >
 ---------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
One thing to add here: moo 

Bash: The most useless command (3)

Wed, 2017-06-14 12:48
The blog statistics show, that there are many people reading the posts about useless commands. And there is the next candidate, suggested by an anonymous comment:
slThis is my most hated program on a shell. Why?
NAME
sl − display animations aimed to correct users who accidentally enter sl instead of ls.and this program is not interruptable by ctrl-c.
It shows a train running from the left to the right
and blocks your shell for at least 2-3 seconds (depends on the width of your shell window):
$ time sl
real 0m3.347s

Ubuntu: mouse jumps to trash icon / move to lower left corner / bottom left

Sat, 2017-06-10 14:02
There are many questions about jumping mouse cursors on ubuntu.
And there are often answers like
  • clean your touchpad
  • your touchpad is broken
  • send your laptop back
But there are so many people suffering this, so it is not reasonable that all these touchpads do not work well.

One thing to solve this is to install
gpointing-device-settingsbut this does not really help.
Next thing:
add-apt-repository ppa:atareao/atareao
apt-get update
apt-get install touchpad-indicator
/opt/extras.ubuntu.com/touchpad-indicator/bin/touchpad-indicator  But this is not really the solution. But you can disable your touchpad while typing, so that the window focus does not jump to the trash icon and your typing is interrupted.

After searching i found the following discussion on a mailing list:
https://lists.freedesktop.org/archives/xorg-devel/2014-June/042790.html

And the follwing did the job:
apt-get install xserver-xorg-core apt-get install xserver-xorg-input-libinput
apt-get remove --purge xserver-xorg-input-synaptics and then a logoff and login into the x window system...

Bash: The most useless command (2)

Fri, 2017-06-09 14:58
The last posting about useless commands for bash discussed the command
rev. One nice comment pointed out, that the rev command can be used for searching inside logfiles (Thanks to phoxis.org).

Like it was said there, the command
yeslooks even more useless:
NAME
       yes - output a string repeatedly until killed
SYNOPSIS
       yes [STRING]...
Ok - it can be used for scripts to answer call backs. But which kind of script needs always the same answer? (and commands like "apt-get" support this via the option "-y".

Any other suggestions about useless bash commands?

Bash: The most useless command

Sun, 2017-06-04 14:08
After many years working with the bourne again shell i still learn some commands, which i never used.
I am completely convinced that i discovered the most useless command:
revThe manpage says:
rev - reverse lines characterwise Is there anything, where i can use this command?

Ok. I can check if a word is a palindrome (like 123321 or otto):

#!/bin/bash
# Shell script to test if a string is a palindrome
# This simply uses the 'rev' command found in util-linux-ng package
# and checks if the reverse of the string is same as the original
 echo "Enter a String : "
read string
if [ "$(echo $string | rev)" = "$string" ]
then
 echo "\"$string\" IS a Palindrome"
else
 echo "\"$string\" IS NOT a Palindrome"
fiThis script i found in this article.

Have anyone used the rev command for something reasonable?
Please write a comment!

Pages