(Error in makefile)RTNETLINK answers: File exists - c++

This is my makefile:
delay:
tc qdisc add dev eth0 root netem delay 0ms
test4_s_delay:delay
./a.out 10 10 1 2 3 1 1 20 | tee server_delay.txt
However, I am getting the following error on execution of the makefile:
root#superwii-laptop:/home/superwii/Desktop/Amogh# make test4_s_delay
tc qdisc add dev eth0 root netem delay 0ms
RTNETLINK answers: File exists
make: *** [delay] Error 2
I am unable to get past this error. Please help.

You would get this error, if qdisc root node already exists.
Try deleting the root qdisc
sudo tc qdisc del dev eth0 root
and try again

Looks like your executable tc is exiting with non-zero value of 2.
Try running the command tc qdisc add dev eth0 root netem delay 0ms and see if it runs fine.

use replace instead of add
tc qdisc replace dev eth0 root netem delay. Man page for tc says :
replace
performs a nearly atomic remove/add on an existing node id. If
the node does not exist yet it is created.

Related

launch ./veins_launchd with sumo option "-scale"

I want launch launch ./veins_launchd with sumo option "-scale".
This is my launch command:
$ ./veins_launchd -vv --command='sumo --scale 6'
This command execute correctly.
But as soon as I start running simulation, it pop follow error message:
Seed is 0
Finding free port number...
Claiming lock on port
...found port 38677
Starting SUMO (sumo --scale 6 -c due.actuated.sumocfg) on port 38677, seed 0
Releasing lock on port
Cleaning up
Result: "<?xml version="1.0"?>
<status>
<exit-code>-1</exit-code>
<start>1651068679</start>
<end>1651068679</end>
<status>Could not start SUMO (sumo --scale 6 -c due.actuated.sumocfg): [Errno 2] No such file or directory: 'sumo --scale 6': 'sumo --scale 6'</status>
<stdout><![CDATA[]]></stdout>
<stderr><![CDATA[]]></stderr>
</status>
"
I have read link follow:
How to give sumo options with sumo-launchd.py?
My problem is almost the same with his.
Since that problem is post at 2017 and not have been solved, I decide to repost this problem again.
You can simply add the line
<scale value="6"/>
to your due.actuated.sumocfg.

RHEL not starting anymore on vmware

My computer kept rebooting lately showing me the blue screen while I was working on RHEL 'n vmware.
The last time the computer had reboot when I turned it on again and tried to work on RHEL here's what I have.
Did anyone of you face the same problem already ?
Thanks
In essence, the error is:
dracut-initqueue[217]: Warning: dracut-initqueue timeout - starting timeout scripts
[...]
dracut-initqueue[217]: Warning: Could not boot.
dracut-initqueue[217]: Warning: /dev/disk/by-uuid/5b757528-cc16-4ff0-819d-805c908d9b35 does not exist
Starting Dracut Emergency Shell...
Warning: /dev/disk/by-uuid/5b757528-cc16-4ff0-819d-805c908d9b35 does not exist
Generating "/run/initramfs/rdsosreport.txt"
Entering emergency mode. Exist the shell to continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot
after mounting them and attach it to a bug report.
EDIT: after #Naushad Ahmad's comment:
# chroot /mnt/sysimage/
chroot: failed to run command '/bin/bash' : No such file ordirectory
# cat /etc/fstab
# cat /boot/grub2/grub.cfg
cat: /boot/grud2/grub.cfg: No such file or directory
# ls /boot
initramfs-3.10.0-693.cl7.x86_64.img
# _
[anaconda] 1:main* 2:shell 3:log 4:storage-log 5:program-log Switch tab: Alt+Tab | Help: F1
But the thing is when I start the rescue mode I ve that error message :
You don't have any Linux partitions.

Icecast - Too many open files

I'm running an Icecast 2.4.3 server on a CentOS 7. When I have a lot of listeners, I receive these errors and everything stops working:
[2017-06-21 18:56:37] WARN connection/_accept_connection accept() failed with error 24: Too many open files
It's running on "ices" user:
sudo -u ices /opt/icecast/bin/icecast -c /opt/icecast/etc/icecast.xml -b
Or running as root with "changeowner" option to "ices" user.
I set limits.conf:
ices hard nofile 65536
ices soft nofile 65536
From ulimit:
[root#orfeu inweb]# su ices
[ices#orfeu inweb]$ ulimit -n
65536
But when I check the PID, I get:
tcp 0 0 <IP>:8000 0.0.0.0:* LISTEN 21650/icecast
[root#orfeu inweb]# cat /proc/21650/limits
Limit Soft Limit Hard Limit Units
...
Max open files 1024 4096 files
...
How can I fix this, to enforce 65536 file descriptors? Thank you.
Probably I found a solution. Need to check when the problem happens again.
I realize that limits.conf set the limits per user.
I found out a way to set the limits per process.
/usr/bin/prlimit -n30000 -p `cat /var/run/icecast.pid`
Now I have:
Max open files 30000 30000 files
I don't know if there's a way to always start "icecast" binary with these limits, or always need to run the command against the PID after run.

Incron doesn't do anything

I intstalled on a new vm with centos 7 incron.
I try to make it work but a simple command does nothing.
incrontab -e :
/home/test IN_CLOSE_WRITE touch "$#/$#.new"
nothing special
When i watch the log cron i see this :
May 13 11:40:57 Minions incrond[2785]: (root) CMD (touch "/home/test/test.new")
but nothing is created in the directory
[root#Minions test]# ll
total 0
-rw-r--r--. 1 root root 0 13 mai 11:40 test
Do you have an idea what is wrong ?
I just del quote like this :
/home/test IN_CLOSE_WRITE touch $#/$#.new
This is rather old but... maybe your incrond service isn't running.
# systemctl enable incrond.service
# systemctl start incrond.service

How to read HD serial in Linux without root privileges?

I am building a C/C++ program which needs to read the HD serial. I am aware that if I run these commands:
hdparm -i /dev/sda | grep -i serial
/sbin/udevadm info --query=property --name=sda | grep "ID_SERIAL"
I can get it, the first requires root permissions but the second doesn't.
However, my application cannot access external programs, and it cannot require root privileges, so is there a C/C++ linux library that has a function that returns the HD serial? Or is there any other way that does not require running a program?
By just listing /dev/disk/by-id/ directory, you get IDs of all block devices on your system. The output is not exactly the same as with the commands, but it is close enough.
For this, you do not need root privileges.
On my PC :
$ /sbin/udevadm info --query=property --name=sda | grep "ID_SERIAL"
ID_SERIAL=WDC_WD5000AAKX-60U6AA0_WD-WCC2EHJ93860
ID_SERIAL_SHORT=WD-WCC2EHJ93860
and
$ ll /dev/disk/by-id/ | grep sda
lrwxrwxrwx 1 root root 9 Nov 11 07:47 ata-WDC_WD5000AAKX-60U6AA0_WD-WCC2EHJ93860 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 11 07:47 ata-WDC_WD5000AAKX-60U6AA0_WD-WCC2EHJ93860-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 11 07:47 ata-WDC_WD5000AAKX-60U6AA0_WD-WCC2EHJ93860-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov 11 07:47 ata-WDC_WD5000AAKX-60U6AA0_WD-WCC2EHJ93860-part3 -> ../../sda3
You can use ioctls to access hard drive information, just as hdparm does. The HDIO_GET_IDENTITY ioctl should be sufficient for your needs. It returns a structure which (IIRC) includes the serial number; googling around should help you find the structure definition.