systemd: cgroups: BlockIOWeight or IOWeight - systemd

I want to set block I/O weight for one of my services. Should I use BlockIOWeight or IOWeight?
Do I need to add BlockIOAccounting=yes or IOAccounting=yes?
~/ mount
...
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)

Related

unable to login buildroot

i use buildroot and compile linux kenrenl and when i run QEMU,i cann't login to builroot, because i cann't see message "Welcome to buildroot" for login,
ata2.01: NODEV after polling detection
ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
ata1.01: NODEV after polling detection
ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
ata1.00: 11502 sectors, multi 16: LBA48
ata1.00: configured for MWDMA2
ata2.00: configured for MWDMA2
scsi 0:0:0:0: Direct-Access ATA QEMU HARDDISK 2.5+ PQ: 0
ANSI: 5
sd 0:0:0:0: [sda] 11502 512-byte logical blocks: (5.89 MB/5.62 MiB)
scsi 1:0:0:0: CD-ROM QEMU QEMU DVD-ROM 2.5+ PQ: 0
ANSI: 5
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
sd 0:0:0:0: [sda] Attached SCSI disk
input: ImExPS/2 Generic Explorer Mouse as
/devices/platform/i8042/serio1/input/input3
EXT4-fs (sda): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (sda): mounting ext2 file system using the ext4 subsystem
EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
VFS: Mounted root (ext2 filesystem) readonly on device 8:0.
devtmpfs: mounted
Freeing unused kernel memory: 832K (ffffffff8186e000 -
ffffffff8193e000)
Write protecting the kernel read-only data: 8192k
Freeing unused kernel memory: 1212K (ffff8800014d1000 -
ffff880001600000)
Freeing unused kernel memory: 536K (ffff88000177a000 -
ffff880001800000)
random: fast init done
EXT4-fs (sda): warning: mounting unchecked fs, running e2fsck is
recommended
EXT4-fs (sda): re-mounted. Opts:
block_validity,barrier,user_xattr,errors=remount-ro
Starting logging: OK
Initializing random number generator... done.
Starting network: OK
### here, i was unable to see message command for login,
QEMU:
qemu-system-x86_64 -hda buildroot/buildroot 2017.02.2/output/images/rootfs.ext2 -m 2G -smp 2 -nographic -kernel buildroot/buildroot-2017.02.2/output/images/bzImage -append "console=ttyS0 root=/dev/sda debug earlyprintk=serial slub_debug=QUZ"
i don't understand why i am unable to see message "Welcome to buildroot" ??
Maybe you need to modify the bootloader parameter..set the console to ttyS?
or you can modify the rootfs.tar, in the rootfs, edit the etc/inittab
for instance,change ttymxc1 to ttymxc0:
# Put a getty on the serial port
ttymxc0::respawn:/sbin/getty -L ttymxc0 0 vt100 # GENERIC_SERIAL
If you use QEMU nographic option, please check following bullet points:
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" in buildroot config file
console=ttyS0 in kernel args when run QEMU
Take the sdcard.img file in buildtoot>> output>> images>>sdcard.img
Then make it bootable using balena etcher(when using ubuntu) or rufus(when using windows).
Then flash to memory card.
Then put that card in fpga board.
It will surely work for everyone.
If any doubt: contact parthumahesh1998#gmail.com

Runtime constraints on CPU and memory with docker containers

How can we change the memory and cpu limit for docker containers at runtime? I mean while the container is running I would like to change the the memory limit for example
Thanks in advance
You cannot change that inside the running container, you would have to do that on your host.
How you do that on the host depends on your host-os, on Linux I suggest to take a look a cgroups, thats how docker internally restricts containers.
On ubuntu you could use the cgroup manager cgm (tried it on ubuntu 15.04).
create a new cgroup for cpu, move the process (e.g. 28433) to it and set a value
> # cgm create cpu dudecpu
> # cgm movepid cpu dudecpu 28433
> # cgm setvalue cpu dudecpu cpu.shares 512
create a new cgroup for the memory move the process (e.g. 28433) to it and set a value
> cgm create memory dudemem
> cgm movepid memory dudemem 28433
> cgm setvalue memory dudemem memory.limit_in_bytes 1000000000
check where your new cgroups are and look into these directories, you'll find all the properties of the cgroup there.
> find /sys/fs/cgroup/ -name "dude*"
> /sys/fs/cgroup/memory/user.slice/user-1000.slice/session-c3.scope/dudemem
> /sys/fs/cgroup/cpu,cpuacct/user.slice/user-1000.slice/session-c3.scope/dudecpu

Yocto Boot Partition error (Intel Edison)

I was trying to resize partitions of Intel Edison which runs on Yocto system. I destroyed partition 1 somehow. So when I reboot system it loops forever to boot the system correctly. So, interrupted boot sequence and checked for partitions to see what is wrong. As you can see down below partitions start from number two not one! According to error from bootloader it searches for part 1 but cannot find . So how can I add/ create/ repair manually partition 1 to recover system?
boot > printenv partitions
partitions=uuid_disk=${uuid_disk};name=u-boot0,start=1MiB,size=2MiB,uuid=${uuid_uboot0};name=u-boot-env0,size=1MiB,uuid=${uuid_uboot_env0};name=u-boot1,size=2MiB,uuid=${uuid_uboot1};name=u-boot-env1,size=1MiB,uuid=${uuid_uboot_env1};name=factory,size=1MiB,uuid=${uuid_factory};name=panic,size=24MiB,uuid=${uuid_panic};name=boot,size=32MiB,uuid=${uuid_boot};name=rootfs,size=512MiB,uuid=${uuid_rootfs};name=update,size=768MiB,uuid=${uuid_update};name=home,size=-,uuid=${uuid_home};
boot > mmc part
Partition Map for MMC device 0 -- Partition Type: DOS
Part Start Sector Num Sectors UUID Type
2 16 7634928 00000000-02 83
Boot Sequence
******************************
PSH KERNEL VERSION: b0182727
WR: 20104000
******************************
SCU IPC: 0x800000d0 0xfffce92c
PSH miaHOB version: TNG.B0.VVBD.0000000c
microkernel built 23:15:13 Apr 24 2014
******* PSH loader *******
PCM page cache size = 192 KB
Cache Constraint = 0 Pages
Arming IPC driver ..
Adding page store pool ..
PagestoreAddr(IMR Start Address) = 0x04899000
pageStoreSize(IMR Size) = 0x00080000
*** Ready to receive application ***
U-Boot 2014.04 (Oct 14 2014 - 15:19:04)
Watchdog enabled
DRAM: 980.6 MiB
MMC: tangier_sdhci: 0
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
Target:blank
Partitioning already done...
Flashing already done...
**dfu_fill_entity_mmc: could not find partition #1 on mmc device #0!
ERROR: DFU entities configuration failed!**
at drivers/dfu/dfu.c:71/dfu_init_env_entities()
dfu - Device Firmware Upgrade
Usage:
dfu <USB_controller> <interface> <dev> [list|timeout]
- device firmware upgrade via <USB_controller>
on device <dev>, attached to interface
<interface>
[list] - list available alt settings
[timeout] - specify inactivity timeout in sec, doesn't work whit list
** Invalid partition 7 **
Error: Invalid Boot Flag (found 0xffef, expected 0xaa55)
## Kernel loading failed ...
zboot - Boot bzImage
Usage:
zboot [addr] [size] [initrd addr] [initrd size]
addr - The optional starting address of the bzimage.
If not set it defaults to the environment
variable "fileaddr".
size - The optional size of the bzimage. Defaults to
zero.
initrd addr - The address of the initrd image to use, if any.
initrd size - The size of the initrd image to use, if any.
Unknown boot mode: boot
Saving Environment to MMC...
Writing to MMC(0)... done
Resetting to default boot mode and reboot...
resetting ...
I solved that problem myself. After interrupting boot sequence use gpt command to add new partition to mmc. Then, system boots correctly.

Getting names of all kernel modules used by a particular module

In the output of lsmod command, Used by column sometimes does not have the name of the kernel modules used by the module. For example, consider the following part-output of the lsmod command:
Module Size Used by
xen_blkfront 16512 4
ext3 137007 1
jbd 54383 1 ext3
mbcache 7438 1 ext3
In the above output, ext3 module is used by 1 module, but its name is not there. Similarly, xen_blkfront module is used by 4 modules, but there are no names for those modules. But, jdb and mbcache modules are used by ext3 module. So, is there a way to get these missing module names ?
I need this because the kernel does not allow me to rmmod ext3 module saying "ERROR: Module ext3 is in use".
The "Used by" column shows not only the number of referencing modules, but the numer of times that any kernel code has taken a reference to the module.
For file systems and device drivers, this typically happens when a file/device is opened.
The source of those references is not tracked.

Rootfs on SD card

I've a device on which I've a 3.10 linux kernel booting up to a busybox shell (initramfs)
When I extracted the busybox filesystem image on the SD card and when modified the root from root=/dev/ram to /dev/mmcblck0p1, it still boots up to the shell
So the busybox works fine but if I try to use any other FS the kernel would crash...
While I try to generate a rootfs using debootstrap (https://help.ubuntu.com/community/DebootstrapChroot) and have the new rootfs extracted on the SD card. I get an error saying "Failed to execute /sbin/init"
I did check if the file is present and also checked the permissions and it looks good to me.
What could be the problem?
W.R.T rootfs I'm particularly new. I was assuming that any FS on the SD card could be mounted but looks like its not the case. I'm guessing that whatever the /sbin/init will be doing is device dependent?
What I am trying to do? --->
I need to make a rootfs with a few packages and libraries (gcc python etc..) What would a normal approach? I've even tried buildroot but I couldn't get gcc on target. Is it not possible to have gcc in /bin/ within buildroot?
-- UPDATE --
I'm formatting the SD card to ext4 format and following is the output of fdisk
Disk /dev/sdb1: 7945 MB, 7945588224 bytes
255 heads, 63 sectors/track, 965 cylinders, total 15518727 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc2aa4908
Device Boot Start End Blocks Id System
And following are the kernel logs while I have a filesystem on the SD card. The memory card driver works fine I've verified that. If I have a busybox filesystem on the SD card, everything works fine. When I'm using any other file systems I get the following...
6EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
6VFS: Mounted root (ext4 filesystem) on device 179:1.
6Freeing unused kernel memory: 84K (c0f00000 - c0f15000)
3request_module: runaway loop modprobe binfmt-464c
4kworker/u2:4 (145) used greatest stack depth: 6132 bytes left
3Failed to execute /sbin/init. Attempting defaults...
3request_module: runaway loop modprobe binfmt-464c
3request_module: runaway loop modprobe binfmt-464c
0Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
When checked, there is /sbin/init with the appropriate permissions that too!
Consider this error: "request_module: runaway loop modprobe binfmt-464c"
In all probability you're trying to use 64b binaries (/sbin/init and the rest) with 32b only kernel. Either recompile your kernel to support 64b or install a 32b user space onto your sd card.
Other things to check:
Confirm that elf support is indeed enabled in your kernel (it normally is, but it is possible to disable it).
Google that error and see what sort of problems people were having with it.

Resources