Quantcast
Viewing all 12176 articles
Browse latest View live

Unexpected System failure of CentOS7 due to LVM partition not mounted

I have a problem with my CentOS7 system installed in Intel NUC(Intel® Core™ i7-7567U CPU @ 3.50GHz × 4 ). Last time i was not able to login to the system by any user or root password. Then I tried to rescue the password by reset root password. But it was not successful after many attempts. During rescue mode, I found that the LVM partition 'home' was not activated in SSD (Crucial MX500 1TB: CT1000MX500SSD1) and log file has following error given below.

What is cause of these error including LVM volume not mounted in CentOS7 (kernel 3.10.0-1062.12.1.el7.x86_64) while trying to login after many days? How to manage it so that it will not happen again?

Please help.

Output of lvdisplay is given below:-

      --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                ZhVKZ0-Oqwx-U3Jl-ukke-8cY6-dKQt-QX3W5g
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2020-01-05 20:05:17 +0530
  LV Status              available
  # open                 0
  LV Size                522.31 GiB
  Current LE             133712
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

[root@localhost log]# lsblk 
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 931.5G  0 disk 
├─sda1            8:1    0   200M  0 part /boot/efi
├─sda2            8:2    0     1G  0 part /boot
└─sda3            8:3    0 930.1G  0 part 
  ├─centos-root 253:0    0   400G  0 lvm  /
  ├─centos-swap 253:1    0   7.8G  0 lvm  [SWAP]
  └─centos-home 253:2    0 522.3G  0 lvm  /home

Failed message in log file is given below:-

messages-20200202:Jan 29 15:13:28 localhost journal: g_array_unref: assertion 'array' failed
messages-20200202:Jan 29 15:13:28 localhost journal: g_array_unref: assertion 'array' failed
messages-20200216:Feb 11 11:58:45 localhost journal: g_array_unref: assertion 'array' failed
messages-20200216:Feb 11 11:58:45 localhost journal: g_array_unref: assertion 'array' failed

messages-20200216:Feb 11 12:07:17 localhost journal: g_array_unref: assertion 'array' failed messages-20200216:Feb 11 12:07:17 localhost journal: g_array_unref: assertion 'array' failed

and

[root@localhost log]# grep failed messages| cut -f3- -d ':'|cut -f2- -d''|sort -u

localhost dracut:    microcode_ctl: kernel version "3.10.0-1062.12.1.el7.x86_64" failed early             load check for "intel-06-4f-01", skipping
localhost gdm: GLib: g_hash_table_find: assertion 'version == hash_table->version' failed
localhost gnome-keyring-daemon[2729]: failed to unlock login keyring on startup
localhost gnome-keyring-daemon[5458]: failed to unlock login keyring on startup
localhost journal: disabling plugin because: failed to coldplug amt: ME refused connection
localhost journal: disabling plugin because: failed to coldplug synapticsmst: MST firmware updating not supported by OEM
localhost journal: disabling plugin because: failed to startup dell: Firmware updating not supported
localhost journal: failed to call gs_plugin_refresh on odrs: [*/*/*/source/odrs/*] failed to download https://odrs.gnome.org/1.0/reviews/api/ratings: Connection terminated unexpectedly
localhost journal: failed to call gs_plugin_refresh on shell-extensions: [*/*/*/source/shell-extensions/*] failed to download https://extensions.gnome.org//static/extensions.json: Connection terminated unexpectedly
localhost journal: failed to connect to device: Failed to connect to missing device /org/freedesktop/ColorManager/devices/xrandr_Dell_Inc__DELL_E2418HN_5RFY876Q0JKB_gdm_42
localhost journal: failed to get native mode status: Error reading from file: Input/output error
localhost journal: failed to set screen _ICC_PROFILE: Failed to open file “/var/lib/gdm/.local/share/icc/edid-7699f71e10e1e1f6308292efbe777a00.icc”: Permission denied
localhost journal: g_array_unref: assertion 'array' failed
localhost journal: g_dbus_proxy_call_finish_internal: assertion 'G_IS_DBUS_PROXY (proxy)' failed
localhost journal: g_variant_get_va: assertion 'value != NULL' failed
localhost journal: g_variant_unref: assertion 'value != NULL' failed
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff88073a265118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff8c00ba26b118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff90203a265118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff9082ba265118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff92ec3a262118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff9443ba261118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff95a0fa26c118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff96f1ba265118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff98997a267118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff9b41fa265118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff9db0fa265118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP04.PXSX] (Node ffff9e9fba261118), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff88073a266488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff8c00ba26c488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff90203a266488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff9082ba266488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff92ec3a263488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff9443ba262488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff95a0fa26d488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff96f1ba266488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff98997a268488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff9b41fa266488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff9db0fa266488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: ACPI Error: Method parse/execution failed [\_SB_.PCI0.RP08.PXSX] (Node ffff9e9fba262488), AE_NOT_FOUND (20130517/psparse-536)
localhost kernel: [drm] failed to retrieve link info, disabling eDP
localhost kernel: hid-generic 0003:413C:2113.0001: usb_submit_urb(ctrl) failed: -19
localhost kernel: pci 0000:01:00.0: BAR 13: failed to assign [io  size 0x2000]
localhost kernel: pci 0000:02:01.0: BAR 13: failed to assign [io  size 0x1000]
localhost kernel: pci 0000:02:02.0: BAR 13: failed to assign [io  size 0x1000]
localhost kernel: pci 0000:02:02.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
localhost kernel: pcieport 0000:01:00.0: BAR 13: failed to assign [io  size 0x2000]
localhost kernel: pcieport 0000:02:01.0: BAR 13: failed to assign [io  size 0x1000]
localhost kernel: pcieport 0000:02:02.0: BAR 13: failed to assign [io  size 0x1000]
localhost kernel: pcieport 0000:02:02.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
localhost kernel: thermal thermal_zone1: failed to read out thermal zone 1
localhost kernel: wlp58s0: failed to remove key (1, ff:ff:ff:ff:ff:ff) from hardware (-22)
localhost kernel: xhci_hcd 0000:39:00.0: Host halt failed, -19
localhost kernel: xhci_hcd 0000:39:00.0: Host not accessible, reset failed.
localhost lldpad: config file failed to load,
localhost NetworkManager[1425]: <warn>  [1582646846.5334] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1425]: <warn>  [1582646846.5338] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1429]: <warn>  [1582632750.1176] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1429]: <warn>  [1582632750.1181] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1430]: <warn>  [1582625137.7477] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1430]: <warn>  [1582625137.7477] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1431]: <warn>  [1582647800.3975] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1431]: <warn>  [1582647800.4014] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1432]: <warn>  [1582625829.1927] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1432]: <warn>  [1582625829.1943] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1432]: <warn>  [1582647271.2795] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1432]: <warn>  [1582647271.2798] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1433]: <warn>  [1582625731.2519] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1433]: <warn>  [1582625731.2520] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1434]: <warn>  [1582624667.2971] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1434]: <warn>  [1582624667.2971] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1434]: <warn>  [1582632328.6818] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1434]: <warn>  [1582632328.6819] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[1437]: <warn>  [1582631756.9007] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[1437]: <warn>  [1582631756.9008] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[3190]: <warn>  [1582624727.5623] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[3190]: <warn>  [1582624727.5623] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost NetworkManager[3242]: <warn>  [1582631895.7613] sup-iface: failed to cancel p2p connect: P2P cancel failed
localhost NetworkManager[3242]: <warn>  [1582631895.7616] supplicant: failed to set WFD IEs on wpa_supplicant: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property
localhost org.gnome.Shell.CalendarServer: gnome-shell-calendar-server[3983]: Lost (or failed to acquire) the name org.gnome.Shell.CalendarServer - exiting
localhost org.gnome.Shell.CalendarServer: gnome-shell-calendar-server[5779]: Lost (or failed to acquire) the name org.gnome.Shell.CalendarServer - exiting

How /proc/interrupts gets updated?

I would like to know how /proc/interrupts is getting up to date?

is it have only irq of drivers were probed or it contains the list of all the possible irqs in the system?

What is Rescheduling interrupts (RES)? What causes it? How is it handled in Linux kernel?

What is the difference between "RES: Rescheduling interrupts" and "LOC: Local timer interrupts"? What is responsible to fire the RES interrupt? Is LOC same as the general timer interrupt that is generated by the Timer h/w in the processor?

Also, please give some clarity on what part of the scheduler is invoked during the timer interrupt and the RES interrupt? How it happens in Linux kernel?

Thanks in advance.

Difference between %llx and %p while printing a pointer inside driver code [duplicate]

It seems that casting a void* pointer (allocated by kmalloc) to unsigned long long changes it. Printing them with %p and %llx gives different values. Why is it so? Can anyone explain?

Following is a simple repro for that:

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>

void* kbuff;
int init_module(void)
{

    kbuff = kzalloc(sizeof(char), GFP_KERNEL);
    pr_info("%p %llx\n",kbuff, (unsigned long long)kbuff);
    return 0;
}

void cleanup_module(void)
{
    kfree(kbuff);
}

The dmesg output comes out to be as follows

[67355.673465] 000000003aeb0247 ffff9ef657a58c00

How do Linux processes produce graphical output 60 times per second if the default time slice is 100ms?

There's something I fundamentally don't understand about how multitasking works in Linux (and probably also in general). If I understand correctly, each time a process wants to change its output to the screen, it needs to do some computations and send the data. But if I understand correctly, processes can hog the CPU for up to 100ms before being pre-empted under the default settings of most Linux distributions. This would seem to preclude the possibility of processes being unblocked frequently enough to be able to refresh the screen at 60Hz. In light of this, I guess there's probably a whole host of fundamental misunderstandings I have about how Linux manages its scarce CPU time and/or about how processes send data to I/O devices.

Question. What's going on here?

Get NFS client IP address in a kernel module

I'm working on a kernel module to track the operations performed by NFS clients on my server. I can intercept the file operations using a hacky way (hijacking the vfs layer) but I can't retrieve the IP address of the client.

Is there any information that might be stored in the current task that I can use to obtain the IP address of the NFS client performing an operation?

I know from digging into the source code that nfsd stores a struct nfsd_net in the struct super_block's s_fs_info field, but I can only retrieve it as a struct net pointer. And in nfsd's implementation net_generic method is being used to get the struct nfsd_net pointer (using nfsd_net_id which is the pernet_operations's id).

Can I obtain this id somehow? and if yes, can I use the struct nfsd_net in my kernel module? Is it defined somewhere other than the fs/nfsd/netns.h?

Linux powerpc syscall numbers: what are spu and nospu ABI and are 32 or 64 bit

Looking into linux kernel powerpc syscall numbers in arch/powerpc/kernel/syscalls/syscall.tbl, there are 5 ABI:

The <abi> can be common, spu, nospu, 64, or 32 for this file.

common, 32 and 64 are obvious, but what are spu and nospu. Are these 32 bit or 64 bit?

linux syscall open() bitmask

I want to know which purpose has the following line of code in Linux syscall int open(const char *pathname, int flags):

if (flags & ~(O_RDONLY | O_WRONLY | O_CREAT | O_RDWR | O_TRUNC | O_APPEND))
{
  return -1;
}

What is the relation between the smallest kmalloc() allocation and memory page size?

From this post I realized that:

the smallest allocation that kmalloc can handle is as big as 32 or 64 bytes

and

The actual memory you get back is dependent on the system's architecture

But also memory page size is mentioned there and on other sites. I can't figure out how the page size is related to smallest kmalloc() allocation? The page size is usually 4096 bytes, but the smallest allocation is 32 or 64 bytes (depending on arch).

So what is the relation between the smallest kmalloc() allocation and page size? And why is the smallest allocation is 32 or 64 bytes but not 16 (e.g.)?

Compiling Intel AVX instrinsics for Linux Device Driver with GCC

I am running gcc version 4.8.2 on ubuntu on corei7.

Found about AVX intrinsics from google search, but I am not sure if this set of intrinsics can be used and compiled for Linux device driver.

If it can, anybody here can tell me what is the right settings for makefile and what header files to include in the c source to get this avx compiled with gcc?

Thanks.

How can I get the iptables match "ipv4options" working in yocto sumo?

Abstract: On an embedded system running a custom Linux built with yocto sumo, I want to DROP all packets containing any IPv4 options.

Tried/searched: The iptables match for the options field (iptables -m ipv4options) is apparently part of "xtables-addons" which I can't find as a recipe in yocto. I would be cool with not even using iptables binary but instructing the netfilter/kernel directly to drop those packets but I can't seem to find how to do that.

Any hints or pointers appreciated.

Assign a hexadecimal address directly to a pointer in LKM code but get different result

I wrote the following code:

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/version.h>

void **sys_call_table;

int __init kaslr_init(void)
{
#if KERNEL_VERSION(2, 6, 32) == LINUX_VERSION_CODE  // on CentOS 6
    sys_call_table = (void *) 0xffffffff816004c0;
#elif KERNEL_VERSION(4, 19, 0) == LINUX_VERSION_CODE  // on Arch Linux
    sys_call_table = (void *) 0xffffffff81c001c0;
#elif KERNEL_VERSION(3, 10, 0) == LINUX_VERSION_CODE  // on CentOS 7
    sys_call_table = (void *) 0xffffffff97c03300;
#endif

    pr_err("%p\n", sys_call_table);

#if KERNEL_VERSION(4, 19, 0) != LINUX_VERSION_CODE
    if (sys_call_table[__NR_close] == sys_close)
        pr_err("Bingo!\n");
#endif
    return 0;
}

void __exit kaslr_exit(void)
{
pr_err("Bye\n");
}

module_init(kaslr_init);
module_exit(kaslr_exit);
MODULE_LICENSE("GPL");

And get the results:

// on CentOS 6
ffffffff816004c0
Bingo!

// on CentOS 7
[ 1375.358780] ffffffff97c03300
[ 1375.361958] Bingo!

// on Arch Linux
[ 1185.136873] 00000000bd3b9e65

From the result, I got a user-space address on Arch.

First I thought it maybe the reason of kaslr, so I disabled it by adding nokaslr parameter in /etc/default/grub and rebooted. But it still remained.

Is there any kernel security mechanism which leads to such the result?

Heading

How to mount Rootfs on sama5d27-som1-ek board using NFS

i am trying to mount rootfs on board using NFS

my NFS export file

/home/user/demo/rootfs  192.168.0.200(rw,sync,no_root_squash,no_subtree_check)

my kernel arguments are

bootargs=console=ttyS0,115200 root=/dev/nfs rootfstype=nfs ip=192.168.0.100 rw nfsroot=192.168.0.100:/home/user/demo/rootfs,4.1

when i boot my board it shows following error

IP-Config: Complete:
     device=eth0, hwaddr=54:10:ec:a9:81:79, ipaddr=192.168.0.100, mask=255.255.255.0, gw=255.255.255.255
     host=192.168.0.100, domain=, nis-domain=(none)
     bootserver=255.255.255.255, rootserver=192.168.0.100, rootpath=
ALSA device list:
  No soundcards found.
atmel_usart_serial atmel_usart_serial.0.auto: using dma0chan5 for rx DMA transfers
atmel_usart_serial atmel_usart_serial.0.auto: using dma0chan6 for tx DMA transfers
VFS: Unable to mount root fs via NFS

i dont know whats is wrong but i am not able mount rootfs,anyone have any idea how to fix it.

Parallel computing: how to share computing resources among users?

I am running a simulation on a Linux machine with the following specs.

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                80
On-line CPU(s) list:   0-79
Thread(s) per core:    2
Core(s) per socket:    20
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 85
Model name:            Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping:              4
CPU MHz:               3099.902
CPU max MHz:           3700.0000
CPU min MHz:           1000.0000
BogoMIPS:              4800.00
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              1024K
L3 cache:              28160K

This is the run command line script for my solver.

/path/to/meshfree/installation/folder/meshfree_run.sh    # on 1 (serial) worker
/path/to/meshfree/installation/folder/meshfree_run.sh N  # on N parallel MPI processes

I share the system with another colleague of mine. He uses 10 cores for his solution. What would be the fastest option for me in this case? Using 30 MPI processes?

I am a Mechanical Engineer with very little knowledge on parallel computing. So please excuse me if the question is too stupid.

What can cause a “Resource temporarily unavailable” on sock connect() command

I am debugging a Python flask application. The application runs atop uWSGI configured with 6 threads and 1 process. I am using Flask-Executor to offload some slower tasks. These tasks create a connection with the Flask application, i.e., the same process, and perform some HTTP GET requests. The executor is configured to use 2 threads max. This application runs on Ubuntu 16.04.3 LTS.

Every once in a while the threads in the executor completely stop working. The code uses the Python requests library to do the requests. The underlying error message is:

Action failed. HTTPSConnectionPool(host='somehost.com', port=443): Max retries exceeded with url: /api/get/value (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f8d75bb5860>: Failed to establish a new connection: [Errno 11] Resource temporarily unavailable',))

The code that is running within the executor looks like this:

adapter = requests.adapters.HTTPAdapter(max_retries=3)
session  = requests.Session()
session.mount('http://somehost.com:80', adapter)
session.headers.update({'Content-Type': 'application/json'})
...
session.get(uri, params=params, headers=headers, timeout=3)

I've spent a good amount of time trying to peel back the Python requests stack down to the C sockets that it uses. I've also tried reproducing this error using small C and Python programs. At first I thought it could be that sockets were not getting closed and so we were running out of allowable sockets as a resource, but that gives me a message more along the lines of "too many files are open".

Setting aside the Python stack, what could cause a [Errno 11] Resource temporarily unavailable on a socket connect() command? Also, if you've run into this using requests, are there arguments that I could pass in to prevent this?

I've seen the What can cause a “Resource temporarily unavailable” on sock send() command StackOverflow post, but I'm that's on a send() command and not on the initial connect(), which is what I suspect is where the code is getting hung up.


How Do I Add A Custom Attribute To The Process Table In Linux?

I am tasked with using a syscall to modify a custom attribute assigned to a process. I understand how to define the syscall and functions to call it and all of the necessary places to update for the syscall addition. However, I cannot find any good information on the location or method to add the custom attribute. From what I can tell, the processes will show up in /proc and I can see their attributes from there. I know about the fork() and do_fork() functions, but I'm not sure if this is where those attributes will be defined. Trial and error has gotten me no where, unfortunately.

Note: This is for a school assignment, so I'd appreciate some hints(things to grep, etc.) and am not looking for a direct answer.

Edit: I see /include/linux/sched.h has some definitions that look promising. Perhaps I need to add it in here somewhere...

Why does the system keep running even though it looks like the kernel crashed?

I've got a system in Azure size M64ls running CentOS 7. Sometimes in the terminal it shows what looks like a system crash but I can ssh into it and everything appears to be working just fine. What is going on here?

[305976.417482] CPU: 60 PID: 102401 Comm: threaded-ml Tainted: G    B          ------------ T 3.10.0-1062.9.1.el7.x86_64 #1
[305976.424445] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090007  06/02/2017
[305976.430885] Call Trace:
[305976.433264]  [<ffffffff8e37ac23>] dump_stack+0x19/0x1b
[305976.437036]  [<ffffffff8e375f86>] bad_page.part.75+0xdc/0xf9
[305976.441097]  [<ffffffff8ddc617d>] free_pages_prepare+0x1ad/0x1d0
[305976.445316]  [<ffffffff8ddc6bd4>] free_hot_cold_page+0x74/0x160
[305976.449467]  [<ffffffff8ddcbfa3>] __put_single_page+0x23/0x30
[305976.453554]  [<ffffffff8ddcbff5>] put_page+0x45/0x60
[305976.457225]  [<ffffffff8de35877>] __split_huge_page+0x387/0x880
[305976.461513]  [<ffffffff8de35de6>] split_huge_page_to_list+0x76/0xf0
[305976.465965]  [<ffffffff8de368e0>] __split_huge_page_pmd+0x1d0/0x5c0
[305976.470455]  [<ffffffff8ddef4d3>] unmap_page_range+0xc63/0xc80
[305976.474877]  [<ffffffff8ddef571>] unmap_single_vma+0x81/0xf0
[305976.479019]  [<ffffffff8ddf08f5>] zap_page_range+0xc5/0x130
[305976.483079]  [<ffffffff8e381c46>] ? rt_mutex_slowunlock+0xd6/0x120
[305976.487526]  [<ffffffff8ddeb62d>] SyS_madvise+0x49d/0xac0
[305976.491629]  [<ffffffff8e38dede>] system_call_fastpath+0x25/0x2a
[318091.991229] blk_update_request: I/O error, dev fd0, sector 0
[318092.018231] blk_update_request: I/O error, dev fd0, sector 0
[323176.276146] BUG: Bad page state in process ld-linux-x86-64  pfn:70d9dff
[323176.281310] page:fffffe6143677fc0 count:0 mapcount:-127 mapping:          (null) index:0x2
[323176.286928] page flags: 0x602b0e00000000()
[323176.290359] page dumped because: nonzero mapcount
[323176.293943] Modules linked in: fuse xt_owner iptable_security ext4 mbcache jbd2 xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun bridge stpllc ebtable_filter ebtables ip6table_filter ip6_tables devlink iptable_filter nfsv3 nfs_acl rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache sunrpc dm_mirror dm_region_hash dm_log dm_mod joydev hv_utils ptp pps_core sg hv_balloon sb_edac iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper i2c_piix4 ablk_helper pcspkr cryptd binfmt_misc ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic hv_storvsc scsi_transport_fc hv_netvsc hyperv_keyboard hid_hyperv scsi_tgt ata_generic pata_acpi crct10dif_pclmul ata_piix crct10dif_common hyperv_fb libata crc32c_intel floppy hv_vmbus serio_raw
[323176.352511] CPU: 43 PID: 99598 Comm: ld-linux-x86-64 Tainted: G    B          ------------ T 3.10.0-1062.9.1.el7.x86_64 #1
[323176.359600] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090007  06/02/2017
[323176.365912] Call Trace:
[323176.368323]  [<ffffffff8e37ac23>] dump_stack+0x19/0x1b
[323176.372191]  [<ffffffff8e375f86>] bad_page.part.75+0xdc/0xf9
[323176.376366]  [<ffffffff8ddc617d>] free_pages_prepare+0x1ad/0x1d0
[323176.380682]  [<ffffffff8ddc6bd4>] free_hot_cold_page+0x74/0x160
[323176.384934]  [<ffffffff8ddcbfa3>] __put_single_page+0x23/0x30
[323176.389101]  [<ffffffff8ddcbff5>] put_page+0x45/0x60
[323176.392883]  [<ffffffff8ddf0f70>] do_numa_page+0x230/0x250
[323176.396950]  [<ffffffff8ddf1249>] handle_pte_fault+0x2b9/0xe20
[323176.401211]  [<ffffffff8dcb09a2>] ? dequeue_signal+0x32/0x180
[323176.405416]  [<ffffffff8ddf3ecd>] handle_mm_fault+0x39d/0x9b0
[323176.409622]  [<ffffffff8e388653>] __do_page_fault+0x213/0x500
[323176.413786]  [<ffffffff8e388975>] do_page_fault+0x35/0x90
[323176.417773]  [<ffffffff8e384778>] page_fault+0x28/0x30

Insmod command hangs in Linux kernel

I am writing this basic character driver, where two character devices will be generated and destoryed if needed. The builds for this driver goes fine, But while loading it to kernel, sudo insmod driver command hangs and doesn't return. Also, i have observed this once:

$ sudo insmod char_driver.ko 
  Killed

Also, i find difficulty to free the 2 devices individually with 1 major number.

The code is as follows:

#include<linux/init.h>
#include<linux/module.h>
#include<linux/device.h>
#include<linux/kernel.h>
#include<linux/fs.h>
#include<linux/cdev.h>
#include<linux/uaccess.h>
#include<linux/err.h> 

#define DEV_NAME "MyCdev"
#define MAX_DEVICES 2
#define MAX_DATA_SIZE 256

/*Data Buffers to Interact with Userspace*/
struct Data_Buffer{
    char message[MAX_DATA_SIZE];
    short int msg_size;
};

/*Common Driver Global variables*/
struct MyCdev_common{

    dev_t Major;                            // To be received by Allocating major no.
    int major_num;                          // Major no.
    int numOpen;                            // No of times device is opened.
    struct device *device[2];               // Generated devices
    struct file_operations fops;            // File operations.
    struct class *dev_class;                // Class of devices to be created.
    struct cdev devices[MAX_DEVICES];       // 
};


/*Varibles for Critical data strutures*/
static struct Data_Buffer buffer;
static struct MyCdev_common Global;


*Function definitions*/

void cleanup_fun(char num)
{
    if( num == 1 ){
        class_unregister(Global.dev_class);
        class_destroy(Global.dev_class);
    }
    unregister_chrdev_region(Global.Major,2);
}

static int  char_driver_init(void)
{
    int err_code, i;

     /*File operations are filled as usual with Dummy functions*/

   /*Step 1: Allocate Major no. fro two devices*/

     err_code = alloc_chrdev_region( &(Global.Major), 0, 2, DEV_NAME);
     if( err_code < 0 ){
             printk(KERN_ALERT"%s: Failed to Allocate Major number. Exiting\n",DEV_NAME);
             return err_code;
     }

     Global.major_num = MAJOR(Global.Major);
     pr_alert("%s: %d Major no. registered\n",DEV_NAME,  Global.major_num);

   /*Step 2: Create sysfs class*/

     Global.dev_class = class_create(THIS_MODULE, DEV_NAME);
     if( IS_ERR(Global.dev_class) )
     {
             cleanup_fun(0);
             printk(KERN_ALERT"%s: Failed to register device class\n",DEV_NAME);
             return PTR_ERR(Global.dev_class);
     }

     pr_alert("%s: class created successfully registered\n",DEV_NAME);

     for( i=0; i<MAX_DEVICES; i++)
     {
         /*Step 3: Allocate & Initialise Character device structure*/

         cdev_init(&Global.devices[i], &Global.fops);
         Global.devices[i].owner = THIS_MODULE;

       /*Step 4: Create Device Class and Initialise the device*/

         Global.device[i] = device_create(Global.dev_class, NULL/*Parent*/,MKDEV(Global.major_num, i), "MyCdev-%d",i);
         if( IS_ERR( Global.device[i] ) ){

             if( i == 1 ){   //If one device is registered successfully, exit the loop.

                 cdev_del(&Global.devices[i] );
                 printk(KERN_ALERT"%s: Failed to create a device %d. Continuing with device 0\n",DEV_NAME, i);
                 err_code = 0xFFFF;
                 goto End;
             }

             cdev_del(&Global.devices[i] );
             cleanup_fun(1);
             printk(KERN_ALERT"%s: Failed to create a device %d\n",DEV_NAME, i);
             return PTR_ERR(Global.device[i]);
         }

         pr_alert("%s: Device %d created successfully\n",DEV_NAME,i);

       /*Step 5: Add the character device to kernel*/
         err_code = cdev_add(&Global.devices[i], MKDEV(Global.major_num, i), 1);
         if(err_code < 0 ){
             device_destroy(Global.dev_class, MKDEV(Global.major_num, i));
             if(i == 1){ //if One device got registered, we can work with one, so exit.
                 cdev_del(&Global.devices[i] );
                 printk(KERN_ALERT"%s: Failed to create a device %d. Continuing with device 0\n",DEV_NAME, i);
                 err_code = 0xFFFF;      //Flag to Indicate that one device has failed.
                 goto End;
             }

             cdev_del( &Global.devices[i] );
             cleanup_fun(1);
             printk(KERN_ALERT"%s: Failed to Add driver to kernel\n",DEV_NAME);
             return err_code;

         }

         pr_alert("%s: Device %d added successfully\n",DEV_NAME,i);

 End:
         if(err_code == 0xFFFF )
             printk(KERN_ALERT"%s-%d:Device 0 Registered with major number %d\n",DEV_NAME,0 ,Global.major_num);
         else
             printk(KERN_ALERT"%s:Devices Registered with major number %d\n",DEV_NAME ,Global.major_num);
        return 0;

 }

 void char_driver_exit(void)
 {

     int i=0;
     for(i=0;i<MAX_DEVICES;i++)   {
         device_destroy(Global.dev_class, MKDEV(Global.major_num, i) );
         cdev_del(&Global.devices[i] );
     }

     pr_alert("%s: devices destroyed!!!\n",DEV_NAME);

     class_unregister(Global.dev_class);
     class_destroy(Global.dev_class);
     pr_alert("%s: class destroyed!!!\n",DEV_NAME);

     unregister_chrdev_region(Global.Major,2);
     pr_alert("%s: Driver removed successfully\n",DEV_NAME);
 }

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("First character driver");

module_init(char_driver_init);
module_exit(char_driver_exit);

The modprobe utility return the following:

$ sudo modprobe char_driver.ko
  modprobe: FATAL: Module char_driver.ko not found in directory 
  /lib/modules/4.15.0-88-generic

Programmatically obtaining the vendor ID, product ID of a USB device on Linux 5.4

I am currently trying to list all usb devices that are connected to a Linux system, the code will be running in the kernel, as an LSM. The lsm code is known good.

I have looked at this question but it was asked six years ago.

The answer to the question suggested using the following code:

struct usb_device udev;  

struct usb_bus *bus;  
ssize_t ret;  
static int __init usb_fun_init (void)  
{  
    int result;  
    __le16 idVendor = 0;  
    __le16 idProduct = 0;  
    __u8 iManufacturer = 0;  
    __u8 iSerialNumber = 0;  


    printk(KERN_INFO "\n************************************ in init\n");  
    list_for_each_entry(bus, &usb_bus_list, bus_list)
    {  
        printk(KERN_INFO "***************** Begins ****************");  

        printk(KERN_INFO "Vendor ID = %x", bus->root_hub->descriptor.idVendor);  
        printk(KERN_INFO "Product ID = %x", bus->root_hub->descriptor.idProduct);  
        printk(KERN_INFO "Serial Number = %x", bus->root_hub->descriptor.iSerialNumber);  
        //printk(KERN_INFO "Manu = %s", bus->root_hub->descriptor.iManufacturer);  
        printk(KERN_INFO "Manu = %s", bus->root_hub->manufacturer);  
        printk(KERN_INFO "Product = %s", bus->root_hub->product);  
        printk(KERN_INFO "Serial Number = %s", bus->root_hub->serial);  
        printk(KERN_INFO "\nManufacturer = %s", udev.bus.iManufacturer);         
    }     
    return 0;  
}  

static void __exit usb_fun_exit (void)  
{  
    printk(KERN_INFO "\n************************************ in exit\n");  
}  

module_init(usb_fun_init);  
module_exit(usb_fun_exit);  

MODULE_LICENSE("GPL");  

However, the compilation errors out. From what i can see, the kernel structures have changed, i have poked about the header files, and the only likely candidate i can see is usb_bus_id as it has the same method signature, and return type. However this does not work either. Could someone please point me in the right direction?

How to enable zram swap in Android Build/kernel?

How to enable zram as swap device in android linux kernel ? Is there any way create zram before init process ? kernelcmdline or kernel config.

As per zram.txt no default way.

Viewing all 12176 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>