getting 'cgroup change of group failed' when trying to add process to cgroup - cgroups

I did the following both on Ubuntu 14 and SUSE Linux Enterprise Server 11 (x86_64) where libcgroup is installed, with root:
cgcreate -t ngam:home -a ngam:home -g cpuset:/nadav2ndCpuSet
cgset -r cpuset.cpus=1 nadav2ndCpuSet
After that, if you cat /sys/fs/cgroup/cpuset/nadav2ndCpuSet/cpuset.cpus,
you will get:
1
which is good! as it is supposed to work.
Then, from user ngam, I ran the following cmd:
cgexec -g cpuset:nadav2ndCpuSet ~/whileLoop
where whileLoop is just a simple program that runs in a loop doing sqrt.
After that, I got the following error msg:
cgroup change of group failed
Why is it happening?
Thanks!

I ran into something similar while playing with cgroups on Ubuntu 16.04 just now.
When using the controller cpuset, cpus and mems are not initiated. Therefor you manually have to do it. Since you already specified cpuset.cpus you only need to set cpuset.mems
simply running
echo 0 > /sys/fs/cgroup/cpuset/nadav2ndCpuSet/cpuset.mems
or
cgset -r cpuset.mems=0 nadav2ndCpuSet
would solve your problem.
for more info on cpuset see http://man7.org/linux/man-pages/man7/cpuset.7.html

What I found is I forgot to make cgconfig start with system reboot, so a simple systemctl start cgconfig resolve the problem, and then do not forget systemctl enable cgconfig to make it start with system reboot.
I know my this answer might not be relevant to the question. I hope when people search the error cgroup change of group failed, this answer could help them.
BTW: systemctl start cgconfig is for centos 7, for centos 6 you may use service cgconfig start / chkconfig cgconfig on

Related

Can systemd version be upgraded to v240 or higher on Centos 7?

Currentl I'm facing an issue where I would like to redirect stdout/stderr to specific log files. I have a created a service file for systemd service where I have added the steps for redirection, which is not working because current version 219 of systemd on the system does not support it and would require v240+ to work. My machine is CentOS 7.7.
Service file:
=============
[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service nss-user-lookup.target
[Service]
User=jams
#Type=forking
WorkingDirectory=/opt/workspace/Dashboard/source-code/dashboard/
ExecStart=/opt/workspace/.env/bin/python kafka_consumer.py
StandardOutput=append:/data/dashboard/access.log
StandardError=append:/data/dashboard/error.log
Restart=always
[Install]
WantedBy=multi-user.target
$ systemctl --version
systemd 219
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN
$ cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
Sorry, I'm not much familiar and have very less knowledge about this. Is it possible to upgrade the version of systemd to v240 or higher on CentOS 7.7 ? If yes, could anyone please point me in the right direction to get the source code and with the steps to build the package ?
Or, any alternatives ?
I see the question is rather old, but if you are still searching for a solution then something like this could work:
ExecStart=/opt/workspace/.env/bin/python kafka_consumer.py >> /data/dashboard/access.log 2>>/data/dashboard/error.log
A similar solution works for me for a similar problem on CentOS 7 with systemd 219.

ERROR: Failed to build PhantomJS! Building Qt Base failed

I have Debian Linux(64-bit) in VirtualBox.
Ram: 8Gb (for Debian 4Gb)
CPU: i5-3470
If any other details are needed please tell me.
I have followed instructions written here, and here you can see the console log.
For some reason I am unable to to build phantomjs and I can't understand why its not working... Have searched a lot, but couldn't find any thread which would be about this error.
--- EDIT ---
When I executed this command:
./configure --with-openssl-includes=/usr/include/openssl-1.0/ --with-openssl-libraries=/usr/lib/openssl-1.0/
Output was this:
--with-openssl-includes=/usr/include/openssl-1.0/: invalid command-line switch
--with-openssl-libraries=/usr/lib/openssl-1.0/: invalid command-line switch
The output of the console has changed but I still get errors: https://pastebin.com/wbgi8syg
Looks like you are on stretch (or later) and that you are already aware of the libssl vs libssl1.0 case.
Therefore, if you don't have libssl-dev installed, this line will get you further:
python build.py --qt-config "-I /usr/include/openssl-1.0/ -L /usr/lib/openssl-1.0/"
If you already have it installed and my suggestion doesn't work, you can uninstall libssl-dev for the time to build phantomjs which will likely avoid having to play further with configuration related variables.

ocsigenserver: You are not allowed to use port 80

When I run make run.byte I get this error ocsigenserver: ocsigen:main: Fatal - You are not allowed to use port 80.. I've tried sudo make run.byte but sudo doesn't know about opam or ocsigenserver. I've tried to play with wwwuser in the Makefile.options, but I can't make it work.
The README generated by the distillery doesn't give much information, and I can't find anything online.
make test.byte works just fine.
Any idea please?
edit:
It looks like it has nothing to do with eliom/ocaml, non root users just can't run anything on ports lower than 1024 on Ubuntu. But I still don't understand why the distillery suggests that I can do it if my wwwuser is me, I don't think there's any way this is ever going to work.
I also don't understand how I am supposed to run sudo make run.byte, opam is installed in my ~ directory, sudo cannot find ocsigenserver.
I could make it work by running everything as root, but anytime I run an opam command as root I get the you shouldn't use opam as root warning. I don't think this is the way I'm supposed to run it. Something's not right.
With previous release of eliom (eliom.5.0.0) - I have not used yet the fresh 6.0.0 release - you have to install first your eliom application :
sudo make install
Then you have to kill the process listening to the 80/tcp port (ex: sudo netstat -tulpn 80 | grep :80 will help identify the process listening to that port - most likely apache2 or lighthttpd).
Then, you run your executable:
sudo PATH=$PATH OCAMLPATH=$OCAMLPATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH
make run.byte
This is what is written in README created with eliom-distillery - but take care to set your env variables before :
OCAMLPATH is the location of ocaml used in your env (in my env :~/.opam/4.02.3/bin).
LD_LIBRARY_PATH : .opam/4.02.3/lib/stublibs (otherwise dllssl_threads_stubs is not found)

Effective UID is not root --> virtualbox --> ubuntu KDE

I updated VB yesterday, and today i get this error:
Effective UID is not root (euid=1000 egid=1000 uid=1000 gid=1000) (rc=-10)Please try reinstalling VirtualBox.
where: SUPR3HardenedMain
what: 2
VERR_PERMISSION_DENIED (-10) - Permission denied.
I can not run it and if i try to run it over sudo virualbox, i get fresh clean VB ( without any installed OS's ),which is really bed because i have 3 different OS on the VB with bunch of data in it.
I run synaptic but it looks like that everything is installed correctly.
Any input is very welcome !
E.
Try to reinstall first.
If failed, check the user's rights of your VBox directory:
1 - root owns the dir
2 - some files have such uid set (-r-s--x--x), they are:
VirtualBox*
VBoxVolInfo*
VBoxSDL*
VBoxNetAdpCtl*
VBoxNetDHCP*
VBoxHeadless*

Remote debugging with root privileges

i've got a trouble. Can't debug my program remotly due to can't call wiringPiSetupGpio(). I'm using netbeans to develop and debug my programs. I'm almost sure I need run debugging as root user but... how can I do that?
Is it possible to force netbeans start something like 'sudo gdb' insead of normal user? Or maybe to force my account in raspberry pi to call 'sudo gdb' when whatever try to call 'gdb'?
To force netbeans start gdb as root, you need to install netbeans as root. make sure your netbeans intall dir is in /usr/local and not in /home/[user_name]. You have to run netbeans installation as sudo
This is an old post but since I was facing the same issue I will post how I resolved this:
The problem for me did not seem to be the gdb, but the gdbserver running on the Raspi (or Beaglebone in my case).
I added a debug configuration to debug the application as root, therefore I added a script to the Beaglebone /usr/local/sbin/gdbserver and added the following lines:
#!/bin/bash
sudo /usr/bin/gdbserver $*
and made it executable:
sudo chmod a+x /usr/local/sbin/gdbserver
and see that in the file /etc/login.defs the lines
ENV_SUPATH PATH= ....
ENV_PATH PATH= ....
contain /usr/local/sbin. then in the debug configuration for the root execution I changed the command gdbserver to /usr/local/sbin/gdbserver. If that still doesn't work you might have to do this too:
sudo visudo
and add
<your_user> ALL=(root) NOPASSWD:/usr/bin/gdbserver
I hope this helps.