LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 12-04-2013, 05:38 AM   #1
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,494

Rep: Reputation: 437Reputation: 437Reputation: 437Reputation: 437Reputation: 437
Slackware64 14.1 control groups filesystem mount problem


In /etc/rc.d/rc.S, there's some code that attempts to autodetect and mount the control groups filesystem interface...

Code:
# Mount Control Groups filesystem interface:
if grep -wq cgroup /proc/filesystems ; then
  if [ -d /sys/fs/cgroup ]; then
    # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
    # Check if we have some tools to autodetect the available cgroup controllers
    if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then
      # Mount a tmpfs as the cgroup filesystem root
      mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup
      # Autodetect available controllers and mount them in subfolders
      controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | tr ',' ' ' | sed s/.$//)"
      for i in $controllers; do
        mkdir /sys/fs/cgroup/$i
        mount -t cgroup -o $i $i /sys/fs/cgroup/$i
      done
      unset i controllers
    else
      # We can't use autodetection so fall back mounting them all together
      mount -t cgroup cgroup /sys/fs/cgroup
    fi
  else
    mkdir -p /dev/cgroup
    mount -t cgroup cgroup /dev/cgroup
  fi
fi
The autodetection works just fine, as long as you don't have /usr on a separate partition. Sadly, I do have /usr in its own logical volume, so I get the fallback. The fallback, however, doesn't work for the current version of libvirt.

The following version of the above code appears to work with no issues on my setup and allows libvirt to function (changes in bold):
Code:
# Mount Control Groups filesystem interface:
if grep -wq cgroup /proc/filesystems ; then
  if [ -d /sys/fs/cgroup ]; then
    # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
    # Check if we have some tools to autodetect the available cgroup controllers
    if [ -x /bin/cut -a -x /bin/tail ]; then
      # Mount a tmpfs as the cgroup filesystem root
      mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup
      # Autodetect available controllers and mount them in subfolders
      controllers="$(cat /proc/cgroups | cut -f 1 | tail -n +2)"
      for i in $controllers; do
        mkdir /sys/fs/cgroup/$i
        mount -t cgroup -o $i $i /sys/fs/cgroup/$i
      done
      unset i controllers
    else
      # We can't use autodetection so fall back mounting them all together
      mount -t cgroup cgroup /sys/fs/cgroup
    fi
  else
    mkdir -p /dev/cgroup
    mount -t cgroup cgroup /dev/cgroup
  fi
fi
I assume this is so early in the boot process so that LVM and/or fuse could be controlled by a control group. I don't know the ramifications to moving the original block of code quoted above to after the filesystems are mounted.
 
Old 12-04-2013, 05:48 AM   #2
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,447

Rep: Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875
I proposed that block to Pat as I'm a libvirt user too: from a rapid test yours seems to work fine as well
 
Old 12-04-2013, 09:56 AM   #3
GazL
Senior Member
 
Registered: May 2008
Posts: 3,392

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
From what I understand of the topic I believe the cgroup filesystems are there as a control interface. I doubt anything in lvm or fuse would need to use them, so I wouldn't expect problems from moving that section to a little later in rc.S.


Oh, and UUOC! Shame on you!

controllers="$(cut -f 1 /proc/cgroups | tail -n +2)"
 
Old 12-04-2013, 01:02 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,494

Original Poster
Rep: Reputation: 437Reputation: 437Reputation: 437Reputation: 437Reputation: 437
Quote:
Originally Posted by GazL View Post
Oh, and UUOC! Shame on you!

controllers="$(cut -f 1 /proc/cgroups | tail -n +2)"
Oops

BTW, the "original" version that I have above is actually modified from stock, which is
Code:
controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"
Unfortunately, lssubsys -a provides the subsystem list in a comma delimited form...
Code:
root@testbed:~# lssubsys -a 
cpuset,cpu,cpuacct,devices,freezer,net_cls,blkio,perf_event
root@testbed:~#lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//
cpuset,cpu,cpuacct,devices,freezer,net_cls,blkio,perf_event
..which won't work in the for loop anyways. So there's actually a bug in the original, unless the init scripts change IFS to include ",".
 
1 members found this post helpful.
Old 02-20-2014, 10:39 PM   #5
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,494

Original Poster
Rep: Reputation: 437Reputation: 437Reputation: 437Reputation: 437Reputation: 437
Integrating GazL's spanking to my change with the stuff that's changed from the stock /etc/rc.d/rc.S code in bold...
Code:
# Mount Control Groups filesystem interface:
if grep -wq cgroup /proc/filesystems ; then
  if [ -d /sys/fs/cgroup ]; then
    # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
    # Check if we have some tools to autodetect the available cgroup controllers
    if [ -x /bin/cut -a -x /bin/tail ]; then
      # Mount a tmpfs as the cgroup filesystem root
      mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup
      # Autodetect available controllers and mount them in subfolders
      controllers="$(cut -f 1 /proc/cgroups | tail -n +2)"
      for i in $controllers; do
        mkdir /sys/fs/cgroup/$i
        mount -t cgroup -o $i $i /sys/fs/cgroup/$i
      done
      unset i controllers
    else
      # We can't use autodetection so fall back mounting them all together
      mount -t cgroup cgroup /sys/fs/cgroup
    fi
  else
    mkdir -p /dev/cgroup
    mount -t cgroup cgroup /dev/cgroup
  fi
fi
...to make it easier to align your systems (if needed) to the above code.
 
Old 02-20-2014, 10:56 PM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,494

Original Poster
Rep: Reputation: 437Reputation: 437Reputation: 437Reputation: 437Reputation: 437
Quote:
Originally Posted by Richard Cranium View Post
Unfortunately, lssubsys -a provides the subsystem list in a comma delimited form...
Code:
root@testbed:~# lssubsys -a 
cpuset,cpu,cpuacct,devices,freezer,net_cls,blkio,perf_event
root@testbed:~#lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//
cpuset,cpu,cpuacct,devices,freezer,net_cls,blkio,perf_event
..which won't work in the for loop anyways. So there's actually a bug in the original, unless the init scripts change IFS to include ",".
Interestingly, my upgraded-from-14.0-to-14.1 system does not have a problem with the lssubsys -a providing output in comma delimited form (the command provides it in space delimited form) but both of my installed-brand-spanking-new-14.1-install systems do (the output is comma delimited on those systems)!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: SSHFS(Secure SHell FileSystem): Securely Mount remote filesystem over ssh LXer Syndicated Linux News 0 11-13-2013 07:30 PM
ext2 filesystem mount problem beandigital Linux - Newbie 22 02-19-2013 05:00 AM
Filesystem/mount problem?? .... df and ls -l (ll) from / cause ssh session hang. scarpozzi Linux - Server 2 02-09-2011 08:46 AM
Problem trying to control JBoss AS on Slackware64-13.0 gtludwig Slackware 0 06-21-2010 03:36 PM
Weird Filesystem/mount problem hottdogg Slackware 7 03-15-2008 06:40 AM


All times are GMT -5. The time now is 12:49 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration