Language Selection

English French German Italian Portuguese Spanish

Linuxinsight

Syndicate content
LinuxInsight - aggregated feeds
Updated: 1 hour 6 min ago

Reddit: Linux History and Terminology

Tuesday 14th of April 2015 03:03:57 PM

TuxMachines: Linux Kernel 3.19.4 Brings ARM64, PowerPC, Sound, and WiFi Improvements

Tuesday 14th of April 2015 09:57:26 AM

After yesterday's announcement for Linux kernel 4.0, Greg Kroah-Hartman has announced today, April 13, the immediate availability for download of the fourth maintenance release of Linux 3.19 kernel, along with new point releases for the LTS (Long Term Support) Linux kernels 3.14 and 3.10.

4.0 coverage:

read more

Phoronix: Linux 4.1 To Bring Support For NCQ Autosense

Tuesday 14th of April 2015 09:42:11 AM
While usually not presenting any major features each release cycle, the libata feature pull request for Linux 4.1 is a bit more interesting this time around...

Reddit: Funny Linux Commands

Tuesday 14th of April 2015 09:34:20 AM

LXer: IoT-oriented Cortex-A5 based COM adds an MCU

Monday 13th of April 2015 01:57:19 PM
OpenEmbed announced a “SOM5360″ module that runs Linux or Android on a Cortex-A5 Atmel SAM5D34 SoC. The COM adds a Cortex-M3 chip plus CAN and LCD I/O. Shenzhen OpenEmbed M&C Ltd (OpenEmbed) recently launched an IoT-focused computer-on-module built around the Cortex-A5 based Atmel SAMA5D34 system-on-chip. The single-core, 536MHz SoC found on the SOM5360 COM is […]

Reddit: Install SexiLog VMware Logs Analysis

Monday 13th of April 2015 01:49:59 PM

Phoronix: Linux 4.1 Will Improve AMD Bulldozer's ASLR Entropy Issue

Monday 13th of April 2015 01:47:32 PM
The Linux 4.1 kernel will improve AMD's ASLR workaround for Bulldozer processors in order to increase randomization...

Phoronix: GNU Linux-libre 4.0 Kernel Updates Nouveau Deblobbing

Monday 13th of April 2015 01:30:02 PM
Just hours after Linus Torvalds released the Linux 4.0 kernel, the GNU Linux-Libre 4.0 kernel was released by the Free Software Foundation of Latin America...

Phoronix: An Extensive Look At The Changes Of GCC 5

Monday 13th of April 2015 01:06:36 PM
GCC developer Honza Hubička has written a lengthy blog post about the features coming up for GCC 5, what will be initially released as GCC 5.1 in the next two weeks...

LXer: US Patent Office Gamed The System To Make Sure Patent 9 Million Wasn't A Crazy Troll Patent

Monday 13th of April 2015 01:00:08 PM
As I'm sure you were carefully anticipating, on Tuesday, April 7th, the US Patent and Trademark Office issued patent 9,000,000. As you of course are already aware, over the past few decades, the USPTO has been rapidly ramping up the number of patents it approves. That's why, even though patents only have a lifetime of 20 years from the date of application, 1/3 of all issued patents are still in force today. Think about that.

LXer: How to manage processes with cgroup on Systemd

Sunday 12th of April 2015 09:45:12 PM
systemd is a suite of system management daemons, libraries, and utilities designed as a central management and configuration platform for the GNU/Linux computer operating system. It provides a system and service manager that runs as PID 1 and starts the rest of the system as alternative to the traditional sysVinit.

TuxMachines: Arch-Based Antergos Sees Updated Install Media With GNOME 3.16

Sunday 12th of April 2015 09:11:22 PM

The crew behind the Arch Linux derived Antergos operating system have updated their official installation media.

The big changes with this updated install media is using the new Cnchi v0.8.0 installer and defaulting to GNOME 3.16 for the desktop experience.

For those not looking for a full-blown desktop experience powered by GNOME 3.16, the Antergos Minimal Install Image has been updated and is out at under 500MB.

read more

Linuxaria: How to manage processes with cgroup on Systemd

Sunday 12th of April 2015 09:05:27 PM

systemd is a suite of system management daemons, libraries, and utilities designed as a central management and configuration platform for the GNU/Linux computer operating system.
It provides a system and service manager that runs as PID 1 and starts the rest of the system as alternative to the traditional sysVinit.
systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons,

It’s becoming the standard of all the major GNU/Linux distributions and at the moment it’s the default for Arch Linux, Red Hat Enterprise/Centos (version 7), Fedora, Mageia and Suse Enterprise, it’s planned to be used on Debian 8 and Ubuntu 15.04.

There is a lot of people talking for and against systemd on the net as some see it as too intrusive, complex and against the Unix philosophy to keep things simple and make them do just one task.

Using Red Hat 7 at work and Arch Linux on my laptop I’ve started to use it and I must agree that it’s not so simple in the start, but let’s try to take the good thing from it and in this article I’d like to show you some commands that you can use with systemd to manage the processes on a GNU/Linux system and that I’ve found really useful.


Processes and cgroups

systemd organizes processes with cgroups, this is a Linux kernel feature to limit, police and account the resource usage of certain processes (actually process groups). Compared to other approaches like the ‘nice’ command or /etc/security/limits.conf, cgroups are more flexible.

Control groups can be used in multiple ways:

  • create and manage them on the fly using tools like cgcreate, cgexec, cgclassify etc
  • the “rules engine daemon”, to automatically move certain users/groups/commands to groups (/etc/cgrules.conf and /usr/lib/systemd/system/cgconfig.service)
  • through other software such as Linux Containers (LXC) virtualization

So Control Groups are two things: (A) a way to hierarchally group and label processes, and (B) a way to then apply resource limits to these groups. systemd only requires the former (A), and not the latter (B).

You can see the sue of cgroups with the ps command, which has been updated to show cgroups. Run this command to see which service owns which processes:

$ ps xawf -eo pid,user,cgroup,args PID USER CGROUP COMMAND 2 root - [kthreadd] 3 root - \_ [ksoftirqd/0] [...] 4281 root - \_ [flush-8:0] 1 root name=systemd:/systemd-1 /sbin/init 455 root name=systemd:/systemd-1/sysinit.service /sbin/udevd -d 28188 root name=systemd:/systemd-1/sysinit.service \_ /sbin/udevd -d 28191 root name=systemd:/systemd-1/sysinit.service \_ /sbin/udevd -d 1096 dbus name=systemd:/systemd-1/dbus.service /bin/dbus-daemon --system --address=systemd: --nofork --systemd-activation 1131 root name=systemd:/systemd-1/auditd.service auditd 1133 root name=systemd:/systemd-1/auditd.service \_ /sbin/audispd 1135 root name=systemd:/systemd-1/auditd.service \_ /usr/sbin/sedispatch 1171 root name=systemd:/systemd-1/NetworkManager.service /usr/sbin/NetworkManager --no-daemon 4028 root name=systemd:/systemd-1/NetworkManager.service \_ /sbin/dhclient -d -4 -sf /usr/libexec/nm-dhcp-client.action -pf /var/run/dhclient-wlan0.pid -lf /var/lib/dhclient/dhclient-7d32a784-ede9-4cf6-9ee3-60edc0bce5ff-wlan0.lease - 1175 avahi name=systemd:/systemd-1/avahi-daemon.service avahi-daemon: running [epsilon.local] 1194 avahi name=systemd:/systemd-1/avahi-daemon.service \_ avahi-daemon: chroot helper 1193 root name=systemd:/systemd-1/rsyslog.service /sbin/rsyslogd -c 4 1195 root name=systemd:/systemd-1/cups.service cupsd -C /etc/cups/cupsd.conf 1207 root name=systemd:/systemd-1/mdmonitor.service mdadm --monitor --scan -f --pid-file=/var/run/mdadm/mdadm.pid 1210 root name=systemd:/systemd-1/irqbalance.service irqbalance 1216 root name=systemd:/systemd-1/dbus.service /usr/sbin/modem-manager 1219 root name=systemd:/systemd-1/dbus.service /usr/libexec/polkit-1/polkitd 1242 root name=systemd:/systemd-1/dbus.service /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -B -u -f /var/log/wpa_supplicant.log -P /var/run/wpa_supplicant.pid 1249 68 name=systemd:/systemd-1/haldaemon.service hald 1250 root name=systemd:/systemd-1/haldaemon.service \_ hald-runner 1273 root name=systemd:/systemd-1/haldaemon.service \_ hald-addon-input: Listening on /dev/input/event3 /dev/input/event9 /dev/input/event1 /dev/input/event7 /dev/input/event2 /dev/input/event0 /dev/input/event8 1275 root name=systemd:/systemd-1/haldaemon.service \_ /usr/libexec/hald-addon-rfkill-killswitch 1284 root name=systemd:/systemd-1/haldaemon.service \_ /usr/libexec/hald-addon-leds 1285 root name=systemd:/systemd-1/haldaemon.service \_ /usr/libexec/hald-addon-generic-backlight 1287 68 name=systemd:/systemd-1/haldaemon.service \_ /usr/libexec/hald-addon-acpi 1317 root name=systemd:/systemd-1/abrtd.service /usr/sbin/abrtd -d -s 1332 root name=systemd:/systemd-1/getty@.service/tty2 /sbin/mingetty tty2 1339 root name=systemd:/systemd-1/getty@.service/tty3 /sbin/mingetty tty3 1342 root name=systemd:/systemd-1/getty@.service/tty5 /sbin/mingetty tty5 1343 root name=systemd:/systemd-1/getty@.service/tty4 /sbin/mingetty tty4 1344 root name=systemd:/systemd-1/crond.service crond .....

In the third column you see the cgroup systemd assigned to each process. You’ll find that the udev processes are in the name=systemd:/systemd-1/sysinit.service cgroup, which is where systemd places all processes started by the sysinit.service service, which covers early boot.

A different way to present the same information is the systemd-cgls tool that is shipped with systemd. It shows the cgroup hierarchy in a pretty tree. Its output looks like this:

$ systemd-cgls + 2 [kthreadd] [...] + 4281 [flush-8:0] + user | \ lennart | \ 1 | + 1495 pam: gdm-password | + 1521 gnome-session | + 1534 dbus-launch --sh-syntax --exit-with-session | + 1535 /bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session | + 1603 /usr/libexec/gconfd-2 | + 1612 /usr/libexec/gnome-settings-daemon | + 1615 /ushr/libexec/gvfsd | + 1621 metacity | + 1626 /usr/libexec//gvfs-fuse-daemon /home/lennart/.gvfs | + 1634 /usr/bin/pulseaudio --start --log-target=syslog | + 1635 gnome-panel | + 1638 nautilus | + 1640 /usr/libexec/polkit-gnome-authentication-agent-1 | + 1641 /usr/bin/seapplet | + 1644 gnome-volume-control-applet | + 1645 /usr/libexec/bonobo-activation-server --ac-activate --ior-output-fd=24 | + 1646 /usr/sbin/restorecond -u | + 1649 /usr/libexec/pulse/gconf-helper | + 1652 /usr/bin/devilspie | + 1662 nm-applet --sm-disable | + 1664 gnome-power-manager | + 1665 /usr/libexec/gdu-notification-daemon | + 1668 /usr/libexec/im-settings-daemon | + 1670 /usr/libexec/evolution/2.32/evolution-alarm-notify | + 1672 /usr/bin/python /usr/share/system-config-printer/applet.py | + 1674 /usr/lib64/deja-dup/deja-dup-monitor | + 1675 abrt-applet | + 1677 bluetooth-applet | + 1678 gpk-update-icon | + 1701 /usr/libexec/gvfs-gdu-volume-monitor | + 1707 /usr/bin/gnote --panel-applet --oaf-activate-iid=OAFIID:GnoteApplet_Factory --oaf-ior-fd=22 | + 1725 /usr/libexec/clock-applet | + 1727 /usr/libexec/wnck-applet | + 1729 /usr/libexec/notification-area-applet | + 1759 gnome-screensaver | + 1780 /usr/libexec/gvfsd-trash --spawner :1.9 /org/gtk/gvfs/exec_spaw/0 | + 1864 /usr/libexec/gvfs-afc-volume-monitor | + 1874 /usr/libexec/gconf-im-settings-daemon | + 1882 /usr/libexec/gvfs-gphoto2-volume-monitor | + 1903 /usr/libexec/gvfsd-burn --spawner :1.9 /org/gtk/gvfs/exec_spaw/1 | + 1909 gnome-terminal | + 1913 gnome-pty-helper | + 1914 bash | + 1968 ssh-agent | + 1994 gpg-agent --daemon --write-env-file | + 2221 bash | + 2461 bash | + 4193 ssh tango | + 15113 bash | + 18679 /bin/sh /usr/lib64/firefox-3.6/run-mozilla.sh /usr/lib64/firefox-3.6/firefox | + 18741 /usr/lib64/firefox-3.6/firefox | + 27251 empathy | + 27262 /usr/libexec/mission-control-5 | + 27265 /usr/libexec/telepathy-haze | + 27268 /usr/libexec/telepathy-logger | + 27270 /usr/libexec/dconf-service | + 27280 /usr/libexec/notification-daemon | + 27284 /usr/libexec/telepathy-gabble | + 27285 /usr/libexec/telepathy-salut | + 27297 /usr/libexec/geoclue-yahoo | + 28900 /usr/lib64/nspluginwrapper/npviewer.bin --plugin /usr/lib64/mozilla/plugins/libflashplayer.so --connection /org/wrapper/NSPlugins/libflashplayer.so/18741-6 | + 29219 emacs systemd-for-admins-1.txt | + 29231 ssh tango | \ 29519 systemd-cgls \ systemd-1 + 1 /sbin/init + ntpd.service | \ 4112 /usr/sbin/ntpd -n -u ntp:ntp -g + systemd-logger.service | \ 1499 /lib/systemd/systemd-logger + accounts-daemon.service | \ 1496 /usr/libexec/accounts-daemon + rtkit-daemon.service | \ 1473 /usr/libexec/rtkit-daemon + console-kit-daemon.service | \ 1408 /usr/sbin/console-kit-daemon --no-daemon + prefdm.service | + 1376 /usr/sbin/gdm-binary -nodaemon | + 1391 /usr/libexec/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1 --force-active-vt | + 1394 /usr/bin/Xorg :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-f2KUOh/database -nolisten tcp vt1 | + 1419 /usr/bin/dbus-launch --exit-with-session | \ 1511 /usr/bin/gnome-keyring-daemon --daemonize --login + getty@.service | + tty6 | | \ 1346 /sbin/mingetty tty6 | + tty4 | | \ 1343 /sbin/mingetty tty4 | + tty5 | | \ 1342 /sbin/mingetty tty5 | + tty3 | | \ 1339 /sbin/mingetty tty3 | \ tty2 | \ 1332 /sbin/mingetty tty2 + abrtd.service | \ 1317 /usr/sbin/abrtd -d -s + crond.service | \ 1344 crond + sshd.service | \ 1362 /usr/sbin/sshd + sendmail.service | + 4094 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue | \ 4096 sendmail: accepting connections + auditd.service | + 1131 auditd | + 1133 /sbin/audispd | \ 1135 /usr/sbin/sedispatch ....

this command shows the processes by their cgroup and hence service, as systemd labels the cgroups after the services. For example, you can easily see that the auditing service auditd.service spawns three individual processes, auditd, audisp and sedispatch.

When you need to kill a service you can kill the cgroup name, so you don’t have to search all the pid or use commands such as killall or pgrep, as example to kill all the processes of the service auditd you can use the command:

# systemctl kill auditd.service

This will ensure that SIGTERM is delivered to all processes of the auditd service, not just the main process. Of course, you can also send a different signal if you wish.

# systemctl kill -s SIGKILL auditd.service

Sometimes all you need is to send a specific signal to the main process of a service, maybe because you want to trigger a reload via SIGHUP. Instead of going via the PID file, here’s an easier way to do this:

# systemctl kill -s HUP –kill-who=main crond.service

And in my point of view this is great !
No more ps -ef |grep something| awk something |kill the result of the awk

Analyzing Resource usage

To understand the resource usage of all services, the systemd developers created the tool systemd-cgtop, that will enumerate all cgroups of the system, determine their resource usage (CPU, Memory, and IO) and present them in a top-like fashion. Building on the fact that systemd services are managed in cgroups this tool hence can present to you for services what top shows you for processes.

Unfortunately, by default cgtop will only be able to chart CPU usage per-service for you, IO and Memory are only tracked as total for the entire machine. The reason for this is simply that by default there are no per-service cgroups in the blkio and memory controller hierarchies but that’s what is needed to determine the resource usage.

If resource monitoring for these resources is required it is recommended to add blkio and memory to the DefaultControllers= setting in /etc/systemd/system.conf (see systemd.conf(5) for details). Alternatively, it is possible to enable resource accounting individually for services, by making use of the ControlGroup= option in the unit files (See systemd.exec(5) for details).

To emphasize this: unless blkio and memory are enabled for the services in question with either of the options suggested above no resource accounting will be available for system services and the data shown by systemd-cgtop will be incomplete.

Resources

Managing Services on Linux with systemd

From the creator of systemd:


Related posts:

  1. An introduction to systemd for CentOS 7
  2. Linux Distributions: Arch versus Slackware

TuxMachines: Blog posts

Sunday 12th of April 2015 05:45:14 PM

D

UE TO a growing SPAM problem (dozens per day making the front page), we have disabled -- temporarily at least -- the ability of random visitors to create new blog posts after registering for an account. We apologise in advance to any legitimate users this restriction may affect.

TuxMachines: Consider These Before Doing A 3D Model

Sunday 12th of April 2015 05:43:50 PM

TuxMachines: Do It Yourself Heating and Cooling Replacement How-to Handbook

Sunday 12th of April 2015 05:41:43 PM

Use this DIY furnace setup guide to assist you do simply that. These instructions will be for changing a gas heater.

Step-By-Step Furnace Installation Instructions

1. Prepare to set up the unit

read more

Phoronix: Arch-Based Antergos Sees Updated Install Media With GNOME 3.16

Sunday 12th of April 2015 05:40:03 PM
The crew behind the Arch Linux derived Antergos operating system have updated their official installation media...

Reddit: Configuring the Logitech G500 mouse on Linux

Sunday 12th of April 2015 05:12:10 PM

More in Tux Machines

Arch Linux – Kde Plasma 5.3 stable is finally available for installation

Great news for Arch Linux users! From a few minutes, Kde Plasma 5.3 stable packages are officially available on Arch Linux repositories. In fact, after running the pacman -Syu command I finally noticed, listed on my terminal, the new packages of Plasma 5.3.0 with all the relative dependencies. Read more

Linux 4.1-rc2

So the -rc2's have lately been pretty small - looking more like late -rc's than early ones. It *used* to be that I couldn't even post the shortlog, because it was just too big. That's not been the case for the last few releases. I think people tend to take a breather after the merge window, because the -rc3's tend to then be a bit bigger again. But it may just also be that I've just gotten much better at saying "the merge window is over, I'm not taking random stragglers", or that people are just getting better at keeping to the merge window. Whatever the reason, the time of huge -rc2's seems to be happily behind us. Read more

GNOME 3.17.1 released

Hi GNOMErs! The development of the next GNOME release, 3.17, has started, and the first snapshot, 3.17.1, is now available. To compile GNOME 3.17.1, you can use the jhbuild [1] modulesets [2] (which use the exact tarball versions from the official release). [1] http://library.gnome.org/devel/jhbuild/ [2] http://download.gnome.org/teams/releng/3.17.1/ The release notes that describe the changes between 3.16.1 and 3.17.1 are available. Go read them to learn what's new in this release: core - http://download.gnome.org/core/3.17/3.17.1/NEWS apps - http://download.gnome.org/apps/3.17/3.17.1/NEWS The GNOME 3.17.1 release is available here: core sources - http://download.gnome.org/core/3.17/3.17.1 apps sources - http://download.gnome.org/apps/3.17/3.17.1 Read more