LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-27-2018, 07:19 PM   #1
hwang1298
LQ Newbie
 
Registered: Mar 2018
Posts: 16

Rep: Reputation: Disabled
How to modify CGroup in the kernel configuration and then make a new image?


Hello,

Can I get a step by step example of how to modify CGroup default configurations and then make a new kernel image from the kernel source codes?

Regards,

Heng
 
Old 03-29-2018, 05:09 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,152

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
There are innumerable guides on how to set kernel config options and compile the kernel.
Likely will depend on your distro.

I would be very surprised if you need to for cgroups, but the question is so poorly framed, it is almost impossible to answer.
 
1 members found this post helpful.
Old 03-29-2018, 12:57 PM   #3
hwang1298
LQ Newbie
 
Registered: Mar 2018
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
There are innumerable guides on how to set kernel config options and compile the kernel.
Likely will depend on your distro.

I would be very surprised if you need to for cgroups, but the question is so poorly framed, it is almost impossible to answer.
Thanks for the quick response. This is my first time to explore the Linux kernel source codes as a linux application developer due to my current application software development project's special needs.
I needed to install a third party's software which requires all the CGroups are enabled by defaults in the kernel side so that their application can function correctly. Unfortunately, my system came with all the CGroups disabled by default and all the info directed me to modify kernel configurations and reinstall it again. Luckily, my hardware vendor share the kernel source codes to me but provided no additional helps in this regard which just like you said it depends on our special needs.
In any case, I accidentally resolved my question as below. Let me know if you have any further suggestions.

Step 1: Run the following command which is instructed in the README file of kernel source codes folder.

make O=/home/name/build/kernel menuconfig

Step 2: Wait for "Linux Kernel Configuration Menu" displayed.

Step 3: Select and enter the "General Setup" sub-menu.

Step 4: Select and mark all options in the "Control Group Support"

Step 5: Save and Exit

Step 6: Run the following command to recompile the kernel source codes.

make O=/home/name/build/kernel

Regards,

Heng
 
Old 03-29-2018, 02:02 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Depending on the distro, that might work. Which distro are you using?
 
Old 03-29-2018, 02:49 PM   #5
hwang1298
LQ Newbie
 
Registered: Mar 2018
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
Depending on the distro, that might work. Which distro are you using?
My linux distro is Ubuntu 16.04 and kernel 3.10.
By the way, I also required to upgrade the kernel to version 4.4 or greater. Any suggestions?

Regards,

Heng
 
Old 03-29-2018, 06:26 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,152

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Looks like this should do the job, and be supported as well. Might even have the cgroups options selected as well if you are lucky.
I don't use Ubuntu, but just checked a Linux Mint desktop system, and all the cgroup options were enabled except 2 debug options. I am very surprised Ubuntu doesn't have them.
 
Old 03-29-2018, 06:34 PM   #7
hwang1298
LQ Newbie
 
Registered: Mar 2018
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
Looks like this should do the job, and be supported as well. Might even have the cgroups options selected as well if you are lucky.
I don't use Ubuntu, but just checked a Linux Mint desktop system, and all the cgroup options were enabled except 2 debug options. I am very surprised Ubuntu doesn't have them.
Thanks for the info. I will try it as soon as possible and report back my results.

Regards,

Heng
 
Old 03-29-2018, 09:23 PM   #8
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
If you're using Ubuntu, then you probably want to build the kernel the Debian way. Did you check /boot/config-version to see if cgroups are selected? Mine looks like this
Code:
/boot/config-4.9.0-6-amd64:CONFIG_CGROUPS=y
/boot/config-4.9.0-6-amd64:CONFIG_BLK_CGROUP=y
/boot/config-4.9.0-6-amd64:# CONFIG_DEBUG_BLK_CGROUP is not set
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_WRITEBACK=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_SCHED=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_PIDS=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_FREEZER=y
/boot/config-4.9.0-6-amd64:# CONFIG_CGROUP_HUGETLB is not set
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_DEVICE=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_CPUACCT=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_PERF=y
/boot/config-4.9.0-6-amd64:# CONFIG_CGROUP_DEBUG is not set
/boot/config-4.9.0-6-amd64:CONFIG_NETFILTER_XT_MATCH_CGROUP=m
/boot/config-4.9.0-6-amd64:CONFIG_NET_CLS_CGROUP=m
/boot/config-4.9.0-6-amd64:CONFIG_SOCK_CGROUP_DATA=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_NET_PRIO=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_NET_CLASSID=y

Last edited by AwesomeMachine; 03-29-2018 at 09:26 PM.
 
Old 03-30-2018, 02:28 AM   #9
hwang1298
LQ Newbie
 
Registered: Mar 2018
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
If you're using Ubuntu, then you probably want to build the kernel the Debian way. Did you check /boot/config-version to see if cgroups are selected? Mine looks like this
Code:
/boot/config-4.9.0-6-amd64:CONFIG_CGROUPS=y
/boot/config-4.9.0-6-amd64:CONFIG_BLK_CGROUP=y
/boot/config-4.9.0-6-amd64:# CONFIG_DEBUG_BLK_CGROUP is not set
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_WRITEBACK=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_SCHED=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_PIDS=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_FREEZER=y
/boot/config-4.9.0-6-amd64:# CONFIG_CGROUP_HUGETLB is not set
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_DEVICE=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_CPUACCT=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_PERF=y
/boot/config-4.9.0-6-amd64:# CONFIG_CGROUP_DEBUG is not set
/boot/config-4.9.0-6-amd64:CONFIG_NETFILTER_XT_MATCH_CGROUP=m
/boot/config-4.9.0-6-amd64:CONFIG_NET_CLS_CGROUP=m
/boot/config-4.9.0-6-amd64:CONFIG_SOCK_CGROUP_DATA=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_NET_PRIO=y
/boot/config-4.9.0-6-amd64:CONFIG_CGROUP_NET_CLASSID=y
My /boot folder has no files in there at all. Is that normal?

Regards,

Heng
 
Old 03-30-2018, 05:06 PM   #10
hwang1298
LQ Newbie
 
Registered: Mar 2018
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hwang1298 View Post
My /boot folder has no files in there at all. Is that normal?

Regards,

Heng
Finally successfully recompiled kernel source codes and get some new configuration files created and copied to the /boot folder which includes the following info.
Next step is to reboot the system?

CONFIG_CGROUPS=y
CONFIG_PAGE_COUNTER=y
CONFIG_MEMCG=y
CONFIG_MEMCG_SWAP=y
CONFIG_MEMCG_SWAP_ENABLED=y
CONFIG_BLK_CGROUP=y
CONFIG_DEBUG_BLK_CGROUP=y
CONFIG_CGROUP_WRITEBACK=y
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
# CONFIG_CFS_BANDWIDTH is not set
# CONFIG_RT_GROUP_SCHED is not set
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
 
Old 03-30-2018, 08:53 PM   #11
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
That's interesting there was nothing in /boot before you installed the new kernel.
 
Old 03-30-2018, 10:59 PM   #12
hwang1298
LQ Newbie
 
Registered: Mar 2018
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
That's interesting there was nothing in /boot before you installed the new kernel.
I have just learned how to configure and recompile a given kernel source code in Ubuntu. Now, the real problem is to figure out how to boot up this special system with a new given kernel image? To my knowledge, each embedded linux system may have its own customized bootloader and kernel image. Any suggestion on how to tackle these issues next? Again, I am only a newbie of linux application developer.

Regards,

Heng
 
Old 03-31-2018, 01:43 AM   #13
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
if you did it according to the kernel README, you must generate an initramfs image
Code:
$ update-initramfs -c -k kernel-version
Then it should boot. Unless you haven't made and installed the modules yet, in which case you'll need to do
Code:
$ make modules prepare && make modules install
But if you did it the Debian way, you only have to install the resulting package files and reboot.

Last edited by AwesomeMachine; 03-31-2018 at 01:44 AM.
 
Old 03-31-2018, 02:39 AM   #14
hwang1298
LQ Newbie
 
Registered: Mar 2018
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
if you did it according to the kernel README, you must generate an initramfs image
Code:
$ update-initramfs -c -k kernel-version
Then it should boot. Unless you haven't made and installed the modules yet, in which case you'll need to do
Code:
$ make modules prepare && make modules install
But if you did it the Debian way, you only have to install the resulting package files and reboot.
The module was disabled. However, after module is enabled but getting the following kernel compilation error messages.


CALL /home/ubuntu/Kernel/src4/scripts/checksyscalls.sh
CHK scripts/mod/devicetable-offsets.h
HOSTCC scripts/sign-file
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
scripts/Makefile.host:90: recipe for target 'scripts/sign-file' failed
make[2]: *** [scripts/sign-file] Error 1
/home/ubuntu/Kernel/src4/Makefile:557: recipe for target 'scripts' failed
make[1]: *** [scripts] Error 2
make[1]: Leaving directory '/home/ubuntu/src4/kernel'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
ubuntu@localhost:~/Kernel/src4$
 
Old 03-31-2018, 03:07 AM   #15
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Try building the kernel the Debian way, since Ubuntu is a Debian distro. All you have to do is configure the kernel and run from thye sources directory
Code:
$ make deb-pkg
But you must use the kernel-source package from the Ubuntu repos.
 
  


Reply



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
[SOLVED] Cgroup - cgrulesengd - Slackware 13.37 Kernel linuxxer Slackware 0 09-10-2012 08:20 AM
[SOLVED] Cannot move certain kernel threads from root cgroup avinash82 Linux - Kernel 1 07-24-2012 04:29 PM
Alternative to 200 lines kernel patch, /sys/fs/cgroup/cpu missing Linux.tar.gz Slackware 27 11-29-2010 09:40 AM
How to Make Modify the Entries in Access Control Database for Linux Kernel 2.4.18-14? kks_gs Linux - Security 1 02-07-2009 06:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:23 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration