centos cannot coredump with ulimit -c is unlimited - centos

I just installed CentOs 7 on my mac using Parallel Desktop.
Here is the result of ulimit -c:
[root#centos-linux test1]# ulimit -c
unlimited
Here is the content of /etc/security/limits.conf
soft core unlimited
But the is no coredump file created.
What else can I do to enable coredump?

This phenomenon results from false core dump file path.
I thought the coredump file should be created in current dir or /tmp. But it's not.
cat /proc/sys/kernel/core_pattern tells where the coredump files are.
In my system:
[root#centos-linux Linux]# cat /proc/sys/kernel/core_pattern 
/mydata/corefile/core-%e-%s-%u-%g-%p-%t
However, there is no /mydata/corefile in my system.
So I can created a new dir /mydata/corefile or using
sysctl -w kernel.core_pattern=/tmp/core-%e-%s-%u-%g-%p-%t
to get coredump file in /tmp.

Related

permission to write files in Windows Server

I am using redhat OS in virtual box. I have mounted my Server's (windows 2012 R2) hard disk
on my redhat(/home/user1/myfolder) using
sudo mount -t cifs //192.168.100.1/myfolder/ /home/user1/myfolder -o username=MyRegisteredUserNameForServer
Problem:
I can read write and executes the file stored in that server.
Also, using 'sudo nano myfile.txt' I can create a file in the mounted folder "/home/user1/myfolder" but when I try to execute any script that creates files, it says permission denied.
eg: python myscript.py > output.txt
"permission denied"
I tried a lot to get into it but couldn't find the issue.
finally the below worked:
sudo mount -t cifs -o user=MyRegisteredUserNameForServer,password=P#ssw0rd,dir_mode=0777,file_mode=0777 //192.168.100.1/myfolder /home/user1/myfolder

How to generate coredump file in alpine container

I'm trying to work on a open source TSDB TDengine, and compile it in alpine to make it dockerized. After compiled, just run the taosd binary, it causes segment fault(coredumped), but I can't find the core file.
I've searched and use sysctl to set the core pattern and ulimic -c is unlimited. But it failed to apply sysctl like below.
# ulimic -c
unlimited
# sysctl -w kernel.core_pattern=core-%e.%p.%h.%t
sysctl: error setting key 'kernel.core_pattern': Read-only file system
How to generate the core file in alpine?
I finally found the solution:
docker run -it --rm --ulimit core=-1 --privileged -v $PWD:/coredump <myimage> bash
In container, set core pattern and run app:
sysctl -w kernel.core_pattern=/coredump/core-%e.%p.%h.%t
app # coredumped to /coredump/ directory
Since we mount $PWD to /coredump, so we can see core file in current directory.

postGIS in Linux: dbf file can not be opened

Downloaded file is unzipped. I moved it up the folder tree. I have the very latest version of LibreOffice in my Ubuntu. But I can't migrate the data therein to my postgis database. Have been working on this for some time any pointers appreciated. Linux output is below.
shp2pgsql -c -D -I tl_2019_us_cd116.shp gis.congress | psql -U sporter tutorial
Unable to open tl_2019_us_cd116.shp or tl_2019_us_cd116.SHP
tl_2019_us_cd116: dbf file (.dbf) can not be opened.
Per recommendations below I've been working on permissions but am stuck again. I'm logged in as root user on the path that has access to the file and as seen below it states ownership is being changed. But ls -l shows the original owner
root#DESKTOP-VDI7BFT:/mnt/c/Users/sport# chown -v sporter tl_2019_us_cd116
changed ownership of 'tl_2019_us_cd116' from sporter399 to sporter
But I don't think the ownership really changes:
ls -l tl_2019_us_cd116
-rwxrwxrwx 1 sporter399 sporter399 (7 times over for each file within the folder, all showing sporter399 which is what I'm trying to change)

Accidently renamed libc.so.6 and cannot chroot within rescue mode

We have accidently renamed shared library /lib64/libc.so.6 to be /lib64/libc.so_6. Right after previous command the system (CentOS 6.9) throws the following error :
error while loading shared libraries: /lib64/libc.so.6: cannot open shared object file: No such file or directory
When logged in within rescue mode I followed the following commands :
mount /dev/md2 /mnt
mount /dev/md1 /mnt/boot
mount -t dev -o bind /dev /mnt/dev
mount -t proc -o bind /proc /mnt/proc
mount -t sys -o bind /sys /mnt/sys
chroot /mnt
</Code>
Then i get the following error :
/bin/bash: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
I also tried the following commands :
chroot /mnt /bin/bash
chroot /mnt/root/tmp /bin/bash
chroot /mnt/root/tmp /mnt/bin/bash
Then get another error
chroot: failed to run command ‘/mnt/bin/bash’: No such file or directory
Now the system is down and I only have ssh which failed once "libc.so.6" renamed, and rescue mode. How could I enter to system so that i can rename "libc.so_6" back to "libc.so.6"? Is there a work-around to bypass checking for "libc.so_6"?
For the sake of clarity, will post the answer here (in case someone else encounter similar trouble).
When in rescue mode:
mount /dev/md2 /mnt
mv /mnt/lib64/libc.so_6 /mnt/lib64/libc.so.6
Alternatively:
restore system from backup
try booting from some live USB (as Topper Harley proposed in comments)

How do I get a core dump on OS X Lion?

I am working on a PostgreSQL extension in C that segfaults, so I want to look at the core dump file on my OS X Lion box. However, there are no core files in /cores or anywhere else that I can find. It appears that they are enabled in the system but are limited to a size of 0:
> sysctl kern.coredump
kern.coredump: 1
> ulimit -c
0
I tried setting ulimit -c unlimited in the shell session I'm using to start and stop PostgreSQL, and it seems to stick:
> ulimit -c
unlimited
And yet no matter what I do, no core files. I am starting PostgreSQL with pg_ctl -c, where the -c tells PostgreSQL to generate core dumps. But the system has nothing. How can I get Lion to dump core files?
The /cores/ directory is not necessarily there in Lion , and if it's not there, you won't get cores. You should be able to set the ulimit (as you have), run a program like cat(1), quit with a SIGQUIT (control-backslash) and get a coredump:
lion:~ user$ ulimit -c unlimited
lion:~ user$ cat
^\
^\
Quit: 3 (core dumped)
lion:~ user$ ls -l /cores/
total 716584
-r-------- 1 user user 366891008 Jun 21 23:35 core.1263
lion:~ user$
Technical Note TN2124 http://developer.apple.com/library/mac/#technotes/tn2124/ as suggested by Yuji in https://stackoverflow.com/a/3783403/225077 is helpful.