Systemd the Operating System?

It appears that Lennard Poettering is a student of Adolf Hitler plan to invade the Sudetenland. Just let me do this and all will be well! Systemd was sold to the adoring masses on the basis that it would significantly speed up system startup and shutdown. That was a complete lie from the start. Systemd has not significantly improved system startup or shutdown times. Instead it has seriously complicated things for ordinary system administrators and integrators. Instead of a small number of initialization scripts, there are hundreds of configuration files and executables.

Since then, systemd has spread like a cancer into many areas of most Linux distributions and even tried to muscle its way into the Linux kernel until Linux Torvalds put a stop to that effort.

The following slide from a recent GNOME Asia conference should alarm people. It shows how deeply embedded systemd had become in modern Linux distributions.

Poettering’s goals for systemd should seriously worry people.

So Linux today is just a big of bits? Tell that to all the companies who are betting their future on Linux. He wants to build the Internets Next Generation OS! Time to push back against such immature arrogance.

Korn Shell DEBUG Trap

The trap shell builtin is used to change the way signals are handled by the Korn Shell 93 (ksh93) shell. In addition, a trap may be set for three ksh93 pseudo-signals: EXIT, ERR, and DEBUG. In this post we demonstrate how to use the DEBUG pseudo-signal to trap changes in the value of a variable for debugging purposes.

trap [  -p  ] [  action   ] [  sig   ] . . .

    The -p option causes the trap action associated with each trap as specified by the
    arguments to be printed with appropriate quoting. Otherwise, action  will be processed 
    as if it were an argument to eval when the shell receives signal(s) sig. Each sig can 
    be given as a number or as the name of the signal. Trap commands are executed in order
    of signal number. Any attempt to set a trap on a signal that was ignored on entry to 
    the current shell is ineffective. If action  is omitted and the first sig  is a number,
    or if action  is -, then the trap(s) for each sig  are reset to their original values. 
    If action  is the null string then this signal is ignored by the shell and by the 
    commands it invokes. If sig  is ERR then action  will be executed whenever a command 
    has a non-zero exit status. If sig  is DEBUG then action  will be executed before each
    command. The variable .sh.command will contain the contents of the current command line
    when action  is running. If the exit status of the trap is 2 the command will not be 
    executed. If the exit status of the trap is 255 and inside a function or a dot script, 
    the function or dot script will return. If sig  is 0 or EXIT and the trap statement is 
    executed inside the body of a function defined with the function name  syntax, then the 
    command action is executed after the function completes. If sig  is 0 or EXIT for a trap 
    set outside any function then the command action  is executed on exit from the shell. If
    sig is KEYBD, then action  will be executed whenever a key is read while in emacs, 
    gmacs, or vi  mode. The trap command with no arguments prints a list of commands 
    associated with each signal number.

    An exit or return without an argument in a trap action will preserve the exit status
    of the command that invoked the trap. 

Consider the following simple shell script (demo.ksh) and its output when invoked:

#!/bin/ksh

let LIMIT=50

function debugprint {
    (( LIMIT > 50 )) &&  {
        printf "   >>> Line No: %d\n" ${.sh.lineno}
        printf "   >>>   Level: %d\n" "${.sh.level}"
        printf "   >>> Command: %s\n" "${.sh.command}"
        printf "   >>>  Notice: LIMIT > 50\n"
    }
}

trap debugprint DEBUG

printf "Value of LIMIT variable is %d\n"  $LIMIT
(( LIMIT += 30 ))
printf "Value of LIMIT variable is %d\n"  $LIMIT

$ ./demo.ksh 
Value of LIMIT variable is 50
   >>> Line No: 17
   >>>   Level: 1
   >>> Command: printf 'Value of LIMIT variable is %d\n' 80
   >>>  Notice: LIMIT > 50
Value of LIMIT variable is 80
$ 


As you can seem the script outputs detailed debugging information whenever the value of LIMIT is greater than 50.

Here is an explanation of the special ksh93 shell variables used in the above script.

.sh.command

    When processing a DEBUG trap, this variable contains the current command line that 
    is about to run. 

sh.lineno

    Set during a DEBUG trap to the line number for the caller of each function. 

.sh.level

    Set to the current function depth. This can be changed inside a DEBUG trap and will 
    set the context to the specified level. 


As you can see using the TRAP pseudo-signal is a much more targeted and detailed method of debugging a Korn Shell script than if you use the standard set -x shell debugging option.

Unix Domain Sockets

Unix domain (UD) sockets are an inter-process communication (IPC) mechanism that allows bidirectional data exchange between processes running on the same platform. They are sometimes called local sockets. Communication occurs entirely within the operating system kernel. The closest IPC mechanism to a UD socket is probably a Unix pipe or a Linux Netlink socket. Note that the term domain in UD has nothing to do with DNS, NIS, LDAP, or Active Directory, and instead refers to the file system.

A UD socket is uniquely identified by a filesystem pathname. Obviously, both processes have to agree on the pathname for them to communicate with each other. Technically, UD sockets use the filesystem as their address name space and they are referenced by processes as inodes in the filesystem. Processes using UD sockets do not need to share a common ancestry.

UD sockets are a completely separate mechanism from network sockets which can use IP sockets to communicate between processes running on the same platform via an IPv4 or IPv6 loopback interface. UD sockets can avoid some checks and operations that IP sockets have to perform. This makes them faster and lighter-weight compared with IP sockets. Thus a UD socket does not require any network support to work. UD sockets are not limited to just two processes, many processes can use the same UD socket. For this reason, a popular use case for UD sockets is client-server applications.

A UD socket may be created as connection‑mode (SOCK_STREAM or SOCK_SEQPACKET) sockets or as connectionless (SOCK_DGRAM) sockets, while pipes are standard streams only. Communication is bidirectional with stream sockets and unidirectional with datagram sockets.

File and directory permissions can be used to restrict which processes on a platform can open or access a UD socket, and thus communicate with another process. Thus UD socket security is superior to IP sockets to which anyone can connect, unless extra authentication logic is in place. Remote hosts cannot connect to a UD socket without some sort of a forwarding mechanism. Neither can UD sockets be eavesdropped on by an IP socket without some sort of forwarding mechanism.

Linux supports a type of UD socket called an abstract named socket which is identical to regular UD socket except that a proper pathname does not exist in the filesystem. File permissions do not apply to abstract named sockets, and they can be accessed from inside chroot jails. The trick used is to make the first byte of the bind address name a null.

A UD socket is represented in the following structure:


       #define UNIX_PATH_MAX    108

       struct sockaddr_un {
           sa_family_t sun_family;                  /* AF_UNIX */
           char        sun_path[UNIX_PATH_MAX];     /* pathname */
       };

       Three types of address are distinguished in this structure:

       -  pathname: a UNIX domain socket can be bound to a null-terminated
          filesystem pathname using bind(2).  When the address of the socket
          is returned by getsockname(2), getpeername(2), and accept(2), its
          length is

              offsetof(struct sockaddr_un, sun_path) + strlen(sun_path) + 1

          and sun_path contains the null-terminated pathname.

       -  unnamed: A stream socket that has not been bound to a pathname
          using bind(2) has no name.  Likewise, the two sockets created by
          socketpair(2) are unnamed.  When the address of an unnamed socket
          is returned by getsockname(2), getpeername(2), and accept(2), its
          length is sizeof(sa_family_t), and sun_path should not be
          inspected.

       -  abstract: an abstract socket address is distinguished by the fact
          that sun_path[0] is a null byte ('\0').  The socket's address in
          this namespace is given by the additional bytes in sun_path that
          are covered by the specified length of the address structure.
          (Null bytes in the name have no special significance.)  The name
          has no connection with filesystem pathnames.  When the address of
          an abstract socket is returned by getsockname(2), getpeername(2),
          and accept(2), the returned addrlen is greater than
          sizeof(sa_family_t) (i.e., greater than 2), and the name of the
          socket is contained in the first (addrlen - sizeof(sa_family_t))
          bytes of sun_path.  The abstract socket namespace is a nonportable
          Linux extension.

To list UD sockets:

# netstat -ap --unix

Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ]         DGRAM                    5374     1/init               /run/systemd/shutdownd
unix  2      [ ACC ]     STREAM     LISTENING     11542    299/mcelog           /var/run/mcelog-client
unix  2      [ ACC ]     SEQPACKET  LISTENING     5398     1/init               /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     5409     1/init               /run/systemd/journal/stdout
unix  4      [ ]         DGRAM                    5413     1/init               /run/systemd/journal/socket
unix  26     [ ]         DGRAM                    5417     1/init               /dev/log
unix  2      [ ACC ]     STREAM     LISTENING     8754     1/init               /var/run/rpcbind.sock
unix  2      [ ACC ]     STREAM     LISTENING     16462    655/gnome-session    @/tmp/.ICE-unix/655
unix  2      [ ACC ]     STREAM     LISTENING     8765     1/init               /var/run/pcscd/pcscd.comm
unix  2      [ ACC ]     STREAM     LISTENING     10050    263/acpid            /var/run/acpid.socket
unix  2      [ ACC ]     STREAM     LISTENING     16712    653/gnome-keyring-d  /run/user/fpm/keyring-YTwafF/pkcs11
unix  2      [ ACC ]     STREAM     LISTENING     16714    653/gnome-keyring-d  /run/user/fpm/keyring-YTwafF/gpg
unix  2      [ ACC ]     STREAM     LISTENING     16716    653/gnome-keyring-d  /run/user/fpm/keyring-YTwafF/ssh
unix  2      [ ACC ]     STREAM     LISTENING     8777     1/init               /var/run/avahi-daemon/socket
unix  2      [ ACC ]     STREAM     LISTENING     8789     1/init               /var/run/cups/cups.sock
unix  2      [ ACC ]     STREAM     LISTENING     12029    368/Xorg             @/tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     8798     1/init               /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     12690    372/bluetoothd       /var/run/sdp
unix  2      [ ACC ]     STREAM     LISTENING     16033    653/gnome-keyring-d  /run/user/fpm/keyring-YTwafF/control
unix  2      [ ACC ]     STREAM     LISTENING     12459    376/rpcbind          /var/run/rpcbind.sock
unix  2      [ ACC ]     STREAM     LISTENING     12030    368/Xorg             /tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     16770    864/pulseaudio       /tmp/.esd-1000/socket
unix  2      [ ACC ]     STREAM     LISTENING     16772    864/pulseaudio       /home/fpm/.pulse/484969ea1695f6488ba1176f00000009-runtime/native
unix  2      [ ACC ]     STREAM     LISTENING     14396    360/gdm-simple-slav  @/tmp/gdm-session-WaQGMhfp
unix  2      [ ACC ]     STREAM     LISTENING     15815    513/python           /var/run/setroubleshoot/setroubleshoot_server
unix  2      [ ACC ]     STREAM     LISTENING     16103    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  2      [ ACC ]     STREAM     LISTENING     16773    864/pulseaudio       /home/fpm/.pulse/484969ea1695f6488ba1176f00000009-runtime/dbus-socket
unix  2      [ ACC ]     STREAM     LISTENING     16463    655/gnome-session    /tmp/.ICE-unix/655
unix  2      [ ]         DGRAM                    5334     1/init               /run/systemd/notify
unix  2      [ ACC ]     STREAM     LISTENING     5336     1/init               /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     11758    229/abrtd            /var/run/abrt/abrt.socket
unix  2      [ ]         DGRAM                    5360     1/init               /run/systemd/journal/syslog
unix  3      [ ]         STREAM     CONNECTED     15171    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     11655    313/avahi-daemon: c  
unix  3      [ ]         STREAM     CONNECTED     16747    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16410    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     18160    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17885    984/evolution-alarm  
unix  2      [ ]         DGRAM                    12481    371/modem-manager    
unix  3      [ ]         STREAM     CONNECTED     17995    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17771    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16598    653/gnome-keyring-d  
unix  3      [ ]         STREAM     CONNECTED     18187    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     18437    875/cupsd            
unix  3      [ ]         STREAM     CONNECTED     16753    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16473    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17977    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17777    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     18166    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17910    984/evolution-alarm  
unix  3      [ ]         STREAM     CONNECTED     18172    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17918    953/seapplet         
unix  3      [ ]         STREAM     CONNECTED     11811    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     18143    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     17986    1027/gconfd-2        
unix  2      [ ]         DGRAM                    12449    372/bluetoothd       
unix  3      [ ]         STREAM     CONNECTED     16466    655/gnome-session    
unix  3      [ ]         STREAM     CONNECTED     15464    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     18301    1079/gnome-terminal  
unix  3      [ ]         STREAM     CONNECTED     16768    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17940    923/abrt-applet      
unix  3      [ ]         STREAM     CONNECTED     11654    259/avahi-daemon: r  
unix  3      [ ]         STREAM     CONNECTED     17943    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     11002    274/sedispatch       
unix  3      [ ]         STREAM     CONNECTED     62649    1250/su              
unix  3      [ ]         STREAM     CONNECTED     18295    1079/gnome-terminal  
unix  3      [ ]         STREAM     CONNECTED     18198    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17792    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     18297    1079/gnome-terminal  
unix  3      [ ]         STREAM     CONNECTED     16751    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16743    864/pulseaudio       
unix  3      [ ]         STREAM     CONNECTED     15377    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     17589    923/abrt-applet      
unix  3      [ ]         STREAM     CONNECTED     9809     56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     17243    896/colord           
unix  3      [ ]         STREAM     CONNECTED     17099    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17002    877/gsd-printer      
unix  3      [ ]         STREAM     CONNECTED     9883     259/avahi-daemon: r  
unix  2      [ ]         DGRAM                    27522    1477/sendmail: Queu  
unix  3      [ ]         STREAM     CONNECTED     16746    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     14031    360/gdm-simple-slav  
unix  3      [ ]         STREAM     CONNECTED     10204    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     18108    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16225    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     11814    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17406    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     11860    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17404    864/pulseaudio       /home/fpm/.pulse/484969ea1695f6488ba1176f00000009-runtime/native
unix  3      [ ]         STREAM     CONNECTED     17261    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     17114    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16813    655/gnome-session    
unix  2      [ ]         DGRAM                    15884    359/polkitd          
unix  3      [ ]         STREAM     CONNECTED     18215    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     15846    622/gdm-session-wor  
unix  3      [ ]         STREAM     CONNECTED     12667    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     11973    360/gdm-simple-slav  
unix  3      [ ]         STREAM     CONNECTED     11264    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     18064    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17120    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     15670    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  2      [ ]         DGRAM                    11752    229/abrtd            
unix  3      [ ]         STREAM     CONNECTED     17754    915/tracker-store    
unix  3      [ ]         STREAM     CONNECTED     18293    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     16170    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     13944    449/VBoxService      
unix  3      [ ]         STREAM     CONNECTED     18061    917/deja-dup-monito  
unix  3      [ ]         STREAM     CONNECTED     17396    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     16811    864/pulseaudio       
unix  3      [ ]         STREAM     CONNECTED     10130    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     16163    729/imsettings-daem  
unix  3      [ ]         STREAM     CONNECTED     17739    923/abrt-applet      
unix  3      [ ]         STREAM     CONNECTED     16823    653/gnome-keyring-d  /run/user/fpm/keyring-YTwafF/pkcs11
unix  3      [ ]         STREAM     CONNECTED     11804    304/dbus-daemon      
unix  3      [ ]         STREAM     CONNECTED     17886    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     17770    915/tracker-store    
unix  3      [ ]         STREAM     CONNECTED     16573    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     15170    544/upowerd          
unix  2      [ ]         DGRAM                    11642    265/systemd-logind   
unix  3      [ ]         STREAM     CONNECTED     16754    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     18195    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     18159    1052/mission-contro  
unix  3      [ ]         STREAM     CONNECTED     17994    990/gnome-screensav  
unix  3      [ ]         STREAM     CONNECTED     17776    934/nm-applet        
unix  3      [ ]         STREAM     CONNECTED     17911    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16724    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16472    655/gnome-session    
unix  3      [ ]         STREAM     CONNECTED     11545    1/init               
unix  3      [ ]         STREAM     CONNECTED     17976    934/nm-applet        
unix  3      [ ]         STREAM     CONNECTED     16405    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     18184    1056/goa-daemon      
unix  3      [ ]         STREAM     CONNECTED     18165    1052/mission-contro  
unix  3      [ ]         STREAM     CONNECTED     18304    1085/gnome-pty-help  
unix  3      [ ]         STREAM     CONNECTED     16458    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     16467    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     18200    916/tracker-miner-f  
unix  3      [ ]         STREAM     CONNECTED     17791    983/dconf-service    
unix  3      [ ]         STREAM     CONNECTED     16572    653/gnome-keyring-d  
unix  3      [ ]         STREAM     CONNECTED     15463    594/rtkit-daemon     
unix  3      [ ]         STREAM     CONNECTED     12608    372/bluetoothd       
unix  3      [ ]         STREAM     CONNECTED     18300    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  2      [ ]         DGRAM                    62683    1250/su              
unix  3      [ ]         STREAM     CONNECTED     18142    1050/gnome-shell-ca  
unix  3      [ ]         STREAM     CONNECTED     17919    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17987    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16392    827/VBoxClient       
unix  3      [ ]         STREAM     CONNECTED     16752    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     15375    594/rtkit-daemon     
unix  3      [ ]         STREAM     CONNECTED     18296    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  2      [ ]         DGRAM                    16735    864/pulseaudio       
unix  3      [ ]         STREAM     CONNECTED     11663    265/systemd-logind   
unix  3      [ ]         STREAM     CONNECTED     17942    923/abrt-applet      
unix  2      [ ]         DGRAM                    10537    246/audispd          
unix  3      [ ]         STREAM     CONNECTED     17941    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17244    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17107    884/gvfs-udisks2-vo  
unix  3      [ ]         STREAM     CONNECTED     17003    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     15849    360/gdm-simple-slav  @/tmp/gdm-session-WaQGMhfp
unix  2      [ ]         DGRAM                    9814     263/acpid            
unix  3      [ ]         STREAM     CONNECTED     17590    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     14474    498/accounts-daemon  
unix  3      [ ]         STREAM     CONNECTED     9579     246/audispd          
unix  3      [ ]         STREAM     CONNECTED     10276    266/system-setup-ke  
unix  3      [ ]         STREAM     CONNECTED     16814    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16164    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     14032    368/Xorg             @/tmp/.X11-unix/X0
unix  2      [ ]         DGRAM                    11871    304/dbus-daemon      
unix  3      [ ]         STREAM     CONNECTED     18107    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     17262    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17199    896/colord           
unix  3      [ ]         STREAM     CONNECTED     17019    884/gvfs-udisks2-vo  
unix  3      [ ]         STREAM     CONNECTED     14475    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  2      [ ]         DGRAM                    9581     226/auditd           
unix  3      [ ]         STREAM     CONNECTED     17407    655/gnome-session    @/tmp/.ICE-unix/655
unix  3      [ ]         STREAM     CONNECTED     11475    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     18214    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     12886    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     16169    732/gvfsd            
unix  3      [ ]         STREAM     CONNECTED     11803    304/dbus-daemon      
unix  3      [ ]         STREAM     CONNECTED     18063    917/deja-dup-monito  
unix  3      [ ]         STREAM     CONNECTED     17020    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16788    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     11974    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17755    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     18292    1079/gnome-terminal  
unix  3      [ ]         STREAM     CONNECTED     16113    667/dbus-daemon      
unix  3      [ ]         STREAM     CONNECTED     16160    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     18062    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16821    864/pulseaudio       /home/fpm/.pulse/484969ea1695f6488ba1176f00000009-runtime/native
unix  3      [ ]         STREAM     CONNECTED     17740    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17128    895/gvfs-gphoto2-vo  
unix  3      [ ]         STREAM     CONNECTED     15162    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     17397    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     11213    292/crond            
unix  3      [ ]         STREAM     CONNECTED     18185    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16822    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     15177    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     11883    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17989    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17888    990/gnome-screensav  
unix  3      [ ]         STREAM     CONNECTED     17768    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16159    729/imsettings-daem  
unix  3      [ ]         STREAM     CONNECTED     16723    864/pulseaudio       
unix  2      [ ]         DGRAM                    18170    1056/goa-daemon      
unix  3      [ ]         STREAM     CONNECTED     16755    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16494    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16416    827/VBoxClient       
unix  3      [ ]         STREAM     CONNECTED     11805    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     18203    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     18016    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     12490    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17912    990/gnome-screensav  
unix  3      [ ]         STREAM     CONNECTED     62650    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     18201    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     18148    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17975    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17787    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  2      [ ]         DGRAM                    15462    594/rtkit-daemon     
unix  3      [ ]         STREAM     CONNECTED     18303    1079/gnome-terminal  
unix  3      [ ]         STREAM     CONNECTED     18004    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     17965    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17853    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16406    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     18196    864/pulseaudio       /home/fpm/.pulse/484969ea1695f6488ba1176f00000009-runtime/native
unix  3      [ ]         STREAM     CONNECTED     18154    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     18299    1079/gnome-terminal  
unix  3      [ ]         STREAM     CONNECTED     16719    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     16460    655/gnome-session    
unix  3      [ ]         STREAM     CONNECTED     11808    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     14473    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     18141    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  2      [ ]         DGRAM                    6303     1/init               
unix  3      [ ]         DGRAM                    6451     66/udevd             
unix  3      [ ]         STREAM     CONNECTED     17671    923/abrt-applet      
unix  3      [ ]         STREAM     CONNECTED     16362    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     9580     226/auditd           
unix  3      [ ]         STREAM     CONNECTED     17251    902/gnome-shell      
unix  2      [ ]         DGRAM                    17091    886/udisksd          
unix  3      [ ]         STREAM     CONNECTED     17012    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     15848    622/gdm-session-wor  
unix  3      [ ]         STREAM     CONNECTED     15840    622/gdm-session-wor  
unix  3      [ ]         STREAM     CONNECTED     11859    264/NetworkManager   
unix  3      [ ]         STREAM     CONNECTED     18241    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     12881    400/sshd             
unix  3      [ ]         STREAM     CONNECTED     9810     56/systemd-journald  /run/systemd/journal/stdout
unix  2      [ ]         DGRAM                    6539     66/udevd             
unix  3      [ ]         STREAM     CONNECTED     18068    653/gnome-keyring-d  /run/user/fpm/keyring-YTwafF/pkcs11
unix  3      [ ]         STREAM     CONNECTED     10277    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     16227    734/gvfs-fuse-daemo  
unix  3      [ ]         STREAM     CONNECTED     11537    304/dbus-daemon      
unix  3      [ ]         STREAM     CONNECTED     17864    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     9884     56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     17331    906/colord-sane      
unix  3      [ ]         STREAM     CONNECTED     17108    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16891    875/cupsd            
unix  3      [ ]         STREAM     CONNECTED     16787    864/pulseaudio       
unix  3      [ ]         STREAM     CONNECTED     14617    274/sedispatch       
unix  3      [ ]         STREAM     CONNECTED     16892    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     16086    368/Xorg             @/tmp/.X11-unix/X0
unix  2      [ ]         DGRAM                    12970    405/rpc.statd        
unix  3      [ ]         STREAM     CONNECTED     18058    917/deja-dup-monito  
unix  3      [ ]         STREAM     CONNECTED     17395    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17200    56/systemd-journald  /run/systemd/journal/stdout
unix  2      [ ]         DGRAM                    15662    513/python           
unix  2      [ ]         DGRAM                    16051    360/gdm-simple-slav  
unix  3      [ ]         STREAM     CONNECTED     11931    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16229    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     11474    299/mcelog           
unix  2      [ ]         DGRAM                    16015    622/gdm-session-wor  
unix  3      [ ]         STREAM     CONNECTED     11799    264/NetworkManager   
unix  3      [ ]         STREAM     CONNECTED     14472    498/accounts-daemon  
unix  3      [ ]         STREAM     CONNECTED     18019    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17129    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16820    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     15161    544/upowerd          
unix  3      [ ]         STREAM     CONNECTED     16380    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     18009    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     18186    1050/gnome-shell-ca  
unix  3      [ ]         STREAM     CONNECTED     16393    829/VBoxClient       
unix  3      [ ]         STREAM     CONNECTED     16461    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17889    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     17767    916/tracker-miner-f  
unix  3      [ ]         STREAM     CONNECTED     15175    544/upowerd          
unix  3      [ ]         STREAM     CONNECTED     11882    295/gdm-binary       
unix  3      [ ]         STREAM     CONNECTED     16750    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     16599    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     17988    984/evolution-alarm  
unix  2      [ ]         DGRAM                    13794    292/crond            
unix  3      [ ]         STREAM     CONNECTED     18171    1056/goa-daemon      
unix  3      [ ]         STREAM     CONNECTED     18438    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16457    655/gnome-session    
unix  3      [ ]         STREAM     CONNECTED     18007    934/nm-applet        
unix  3      [ ]         STREAM     CONNECTED     17913    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16767    864/pulseaudio       
unix  3      [ ]         STREAM     CONNECTED     16493    655/gnome-session    
unix  2      [ ]         DGRAM                    11651    259/avahi-daemon: r  
unix  3      [ ]         STREAM     CONNECTED     16744    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     16417    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     18302    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     11666    259/avahi-daemon: r  
unix  3      [ ]         STREAM     CONNECTED     18147    1050/gnome-shell-ca  
unix  3      [ ]         STREAM     CONNECTED     17974    1027/gconfd-2        
unix  3      [ ]         STREAM     CONNECTED     11003    246/audispd          
unix  3      [ ]         STREAM     CONNECTED     18202    916/tracker-miner-f  
unix  3      [ ]         STREAM     CONNECTED     17786    916/tracker-miner-f  
unix  3      [ ]         STREAM     CONNECTED     18298    655/gnome-session    @/tmp/.ICE-unix/655
unix  2      [ ]         DGRAM                    27095    1451/sendmail: acce  
unix  3      [ ]         STREAM     CONNECTED     16720    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     18003    990/gnome-screensav  
unix  3      [ ]         STREAM     CONNECTED     17964    984/evolution-alarm  
unix  3      [ ]         STREAM     CONNECTED     12489    371/modem-manager    
unix  3      [ ]         STREAM     CONNECTED     18153    1052/mission-contro  
unix  3      [ ]         STREAM     CONNECTED     17852    934/nm-applet        
unix  3      [ ]         STREAM     CONNECTED     18197    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     15841    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     10203    265/systemd-logind   
unix  3      [ ]         DGRAM                    6452     66/udevd             
unix  2      [ ]         DGRAM                    26795    1430/dhclient        
unix  3      [ ]         STREAM     CONNECTED     16361    810/VBoxClient       
unix  3      [ ]         STREAM     CONNECTED     18140    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     17252    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     17098    886/udisksd          
unix  3      [ ]         STREAM     CONNECTED     17011    877/gsd-printer      
unix  3      [ ]         STREAM     CONNECTED     15847    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16114    666/dbus-launch      
unix  3      [ ]         STREAM     CONNECTED     17672    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     9805     254/abrt-watch-log   
unix  3      [ ]         STREAM     CONNECTED     9733     253/abrt-watch-log   
unix  3      [ ]         STREAM     CONNECTED     18242    864/pulseaudio       /home/fpm/.pulse/484969ea1695f6488ba1176f00000009-runtime/native
unix  3      [ ]         STREAM     CONNECTED     16224    734/gvfs-fuse-daemo  
unix  3      [ ]         STREAM     CONNECTED     13945    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16115    368/Xorg             @/tmp/.X11-unix/X0
unix  3      [ ]         STREAM     CONNECTED     18067    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     17338    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     17113    884/gvfs-udisks2-vo  
unix  3      [ ]         STREAM     CONNECTED     14618    304/dbus-daemon      /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     16085    666/dbus-launch      
unix  3      [ ]         STREAM     CONNECTED     17863    953/seapplet         
unix  3      [ ]         STREAM     CONNECTED     18008    990/gnome-screensav  
unix  3      [ ]         STREAM     CONNECTED     17119    892/gvfs-afc-volume  
unix  3      [ ]         STREAM     CONNECTED     17013    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     11930    359/polkitd          
unix  3      [ ]         STREAM     CONNECTED     16379    820/VBoxClient       
unix  3      [ ]         STREAM     CONNECTED     11539    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     18059    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  2      [ ]         STREAM     CONNECTED     16905    861/gnome-settings-  
unix  3      [ ]         STREAM     CONNECTED     15669    513/python           
unix  3      [ ]         STREAM     CONNECTED     12179    56/systemd-journald  /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     17394    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     12178    372/bluetoothd       
unix  3      [ ]         STREAM     CONNECTED     17403    902/gnome-shell      
unix  3      [ ]         STREAM     CONNECTED     17014    667/dbus-daemon      @/tmp/dbus-ZVFyq1nvzA
unix  3      [ ]         STREAM     CONNECTED     10129    264/NetworkManager   
unix  3      [ ]         STREAM     CONNECTED     16383    820/VBoxClient       
unix  2      [ ]         DGRAM                    11792    264/NetworkManager   
unix  3      [ ]         STREAM     CONNECTED     16112    667/dbus-daemon      
unix  3      [ ]         STREAM     CONNECTED     18018    934/nm-applet        
unix  3      [ ]         STREAM     CONNECTED     16812    655/gnome-session    @/tmp/.ICE-unix/655


The above listing is from a Fedora 17 system. As you can see, UD sockets are used extensively on modern systems.

File creation time in EXT4

Most Linux administrators are aware of the three standard timestamps associated with a file, i.e. ctime, atime and mtime. What you may not be aware of is that many of the modern filesystems on Linux such as EXT4 and BTRFS also support a file creation timestamp.

Here is what the stat command outputs on RHEL 6.4:

# stat helloworld
  File: `helloworld'
  Size: 6470      	Blocks: 16         IO Block: 4096   regular file
Device: 803h/2051d	Inode: 396942      Links: 1
Access: (0775/-rwxrwxr-x)  Uid: (  500/    fpm)   Gid: (  500/    fpm)
Access: 2014-05-14 06:30:45.107878096 -0700
Modify: 2014-05-14 06:30:36.337878203 -0700
Change: 2014-05-14 06:30:36.337878203 -0700


and here is what stat outputs on RHEL 7:

# stat test
  File: ‘test’
  Size: 13644     	Blocks: 32         IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 71265538    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2014-06-13 19:03:06.695700366 -0400
Modify: 2014-06-13 19:03:03.655583791 -0400
Change: 2014-06-13 19:03:03.655583791 -0400
 Birth: -


Note the empty Birth line. For some crazy reason, there is controversy in the Linux community on whether to label a file creation timestamp as a birth timestamp or a creation timestamp. This argument has been going on since circa 2010 and, as a result, Torvalds basically has punted adding file creation time support in the Linux kernel until at least 2015.

So how can you retrieve the creation date of file on an EXT4 filesystem? Well, you can write your own utility to do it or you can use debugfs as shown in the following example:

# debugfs
debugfs 1.41.12 (17-May-2010)
debugfs:  open /dev/sda3
debugfs:  cd home/fpm
debugfs:  stat helloworld
Inode: 396942   Type: regular    Mode:  0775   Flags: 0x80000
Generation: 1850782189    Version: 0x00000000:00000001
User:   500   Group:   500   Size: 6470
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 16
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x53736ffc:508e72ec -- Wed May 14 06:30:36 2014
 atime: 0x53737005:19b85b40 -- Wed May 14 06:30:45 2014
 mtime: 0x53736ffc:508e72ec -- Wed May 14 06:30:36 2014
crtime: 0x53736ffc:38b6eee4 -- Wed May 14 06:30:36 2014
Size of extra inode fields: 28
Extended attributes stored in inode body: 
  selinux = "unconfined_u:object_r:user_home_t:s0\000" (37)
EXTENTS:
(0-1): 1620740-1620741


Here, the file creation time is labeled crtime which is at least a saner label than the stat Birth label.

Enable VMware Workstation tools in RHEL7

If you install the minimum version of Red Hat Enterprise 7 as a VMware Workstation guest, you will have to overcome a number of obstacles to installing the VMware Tools.

Firstly, no ifconfig utility is installed. To install this utility, install the net-tools package.

# yum install net-tools


Next, check to see if the open-vm-tools package was installed. If not install it from your DVD or ISO. You may have to first create a repo entry similar to the following:

[dvd]
name=red Hat Enterprise Linix [DVD]
baseurl=file:///run/media/<FIXTHIS>/RHEL-7.0\ Server.x86_64
enabled=1
gpgcheck=0


and then run:

# yum install open-vm-tools


I found that I also had to install the vmhgfs driver in the guest virtual machine to support drag and drop.

To do this, I created another repo entry:

[vmware-tools]
name = VMware Tools
baseurl = http://packages.vmware.com/packages/rhel7/x86_64/
enabled = 1
gpgcheck = 0


and ran:

# yum install open-vm-tools-deploypkg


After logging off and logging back in again to the guest, guest resizing was working and also copy-paste and drag and drop.