rel:: [[Operating Systems MOC|Operating Systems]]
# Linux
## Virtualization
### AWS Firecracker
- [[Firecracker - Lightweight Virtualization for Serverless Applications]]
## Reference
- [browse linux source by version](https://elixir.bootlin.com/linux/latest/source)
- [The Definitive Guide to Linux System Calls](x-devonthink-item://B1E412B6-8044-48A0-B2E8-001CFA5948C7)
- [How to Restart systemd without rebooting Linux](x-devonthink-item://E60BC0AF-F57E-45FD-8397-BE30191D7C19)
### [Crisis Tools](https://www.brendangregg.com/blog/2024-03-24/linux-crisis-tools.html)
from <https://www.brendangregg.com/blog/2024-03-24/linux-crisis-tools.html>
| Package | Provides | Notes |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| procps | ps(1), vmstat(8), uptime(1), top(1) | basic stats |
| util-linux | dmesg(1), lsblk(1), lscpu(1) | system log, device info |
| sysstat | iostat(1), mpstat(1), pidstat(1), sar(1) | device stats |
| iproute2 | ip(8), ss(8), nstat(8), tc(8) | preferred net tools |
| numactl | numastat(8) | NUMA stats |
| tcpdump | tcpdump(8) | Network sniffer |
| linux-tools-common <br>linux-tools-$(uname -r) | perf(1), turbostat(8) | profiler and PMU stats |
| bpfcc-tools (bcc) | opensnoop(8), execsnoop(8), runqlat(8), softirqs(8), <br>hardirqs(8), ext4slower(8), ext4dist(8), biotop(8), <br>biosnoop(8), biolatency(8), tcptop(8), tcplife(8), <br>trace(8), argdist(8), funccount(8), profile(8), etc. | canned eBPF tools[1] |
| bpftrace | bpftrace, basic versions of opensnoop(8), <br>execsnoop(8), runqlat(8), biosnoop(8), etc. | eBPF scripting[1] |
| trace-cmd | trace-cmd(1) | Ftrace CLI |
| nicstat | nicstat(1) | net device stats |
| ethtool | ethtool(8) | net device info |
| tiptop | tiptop(1) | PMU/PMC top |
| cpuid | cpuid(1) | CPU details |
| msr-tools | rdmsr(8), wrmsr(8) | CPU digging |
### Why `gettimeofday` and `clock_gettime` are slow on [[AWS]]
- [Making Time To Save Time](x-devonthink-item://45B57D3A-D50B-4B86-B4B8-C004A4B1BE59)
- [Two frequently used system calls are ~77% slower on AWS EC2 - Packagecloud Blog](x-devonthink-item://F9D32FBE-68A1-4FD8-92D7-AFA59D959E6E)
## Recipes
### Setting default kernel in grub2
- [setting default kernel in grub](https://www.stephenrlang.com/2017/06/setting-default-kernel-in-grub2/)
- [troubleshooting grub](https://aws.amazon.com/blogs/compute/using-ec2-serial-console-to-access-the-grub-menu-and-recover-from-boot-failures/) in [[AWS]]
```
sudo grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2
# Amazon Linux (5.10.162) 2
# Amazon Linux (5.10.157-139.675.amzn2.x86_64) 2
sudo grub2-set-default "Amazon Linux (5.10.162) 2"
sudo grub2-editenv list
# boot_success=0
# saved_entry=Amazon Linux (5.10.162) 2
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
# Generating grub configuration file ...
# Found linux image: /boot/vmlinuz-5.10.162
# Found initrd image: /boot/initramfs-5.10.162.img
# Found linux image: /boot/vmlinuz-5.10.157-139.675.amzn2.x86_64
# Found initrd image: /boot/initramfs-5.10.157-139.675.amzn2.x86_64.img
# done
```