BLUG August 18 Meeting Report

We had another great meeting, with full room, and great pizza, cookies and soda provided by Taos.  As announced, after the opening time for announcements and other discussion, Clint spent the next 90 minutes going through his installation of Ubuntu 15.04 step and systemd usage as detailed in his outline for the evening:

Ubuntu 15.04 Post Install
   19  apt-get update
   20  apt-get upgrade
   21  apt-get install synaptic gdebi
   33  apt-get install vlc smplayer audacious qmmp mixxx xbmc handbrake openshot
   34  apt-get install ubuntu-restricted-extras openjdk-8-jdk
   35  apt-get install ffmpeg gstreamer0.10-plugins-bad lame libavcodec-extra
   36  /usr/share/doc/libdvdread4/install-css.sh
   37  apt-get install gimp gimp-plugin-registry gimp-data-extras darktable rawtherapee pinta shotwell inkscape
   38  apt-get install brasero k3b
   39  apt-get install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller
   40  apt-get install transmission
   41  apt-get install steam wine winetricks
   42  cd /home/tinslecl/Downloads/
   44  gdebi google-chrome-stable_current_amd64.deb
   45  apt-get install curl
   55  apt-get install fbreader
Ubuntu Software Centre was used to install several packages
Eclipse
Geany
Anjauta
Gamas3
LibreOffice Front End and Base
Systemadm (systemd-ui) Graphical tool for systemd

   86  apt-get install ntp ntpdate
   87  systemctl status ntp
   88  ntpq -p
  102  apt-get install mariadb-client mariadb-server
  103  vim /etc/mysql/mariadb.conf.d/mysqld.cnf
  104  mysql_secure_installation
  105  service mysql restart
  106  systemctl status mysqld
  107  systemctl status mariadb
  112  netstat -tap |grep mysql
  113  apt-get install apache2 apache2-doc apache2-utils libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libruby libapache2-mod-python php5-curl php5-intl php5-memcache php5-memcached php5-ming php5-ps php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl memcached
  114  a2enmod suexec rewrite ssl actions include cgi
  115  a2enmod dav_fs dav auth_digest
  116  php5enmod mcrypt
  117  vim /etc/apache2/mods-available/suphp.conf
  118  service apache2 restart

Initial inventory database
  128  mysql -u root -p  #create database inventory
  129  mysql -u root -p inventory < /home/tinslecl/Documents/RHEL7\ RHCSA-RHCE\ Tracks/RH254R7VT/RH254Cards_02_27/Day\ 3/Chapt9-Mariadb/inventory.dump # restore database inventory
  130  mysql -u root -p query database

System Control Demo:
Systemd introduction:

systemctl/systemd replaces:
* service
* chkconfig
* init
* runlevel

Runlevels are expressed as target values.
Similar equivalents but not the same:
* runlevel 1            = emergency.target
* runlevel 3            = multi-user.target
* runlevel 5            = graphical.target
* sulogin/maintenance        = rescue.target
* other maintenance        = emergency.target
All above require root password for root access.

graphical.target -  Multi-User, Network services
                                graphical and text based logins, desktop
multi-user.target - Multi-User, Network services
                                 text based logins only
rescue.target      -  sulogin, resolve disk/fstab boot issues
emergency.target -  complete boot, / (root) mounted read-only

systemctl - t help displays unit types:
systemctl is the tool we use to manage systemd services
display: systemctl -t help
Available unit types:
    .service
    .socket
    .busname
    .target
    .snapshot
    .device
    .mount
    .automount
    .swap
    .timer
    .path
    .slice
    .scope

service states:
   systemctl status name.type (no type, service is assumed)
   systemctl status ssh.service -l
=> keywords:
    loaded - configuration files has been processed
    active (running) - active running
    active (exited)  - complete one-time configuration
    active (waiting) - Running, waiting for an event
    inactive           - No running
        enabled      - will be started at boot time
        disabled     - will not be started at boot
        static           - cannot be enabled
                           maybe started by enabled unit
other status checks:
is-active  <= reports if service is active
is-enabled <= if enabled, persistent on reboot

Display units command:
systemctl       - lists all loaded units
systemctl --all - lists all units

Actions:
start          |
stop          |
status       |     <= service command group
restart      |
reload      |

reboot       |    reboot can still be used
poweroff   |    poweroff can also be used

enable       |    <= chkconfig command group
disable      |

is-active     |     <=status queries
is-enabled |

mask        <= prevent a service target from being started
unmask    <= enables a service target

cat             <= display unit configuration
edit           <= edit unit configuration

systemctl format: systemctl [action] [target].service

Normal service configuration:
root@dellinsp-1520:~# systemctl cat ssh.service
# /lib/systemd/system/ssh.service
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Service]
EnvironmentFile=-/etc/default/ssh
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=sshd.service

upstart service in /etc/init.d
systemctl cat apache2.service  (takes it values from /etc/init.d/apache2)
# /run/systemd/generator.late/apache2.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/apache2
Description=LSB: Apache2 web server
Before=runlevel2.target runlevel3.target runlevel4.target runlevel5.target shutdown.target
After=local-fs.target remote-fs.target network-online.target systemd-journald-dev-log.socket nss-lookup.target
Wants=network-online.target
Conflicts=shutdown.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/apache2 start
ExecStop=/etc/init.d/apache2 stop
ExecReload=/etc/init.d/apache2 reload

Demonstrate command:
cntrl-alt-f1 - virtual console
cntrl-alt-f7 - desktop

systemctl status apache2.service
systemctl stop apache2.service
systemctl status apache2.service
systemctl start apache2.service
systemctl status apache2.service

Show service dependencies: (tree view)
systemctl list-dependencies [name].service     
systemctl list-dependencies --reverse [name].service
ssh.service

Working with targets
boot target: (at boot)
systemctl get-default
systemctl set-default

Change target at command line (immediate)
systemctl isolate target_level

System functions:
systemctl reboot
systemctl poweroff
systemctl target_unit (boots to target value)

Analyze boot time:
systemd-analyze
systemd-analyze blame  <= see who is taking the most time
systemd-analyze plot > our.svg  <= open in image viewer
systemd-analyze --help <= display options

journalctl
systemd-journald by defaults only keeps the last boot
kept at cd /run/log/journal/
use journalctl to read (binary file, no text/cat)
*journalctl.txt*
commands:
journalctl - displays since system last booted
journalctl --since "2015-01-10 17:15:00"
journalctl --since "2015-01-10" --until "2015-01-11 03:00"
journalctl --since yesterday
journalctl --since 09:00 --until "1 hour ago"
journalctl -o verbose <= display parameters for searching
journalctl -help       <= display help system

To make journalctl persistent
mkdir /var/log/journal
chgrp systemd-journal /var/log/journal
chmod 2755 /var/log/journal
ls -ld /var/log/journal
getfacl /var/log/journal

journalctl --list-boots
journalctl -b -2
journalctl -b -1
journalctl -b

You can find out just how much space is being taken up by journals:
journalctl --disk-usage

There are two different ways to reduce disk space usage:
1. Shrink the journal based on the size.  This removes entries from oldest to newest until the desired disk space is reached:
journalctl --vacuum-size-2G
2. /etc/systemd/journald.conf allows you to set the maximum size limit of the /var/log/journal .
Uncomment (remove the # from the beginning of the line) the following line & add the size limit that you want:
SystemMaxUse=50M

https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs

Other new commands:
timedatectl
hostnamectl

https://wiki.ubuntu.com/SystemdForUpstartUsers
https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal

Ebook download: (Free) Systemd content starts on pg. 120
surfing.turtle.press
Ubuntu 15.04 Server with systemd Administration and Reference
http://www74.zippyshare.com/v/BWMmZYfL/file.html

Member Darin on Rooting or flashing your phone to get rid of all the "crapware" installed by your cellular provider as well updating to a new version of Android which your provider will not do.  His presentation focused on using Heimdall with the Heimdall-Front end. Darin's Heimdall ROM demo summary:

Many Galaxy S4 references talk label the T-mobile S4 as jfltetmo.

Install Heimdall:

    sudo add-apt-repository ppa:modycz/heimdall\
    sudo apt-get update
    sudo apt-get install heimdall-flash

Run as root!
    sudo heimdall-frontend
    
In heimdall:
    Lauch S4 in Download mode: Vol Down + power button
    Utilities Tab
        Click the Detect button
        Download the PIT (Partition info Table) and save it to a file e.g. S4PIT
    Click

How to Root with heimdall:
    http://www.all-things-android.com/content/how-root-samsung-mobile-device
    
Download Google apps:
    http://www.devfiles.co/download/fAgtiEoX/gapps-lp-20150314.zip

Download the latest TWRP recovery.img as it is able to mount the external SD card:    
    http://teamw.in/devices/samsunggalaxys4tmobile.html
    
Download Mokee ROMs:
    http://download.mokeedev.com/

Other Resources:
http://www.xda-developers.com/heimdall-suite-1-4-0-released/
https://github.com/Benjamin-Dobell/Heimdall
[HOW-TO] Flashing with Odin/Heimdall:
http://forum.xda-developers.com/showthread.php?t=1922461
Product/Downloads: http://glassechidna.com.au/heimdall/
The TeamWin Recovery Project (or TWRP, for short) has quickly become one of the most popular custom recoveries for Android.
http://www.xda-developers.com/tag/twrp/

Another member offered to do an extended presentation on this topic in the near future.

We are looking for presenters for our next meeting on September 15th or topics for presentation, please email us at c_tinsley at msn.com