udev rules for sd* and dm-* device not working as expected - linux

# cat /etc/oracle-release
Oracle Linux Server release 7.8
uname -a
Linux 3.10.0-957.el7.x86_64 #1 SMP Thu Oct 4 20:48:51 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
cat 99-custom.rules
ACTION!="add|change", GOTO="rule_end"
ENV{ID_VENDOR}=="NETAPP*", RUN+="/bin/sh -c 'echo 4096 > /sys%p/queue/max_sectors_kb'"
LABEL="rule_end"
----2nd option using KERNEL option just for dm-* devices
ACTION!="add|change", GOTO="rule_end"
KERNEL=="dm-[0-9]*",ENV{ID_VENDOR}=="NETAPP*", RUN+="/bin/sh -c 'echo 4096 > /sys%p/queue/max_sectors_kb'"
LABEL="rule_end"
udevadm control --reload-rules && udevadm trigger
/sbin/udevadm trigger --type=devices --action=change
Issue : We don't see udev rule applied to all dm-* device
/sys/block/dm-19/queue/max_sectors_kb:512
/sys/block/dm-9/queue/max_sectors_kb:512
We even tried to remove ENV{ID_VENDOR}=="NETAPP*" from rule
What we need to apply max_sectors_kb to 4096 to all dm-* ( multipath devices )
and all sd* devices can be left default of 512
Any idea what could be wrong ?

Related

can`t find "cpu.cfs_period_us" and "cpu.cfs_quota_us" in cgroup

I want to limit the CPU usage of the process through CGroup.After searching for some information on the Internet, I learned that it needed to be revised "cpu.cfs_period_us" and "cpu.cfs_quota_us",but now I can`t find these two files in cgroup.
My steps are as follows
The path "/sys/fs/cgroup" already exists in my Linux system, but there are no files in it.So I mount the cgroup/cpu/ file according to the reference standard steps:
cd /sys/fs/
mount -t tmpfs cgroup_root ./cgroup
mkdir cgroup/cpu
mount -t cgroup -ocpu cpu ./cgroup/cpu/
What puzzles me is that my ./cgroup/cpu/ directory doesn't have "cpu.cfs_period_us" and "cpu.cfs_quota_us"... What's the reason? Is it a kernel configuration problem?
I have these files in my ./cgroup/cpu path:
/sys/fs # ls ./cgroup/cpu/
cgroup.clone_children cpu.rt_period_us release_agent
cgroup.procs cpu.rt_runtime_us tasks
cgroup.sane_behavior haoel
cpu.notify_on_migrate notify_on_release
Other information
1)my linux system info
/ # cat /proc/version
Linux version 3.18.20 (gcc version 4.9.2 (GCC) ) #1 PREEMPT Tue Mar 9 03:52:45 CST 2021
/ # uname -a
Linux mdm9607-perf 3.18.20 #1 PREEMPT Tue Mar 9 03:52:45 CST 2021 armv7l GNU/Linux
2)Related kernel configuration
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
CONFIG_CGROUP_FREEZER=y
# CONFIG_CGROUP_DEVICE is not set
# CONFIG_CPUSETS is not set
CONFIG_CGROUP_CPUACCT=y
CONFIG_RESOURCE_COUNTERS=y
# CONFIG_MEMCG is not set
# CONFIG_CGROUP_PERF is not set
CONFIG_CGROUP_SCHED=y
# CONFIG_FAIR_GROUP_SCHED is not set
CONFIG_RT_GROUP_SCHED=y
# CONFIG_BLK_CGROUP is not set

Bash on Windows 10, no loop devices

I've just tried Bash on my Windows 10 PC, and it works fine. However, I found that there is no such thing as loop devices by ls /dev/, and modprobe loop gives an error output.
Does it mean this Bash doesn't support loop devices at all or is there a solution for mounting an image as a loop device?
Windows Subsystem for Linux 1 (WSL, formerly known as Bash on Ubuntu on Windows) did not support loop devices. There was a feature request and an issue about it on Microsoft's Git repo.
WSL 2, however, does support loop devices.
$ uname -a
Linux Blade 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ fallocate -l 1G test.img
$ mkfs.ext3 test.img
mke2fs 1.45.5 (07-Jan-2020)
Discarding device blocks: done
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: 549cca4d-a65f-4f4f-8428-e324feaed3d0
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
$ sudo mount -o loop test.img /media/
$ ls /media/
lost+found
Do you know that Bash is just a shell (something that reads your commands, executes them, pipes between them and permits you to write scripts) and is not an operating system?
Loop devices are part of the Linux kernel, and they simply don't exist in the Windows kernel.

sysctl: setting key "kernel.softlockup_panic": Invalid argument

When I am trying to set kernel.softlockup_panic value to 30 instead of 0. I am getting Invalid argument error
# sysctl -w kernel.softlockup_panic=30
Error message
# sysctl: setting key "kernel.softlockup_panic": Invalid argument
kernel.softlockup_panic = 30
Can anyone please guide?
I am using SLES12 64bit OS
# uname -a
Linux linux-r1qg 3.12.28-4-default #1 SMP Thu Sep 25 17:02:34 UTC 2014 (9879bd4) x86_64 x86_64 x86_64 GNU/Linux
I Have used syctl for other purposes. Guess this params is not supported by kernel .
you can check this thru either of the commands
sudo sysctl -a | grep softlockup
cat /proc/sys /etc/sysctl.conf

logname unset with input redirection (stdin)

For linux why when providing stdin (input redirection) to logname it is not able to determine the user?
#> echo `logname`
<username>
#> echo `logname` < /dev/null
logname: no login name
#> echo `logname` < /dev/tty
logname: no login name
Moverover this does not seem to affect whoami.
#> echo `whoami`
<username>
#> echo `whoami` < /dev/null
<username>
Edit: Adding OS versions (tested it on multiple different Linux machines).
#> uname -a
Linux <machine1> 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
#> uname -a
Linux <machine2> 2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
#> uname -a
Linux <machine3> 3.0.13-0.27-default #1 SMP Wed Feb 15 13:33:49 UTC 2012 (d73692b) x86_64 x86_64 x86_64 GNU/Linux
On Unix/Linux systems, you can have multiple users logged in through different windows, ssh sessions etc. Each currently logged in user may or may not have a tty associated with the session. If there is a tty session allocated for a user, the association between tty and the user logged in on it is stored in the systems utmp file (the path may vary). logname wants to first see what tty you are on, then look up the associated record in the utmp file to see who you are. When you do logname < /dev/null, logname is disassociated from your tty, and so fails to find out which record it needs to lookup, which is why it reports "no login name".

Finding if kernel is 32-bit or 64-bit on Linux

When I run uname -a, I get:
Linux 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
and I understand that x86_64 is supposed to imply 64-bit kernel, but why does this number appear 3 times? What does each instance signify?
Uname has separate commands to print "machine, processor and hardware platform" -- all of these are all the same in your case. The following outputs, respectively, may make it clear:
~$ uname -m # print machine
x86_64
~$ uname -p # print processor
x86_64
~$ uname -i # print hw platform
x86_64
use uname -m command to display only name of the kernel.
in your case
uname -m
x86_64
means 64-bit
uname -a
will give you all details about your system. It includes machine hardware name, processor type & hardware platform too.
So,
x86_64 is machine name.
x86_64 is processor type.
x86_64 is hardware platform.
Use:
uname --help
to get more idea about its options.

Resources