Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
19
votes
3
answers
10242
views
How can I create a swap file?
I know how to create and use a swap partition but can I also use a file instead? How can I create a swap file on a Linux system?
I know how to create and use a swap partition but can I also use a file instead?
How can I create a swap file on a Linux system?
Vlastimil Burián
(30505 rep)
Oct 26, 2015, 09:47 PM
• Last activity: Aug 6, 2025, 10:04 AM
4
votes
1
answers
2209
views
Disabling gpgcheck with tmprepo plugin
I want to install an rpm from a repo just once and not have to add it to my yum.repos.d/ directory using the tmprepo plugin. However, I’m blocked on how to install an rpm with no gpg signature. The ‘—nogpgcheck’ option doesn’t work with the tmprepo plugin and I need to manually append ‘pkgs_gpgcheck...
I want to install an rpm from a repo just once and not have to add it to my yum.repos.d/ directory using the tmprepo plugin. However, I’m blocked on how to install an rpm with no gpg signature. The ‘—nogpgcheck’ option doesn’t work with the tmprepo plugin and I need to manually append ‘pkgs_gpgcheck=false’ to /etc/yum/pluginconf.d/tmprepo.conf.
sudo yum --tmprepo=http://edge.artifactory.example.com:8000/artifactory/chef_rpms/rhel/chef_rpms.repo --nogpgcheck install chef
## ^^ this fails as —nogpgcheck doesn’t work with tmprepo which defaults to gpgcheck unless I manually edit /etc/yum/pluginconf.d/tmprepo.conf
Any way this can be done when calling yum on command line? I don’t want to go about changing a file on the system for a one-time thing. Thanks!
- Faheem
Faheem
(61 rep)
Sep 9, 2014, 11:57 PM
• Last activity: Aug 6, 2025, 10:04 AM
0
votes
0
answers
23
views
getting a POSIX file descriptor from a GNU libstdc++ stream
Assuming (on GNU linux, with GNU libstdc++ and C++17 -not C++23- compiled by [GCC](https://gcc.gnu.org/) version 15 or later) I have a `std::ifstream* f;` pointer to a valid input stream (presumably opened). How can I get the POSIX input file descriptor? (e.g. to use [poll(2)](https://man7.org/linux...
Assuming (on GNU linux, with GNU libstdc++ and C++17 -not C++23- compiled by [GCC](https://gcc.gnu.org/) version 15 or later) I have a
std::ifstream* f;
pointer to a valid input stream (presumably opened).
How can I get the POSIX input file descriptor? (e.g. to use [poll(2)](https://man7.org/linux/man-pages/man2/poll.2.html) or [fstat(2)](https://man7.org/linux/man-pages/man2/stat.2.html) ...)
I tried f->get_fd()
and it does not compile.
Same question for std::ofstream
and the POSIX output file descriptor.
Thanks.
Basile Starynkevitch
(10709 rep)
Aug 6, 2025, 09:01 AM
• Last activity: Aug 6, 2025, 09:28 AM
8
votes
1
answers
2401
views
Tmpfs with overflow on disk?
I'm looking for a way to have a tmpfs-like file system that can be unlimited in size, but will use a specified amount of RAM after which the "oversize" data will be stored on another disk-backed filesystem [![tmpfs][1]][1] I'm running on a SSD-only system, with low available space (usually < 3 GB),...
I'm looking for a way to have a tmpfs-like file system that can be unlimited in size, but will use a specified amount of RAM after which the "oversize" data will be stored on another disk-backed filesystem
I'm running on a SSD-only system, with low available space (usually < 3 GB), so I don't want to reserve any space for SWAP or similar (that's my main requirement)
Do you know of any solution that would fit my use-case ?
mickael9
(181 rep)
Apr 22, 2016, 10:12 PM
• Last activity: Aug 6, 2025, 03:08 AM
1
votes
1
answers
44
views
`echo 2 > /proc/sys/vm/drop_caches` decreases active pages
Before running `echo 2 > /proc/sys/vm/drop_caches` the active page count was: ``` Active(anon): 36185016 kB ``` after the flush, active page count became: ``` Active(anon): 26430472 kB ``` every other meminfo metrics stayed mostly the same and the system shows that 10GB of ram was freed. These 10GB...
Before running
echo 2 > /proc/sys/vm/drop_caches
the active page count was:
Active(anon): 36185016 kB
after the flush, active page count became:
Active(anon): 26430472 kB
every other meminfo metrics stayed mostly the same and the system shows that 10GB of ram was freed. These 10GB are not attributed to any of the processes.
What could explain such behavior? I am running on kernel 6.8.
Update:
This happens when **madvise(MADV_DONTNEED)** is used to decommit RSS. If I use *MADV_FREE* instead then surpringly I do not see **hidden** kernel memory and total used memory is tightly correlated with the RSS of the main process.
Roman
(111 rep)
Aug 3, 2025, 06:56 PM
• Last activity: Aug 5, 2025, 11:07 PM
0
votes
1
answers
358
views
linux record audio (arecord or similair) and separate left/right channel
I want to record (line in) from an audio device and separate the left and right channel each to a different process, or record them separately of course. What I want is something like that (play command just as example): either: ``` arecord (left channel only) -q -D plughw:1,0 -f S16_LE -r 22050 | p...
I want to record (line in) from an audio device and separate the left and right channel each to a different process, or record them separately of course.
What I want is something like that (play command just as example):
either:
arecord (left channel only) -q -D plughw:1,0 -f S16_LE -r 22050 | play -t raw -r 22050 -b 16 -e signed -q -
arecord (right channel only) -q -D plughw:1,0 -f S16_LE -r 22050 | play -t raw -r 22050 -b 16 -e signed -q -
(may also result in device or resource busy?)
or something like
"arecord | splitchannels (leftchannel | process 1) (rightchannel | process 2)"
or possibly more like that
"arecord | tee >(getleftchannel | process1) >(getrightchannel | process2) > /dev/null"
as intensive web searches didn't give any usable results.
Any idea how I can accomplish that?
Paul Neuwirth
(111 rep)
Dec 3, 2023, 02:05 PM
• Last activity: Aug 5, 2025, 01:07 PM
2
votes
1
answers
2852
views
Docker: Restricting inbound and outbound traffic using iptables
We have lot of applications that run on Linux server using Docker. As an example, let us say my application runs on **ServerA** as a container (Docker). CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES df68695a00f1 app/myapp:latest "/run.sh" 2 weeks ago Up 2 days 0.0.0.0:50423->3000/tcp reallym...
We have lot of applications that run on Linux server using Docker.
As an example, let us say my application runs on **ServerA** as a container (Docker).
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
df68695a00f1 app/myapp:latest "/run.sh" 2 weeks ago Up 2 days 0.0.0.0:50423->3000/tcp reallymyapp
The app is listening on the port 50423 on the host (mapped to port 3000 on the container).
The DNS (endpoint) that is used to access the app is pointing to the HAProxy host (say **ServerB**), that routes the traffic to **ServerA:50423**.
Everything works well so far.
The security team in our org raised a concern that all external source IPs are potentially allowed to connect to such Docker hosts (like **ServerA**) and they want us to restrict traffic to allow only a specific IP (**ServerB** which is a load balancer) to access the containers and vice versa (**ServerA** to **ServerB**). We would then allow connectivity from our users' machines to **ServerB**/load balancer only.
Now, I followed Docker documentation and tried to insert the following rule using iptables to DOCKER-USER chain:
iptables -I DOCKER-USER -i ekf192 -s 10.1.2.10, 10.1.2.11, 10.1.2.12 -j ACCEPT
iptables -I DOCKER-USER -i ekf192 -j DROP
ACCEPT all -- 10.1.2.10 anywhere
ACCEPT all -- 10.1.2.11 anywhere
ACCEPT all -- 10.1.2.12 anywhere
LOG all -- anywhere anywhere LOG level info prefix "IPTables Dropped: "
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere
Please note that we need both incoming and outgoing traffic from/to these hosts (10.1.2.10, 10.1.2.11, 10.1.2.12).
Now, as per my (limited) knowledge on iptables, these rules should drop all incoming requests except for when it is origination from the mentioned IP addresses and vice versa i.e. allow outgoing traffic to mentioned IPs.
The incoming traffic works as expected but the outgoing traffic to these HOSTS is getting dropped.
I am scratching my head over this and cannot figure out what is going wrong...and not to mention that I absolutely suck at understanding how iptables rules work.
Jan 12 16:24:43 sms100394 kernel: IPTables Dropped: IN=docker0 OUT=ekf192 MAC=02:42:09:37:a0:14:02:42:ac:11:00:02:08:00 SRC=172.17.0.2 DST=10.1.2.10 LEN=40 TOS=0x00 PREC=0x00 TTL=63 ID=40235 DF PROTO=TCP SPT=3000 DPT=42579 WINDOW=242 RES=0x00 ACK FIN URGP=0
Jan 12 16:24:44 sms100394 kernel: IPTables Dropped: IN=docker0 OUT=ekf192 MAC=02:42:09:37:a0:14:02:42:ac:11:00:02:08:00 SRC=172.17.0.2 DST=10.1.2.11 LEN=52 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=TCP SPT=3000 DPT=45182 WINDOW=29200 RES=0x00 ACK SYN URGP=0
Jan 12 16:24:45 sms100394 kernel: IPTables Dropped: IN=docker0 OUT=ekf192 MAC=02:42:09:37:a0:14:02:42:ac:11:00:02:08:00 SRC=172.17.0.2 DST=10.1.2.12 LEN=52 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=TCP SPT=3000 DPT=45182 WINDOW=29200 RES=0x00 ACK SYN URGP=0
Koshur
(1399 rep)
Jan 12, 2021, 05:39 PM
• Last activity: Aug 5, 2025, 01:01 PM
5
votes
2
answers
3360
views
Multiple M.2 NVMe SSDs on single slot using PCIe bifurcation: Set this up from Linux when BIOS does not?
I'd like to use a multi-M.2 NVMe PCIe carrier card like an [Asus Hyper M.2 x16 Card v2](https://www.asus.com/Motherboard-Accessories/HYPER-M-2-X16-CARD-V2/) in an [HP Z240 tower workstation](https://web.archive.org/web/20220414145018/https://support.hp.com/us-en/document/c04887696). Its C236 PCH and...
I'd like to use a multi-M.2 NVMe PCIe carrier card like an [Asus Hyper M.2 x16 Card v2](https://www.asus.com/Motherboard-Accessories/HYPER-M-2-X16-CARD-V2/) in an [HP Z240 tower workstation](https://web.archive.org/web/20220414145018/https://support.hp.com/us-en/document/c04887696) . Its C236 PCH and Skylake E3-1200V5 CPU support [PCIe bifurcation](https://web.archive.org/web/20170628175109/https://www.intel.com/content/www/us/en/intelligent-systems/maho-bay/core-i7-pcie-slot-bifurcation-demo.html) 1 of the x16 PCIe slot driven by the CPU. (Ref: [Intel 100 Series / C230 Series Chipset datasheet Vol 1](https://web.archive.org/web/20210304165912/https://www.intel.com/content/www/us/en/products/docs/chipsets/100-series-chipset-datasheet-vol-1.html) , p. 22; [Intel Xeon E3-1200V5 datasheet Vol 1](https://web.archive.org/web/20181030044706/https://www.intel.com/content/www/us/en/processors/xeon/xeon-e3-1200v5-vol-1-datasheet.html) , p. 24.) Configuring the CPU PCIe for bifurcated 1x8 + 2x4 mode would allow using 3 M.2 NVMe drives in the x16 slot. (The E3 CPU is incapable of 4x4 bifurcation, so one of the M.2 slots in a quad-carrier card like the aforementioned Asus must remain empty.)
Unfortunately the Z240's BIOS Setup does not include options to configure PCIe bifurcation. Worse, it appears that [HP's *Sure Start*](https://web.archive.org/web/20241228141437/http://h10032.www1.hp.com/ctg/Manual/c05163901) dual BIOS [prevents BIOS modifications](https://web.archive.org/web/20211120042316/https://www.win-raid.com/t4593f36-HP-Pavillion-g-wm-AMI-Aptio-V-modding-trials.html#msg75578) which [could enable PCIe bifurcation](https://blog.donbowman.ca/2017/10/06/pci-e-bifurcation-explained/) .
This [Intel video introduction to PCIe bifurcation](https://www.intel.com/content/www/us/en/intelligent-systems/maho-bay/core-i7-pcie-slot-bifurcation-demo.html) 1 states (at 02:34) that
> The configuration of the CPU PCI Express bus is statically determined by the BIOS prior to initializaton. The BIOS determines the configuration by looking at the presence detect pins on the CPU, called CFG and CFG.
Presumably this works even if BIOS Setup doesn't include any options to configure bifurcation. But this approach would require accessing and modifying connections to the physical CPU pads, which I'd prefer to avoid.
Other BIOSes that do include options to configure bifurcation apparently override CFG and CFG. I have found no documentation as to how they do this, and would be grateful for any links you may be aware of.
At this point I wonder: Is there a way to override CFG and CFG after the machine has booted to Linux? (I realize I probably won't be able to boot from one of the M.2 drives in this case, but that's not a requirement for this system.) I'd expect such a procedure may involve steps like [hot-resetting](https://unix.stackexchange.com/questions/73908/how-to-reset-cycle-power-to-a-pcie-device/474378#474378) the x16, x8 and x4 PCIe controllers and/or function-level-resetting PEG Root Ports 10, 11 & 12. (Ref: [Intel Xeon E3-1200V5 datasheet Vol 2](https://web.archive.org/web/20201020235947/https://www.intel.com/content/www/us/en/processors/xeon/xeon-e3-1200v5-vol-2-datasheet.html).) Maybe followed by [kexec](https://en.wikipedia.org/wiki/Kexec) ?
Many thanks for any hints, tips or pointers you can provide!
--------------
Editors note:
1 As of August 2025 the original _Configure PCI-Express\* Lanes for Simultaneous Applications_ Intel link is dead and the archived versions I found no longer play the embedded video. The 1st link has been changed to an archived version.
fmyhr
(311 rep)
Dec 9, 2019, 01:43 PM
• Last activity: Aug 5, 2025, 12:42 PM
0
votes
0
answers
18
views
Implement the Driver For Bluetooth Device
I have a HP mouse. Recently, I have been practicing implementing the device driver. Instead of using the hid-generic driver, I would like to use my customized driver for the Bluetooth device. I don't have any ideas about how to implement it in another way for this character device. My idea is kind o...
I have a HP mouse.
Recently, I have been practicing implementing the device driver.
Instead of using the hid-generic driver, I would like to use my customized driver for the Bluetooth device.
I don't have any ideas about how to implement it in another way for this character device.
My idea is kind of similar to my previous implementation on the USB driver by using the USB API instead of the hid-usb static driver.
I am wondering if there is any API or subsystem category related to Bluetooth that I can use to implement a driver for the mouse.
Or I am wondering if there are any better ideas or designs about this.
Wen
(11 rep)
Aug 5, 2025, 09:26 AM
3
votes
2
answers
3203
views
change linux text console scrolling speed - without rebooting
Is there any way to change to the text console scrolling speed without rebooting? Currently using Fedora, but non-distribution-specific answers appreciated. https://www.kernel.org/doc/Documentation/fb/vesafb.txt I'd like to use 'ywrap' in the above documented kernel parameters for vesafb without hav...
Is there any way to change to the text console scrolling speed without rebooting? Currently using Fedora, but non-distribution-specific answers appreciated.
https://www.kernel.org/doc/Documentation/fb/vesafb.txt
I'd like to use 'ywrap' in the above documented kernel parameters for vesafb without having to reboot the kernel to try it.
Juan
(914 rep)
Jan 24, 2015, 02:12 AM
• Last activity: Aug 5, 2025, 01:06 AM
7
votes
1
answers
3461
views
How to run start up scripts on Amazon linux?
I'm trying to create some script that should run on start. Now I've created some myScript file under the /etc/init.d/ and then run `sudo chkconfig --add myScript;` `chkconfig --list myScript` output is: myScript 0:off 1:off 2:on 3:on 4:on 5:on 6:off **myScript:** #!/bin/sh # chkconfig: 2345 98 02 #...
I'm trying to create some script that should run on start.
Now I've created some myScript file under the /etc/init.d/
and then run
myScript 0:off 1:off 2:on 3:on 4:on 5:on 6:off **myScript:** #!/bin/sh # chkconfig: 2345 98 02 # description: # processname: # Source function library. if [ -f /etc/init.d/functions ] ; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions else exit 0 fi KIND="_" start() { echo starting
N 3 Need some help.
sudo chkconfig --add myScript;
chkconfig --list myScript
output is:myScript 0:off 1:off 2:on 3:on 4:on 5:on 6:off **myScript:** #!/bin/sh # chkconfig: 2345 98 02 # description: # processname: # Source function library. if [ -f /etc/init.d/functions ] ; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions else exit 0 fi KIND="_" start() { echo starting
date
>> ~/myScript.log
}
stop() {
echo stopping myScript
}
restart() {
echo restarting
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
Now I can successfully run service myScript start
and log record will be appended.
But if I run sudo reboot
or restart the instance with AWS UI console it doesn't work as was expected.
Although runlevel
output is:N 3 Need some help.
Silk0vsky
(213 rep)
Nov 15, 2016, 11:19 AM
• Last activity: Aug 4, 2025, 09:09 PM
3
votes
6
answers
457
views
Awk prints only first word on the field column
Please see my linux bash script below. I can't achieve my target output with my current code. It keeps reading the whole column 4. input_file.txt: REV NUM |SVN PATH | FILE NAME |DOWNLOAD OPTIONS 1336 |svn/Repo/PROD | test2.txt |PROGRAM APPLICATION_SHORT_NAME="SQLGL" | 1334 |svn/Repo/PROD | test.txt...
Please see my linux bash script below. I can't achieve my target output with my current code. It keeps reading the whole column 4.
input_file.txt:
REV NUM |SVN PATH | FILE NAME |DOWNLOAD OPTIONS
1336 |svn/Repo/PROD | test2.txt |PROGRAM APPLICATION_SHORT_NAME="SQLGL" |
1334 |svn/Repo/PROD | test.txt |REQUEST_GROUP REQUEST_GROUP_NAME="Program Request Group" APPLICATION_SHORT_NAME="SQLGL" |
my code:
# /bin/bash
REV_NUM=($(awk -F "|" 'NR>1 {print $1}' input_file.txt))
COMPONENT=($(awk -F "|" 'NR>1 {print $3}' input_file.txt))
DL_OPS="$(awk -F "|" 'NR>1 {print $4}' input_file.txt)"
#LOOP
REV_NUM_COUNT=${#REV_NUM[*]}
for (( x=0 ; x<$REV_NUM_COUNT ; x++ ))
do
echo "${COMPONENT[x]} ${DL_OPS[x]}"
done
actual output:
Exporting Component from SVN . . .
test2.txt PROGRAM APPLICATION_SHORT_NAME="SQLGL"
REQUEST_GROUP REQUEST_GROUP_NAME="Program Request Group" APPLICATION_SHORT_NAME="SQLGL"
test.txt
target output:
Exporting Component from SVN . . .
test2.txt PROGRAM APPLICATION_SHORT_NAME="SQLGL"
test.txt REQUEST_GROUP REQUEST_GROUP_NAME="Program Request Group" APPLICATION_SHORT_NAME="SQLGL"
Thank you so much
user765641
(33 rep)
Aug 4, 2025, 02:53 AM
• Last activity: Aug 4, 2025, 07:20 PM
5
votes
1
answers
257
views
How to create partitions on a volume with the root filesystem mounted on the enitre disk
I have a server with the root filesystem `/` mounted on `/dev/sda`, i.e., the entire disk, which has no partitions. This situation makes me uncomfortable, and I would like to partition the disk and put the root filesystem on `/dev/sda1`. I'm not sure if this is possible though, without losing my ent...
I have a server with the root filesystem
/
mounted on /dev/sda
, i.e., the entire disk, which has no partitions. This situation makes me uncomfortable, and I would like to partition the disk and put the root filesystem on /dev/sda1
.
I'm not sure if this is possible though, without losing my entire server, since this is the root filesystem. If I run fdisk /dev/sda
, it lets me create the partition /dev/sda1
over the entire disk, but I'm afraid that this will wipe the disk, so I haven't proceeded with that.
Is there a way to move /
from /dev/sda
to /dev/sda1
without losing everything?
Here's fdisk -l
, edited to remove loop devices:
Disk /dev/sda: 117.19 GiB, 125829120000 bytes, 245760000 sectors
Disk model: QEMU HARDDISK
Disk /dev/sdb: 1000 MiB, 1048576000 bytes, 2048000 sectors
Disk model: QEMU HARDDISK
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 2047999 2045952 999M 82 Linux swap / Solaris
Disk /dev/sdc: 160 GiB, 171798691840 bytes, 335544320 sectors
Disk model: Volume
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 335544319 335542272 160G 83 Linux
Dave_G
(61 rep)
Aug 3, 2025, 10:17 PM
• Last activity: Aug 4, 2025, 02:33 AM
4
votes
3
answers
5428
views
Cannot boot into Linux off live USB
I am trying to dual boot Linux on my laptop (Dell XPS 15) which is running Windows 10 Pro. I did not have any problem dual booting the two operating systems on my desktop. I cannot boot up **ANY** Linux Distro, I have tried Mint, Ubuntu and Elementary OS. Whenever I try to boot from a live USB, I ge...
I am trying to dual boot Linux on my laptop (Dell XPS 15) which is running Windows 10 Pro. I did not have any problem dual booting the two operating systems on my desktop.
I cannot boot up **ANY** Linux Distro, I have tried Mint, Ubuntu and Elementary OS. Whenever I try to boot from a live USB, I get the this message on all attempts:
**GNU GRUB version 2.02~beta2-9ubuntu1**
**Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists are possible device or file completions.**
**grub>**
When I type in "boot" I get the error: **you need to load the kernel first.**
Secure boot is disabled, and I have tried both in legacy and UEFI BIOS mode. I have never come across this error before, what causes it?
HuntressMain
(161 rep)
Aug 25, 2015, 10:02 AM
• Last activity: Aug 3, 2025, 05:31 PM
0
votes
1
answers
4323
views
Can I Install Termux on Linux?
We can install a Linux sub-system like CentOS or Ubuntu on Termux, but is it possible to have a Termux-like sub-system on Linux? In Termux the installations of some packages are much easier with *pkg install*. And Termux provides many resources that cannot be obtained directly using one line of code...
We can install a Linux sub-system like CentOS or Ubuntu on Termux, but is it possible to have a Termux-like sub-system on Linux?
In Termux the installations of some packages are much easier with *pkg install*. And Termux provides many resources that cannot be obtained directly using one line of code on pure Linux.
I came up with this idea when I was learning Termux on my phone and found the limited screen and soft keyboard really troublesome.
(don't tell me that I need an Android emulator or virtual machine)
Jiakai Jiang
(1 rep)
Sep 27, 2021, 01:15 PM
• Last activity: Aug 3, 2025, 03:00 AM
7
votes
2
answers
466
views
Btrfs read-only file system and corruption errors
# Goal I am trying to figure out why my file system has become read-only so I can address any potential hardware or security issues (main concern) and maybe fix the issue without having to reinstall everything and migrate my files from backup (I might lose some data but probably not much). According...
# Goal
I am trying to figure out why my file system has become read-only so I can address any potential hardware or security issues (main concern) and maybe fix the issue without having to reinstall everything and migrate my files from backup (I might lose some data but probably not much).
According to the manual of
sudo btrfs check /dev/mapper/luks-7215db73-54d1-437e-875d-f82fae508b5d" class="img-fluid rounded" style="max-width: 100%; height: auto; margin: 10px 0;" loading="lazy">
**Some of these files may be in the
sudo btrfs fi usage /" class="img-fluid rounded" style="max-width: 100%; height: auto; margin: 10px 0;" loading="lazy">
**I think that
vi /etc/fstab" class="img-fluid rounded" style="max-width: 100%; height: auto; margin: 10px 0;" loading="lazy">
sudo dmesg | grep -i “btrfs”" class="img-fluid rounded" style="max-width: 100%; height: auto; margin: 10px 0;" loading="lazy">
The file system is indeed unstable. Once, I wasn’t able to list any files in my
btrfs check
:
> Do not use --repair unless you are advised to do so by a developer or an experienced user, and then only after having accepted that no fsck successfully repair all types of filesystem corruption. Eg. some other software or hardware bugs can fatally damage a volume.
I am thinking of trying the --repair
option or btrfs scrub
but want input from a more experienced user.
# What I’ve tried
I first noticed a read-only file system when trying to update my system in the terminal. I was told:
Cannot open log file: (30) - Read-only file system [/var/log/dnf5. log]
I have run basic checks (using at least 3 different programs) of my SSD without anything obviously wrong. The SSD and everything else in my computer is about 6 and a half years old, so maybe something is failing. Here is the SMART Data section of the output from sudo smartctl -a /dev/nvme0n1
:
=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
SMART/Health Information (NVMe Log 0x02, NSID 0x1)
Critical Warning: 0x00
Temperature: 31 Celsius
Available Spare: 100%
Available Spare Threshold: 10%
Percentage Used: 1%
Data Units Read: 33,860,547 [17.3 TB]
Data Units Written: 31,419,841 [16.0 TB]
Host Read Commands: 365,150,063
Host Write Commands: 460,825,882
Controller Busy Time: 1,664
Power Cycles: 8,158
Power On Hours: 1,896
Unsafe Shutdowns: 407
Media and Data Integrity Errors: 0
Error Information Log Entries: 4,286
Warning Comp. Temperature Time: 0
Critical Comp. Temperature Time: 0
Temperature Sensor 1: 31 Celsius
Temperature Sensor 2: 30 Celsius
Error Information (NVMe Log 0x01, 16 of 64 entries)
No Errors Logged
Self-test Log (NVMe Log 0x06, NSID Oxffffffff)
Self-test status: No self-test in progress
No Self-tests Logged
I tried the following I think from a live disk sudo mount -o remount,rw /mount/point
but that output an error such as, cannot complete read-only system
.
sudo btrfs device stats /home
**and** sudo btrfs device stats /
outputs:
[/dev/mapper/luks-7215db73-54d1-437e-875d-f82fae508b5d].write_io_errs 0
[/dev/mapper/luks-7215db73-54d1-437e-875d-f82fae508b5d].read_io_errs 0
[/dev/mapper/luks-7215db73-54d1-437e-875d-f82fae508b5d].flush_io_errs 0
[/dev/mapper/luks-7215db73-54d1-437e-875d-f82fae508b5d].corruption_errs 14
[/dev/mapper/luks-7215db73-54d1-437e-875d-f82fae508b5d].generation_errs 0
**This seems to suggest that corruption is only in the /home directory.**
**However, sudo btrfs check /dev/mapper/luks-7215db73-54d1-437e-875d-f82fae508b5d
stops at [5/8] checking fs roots
with the end of the output at the top of this image:**

/
directory, but I’m not sure without looking into further.**
sudo btrfs fi usage /
provides:

Data,single
, Metadata,DUP
, and System,DUP
might be saying I can repair the corruption if it’s only in metadata or system but not if it’s the actual file data. Might be something to explore more.**
Here is vi /etc/fstab
:

sudo dmesg | grep -i “btrfs”
states:

/home
directory, but I haven't run into this issue again across several reboots.
# What I think might be causing this
I suspect that changing my username, hostname, and display name (shown on the login screen) recently may have caused problems because my file system became read-only about a week to a week and a half after doing so. I followed some tutorials online, but I noticed that many of my files still had the group and possibly user belonging to the old username. So I created a symbolic link at the top of my home directory pointing the old username to the new one, and it seemed like everything was fine until the read-only issue. There may have been more I did, but I don’t remember exactly as it’s been a few weeks now. I have a history of most or all of the commands I ran if it might be helpful.
I think it may be something hardware related, something I did, software bugs (maybe introduced by a recent update — I have a picture of packages affected in my most recent dnf upgrade
transaction, but I was unable to rollback or undo the upgrade because of the read-only file system), improper shutdowns (may have done this while making changes to the username, hostname, and display name), or a security issue.
Growing My Roots
(351 rep)
Aug 1, 2025, 10:38 PM
• Last activity: Aug 3, 2025, 02:37 AM
1
votes
2
answers
1850
views
Filter out command line options before passing to a program
I am running `cmake` and it is passing a flag to my linker that is unrecognized (`-rdynamic`), and it's causing an error. I cannot figure out where it is getting this flag from, so I want to just filter it out. I can specify `-DCMAKE_LINKER= `, so what I would like to do is set ` ` to a program that...
I am running
cmake
and it is passing a flag to my linker that is unrecognized (-rdynamic
), and it's causing an error.
I cannot figure out where it is getting this flag from, so I want to just filter it out.
I can specify -DCMAKE_LINKER=
, so what I would like to do is set `` to a program that reads its command line arguments, filters out the bad one, and then passes the result back to the actual linker.
I have been using awk '{gsub("-rdynamic", "");print}'
, but I don't know to make the input stdin and the output ld.
RJTK
(123 rep)
Oct 5, 2018, 03:48 PM
• Last activity: Aug 3, 2025, 12:34 AM
1
votes
1
answers
12221
views
extundelete - How to solve 'Block bitmap checksum does not match bitmap when trying to examine filesystem'?
The OS is Ubuntu 17.10 and I've been trying to recover(undelete) with extundelete. (The File System is ext4.) [![enter image description here][1]][1] [1]: https://i.sstatic.net/sBg5w.png This didn't work. So, I tried with extundelete /dev/mapper/ubuntu--vg-root --restore-file /home/chan/origol/route...
The OS is Ubuntu 17.10 and I've been trying to recover(undelete) with extundelete.
(The File System is ext4.)
This didn't work. So, I tried with
extundelete /dev/mapper/ubuntu--vg-root --restore-file /home/chan/origol/routes/user.js
And It worked.
However, I got another problem.
Loading filesystem metadata ... extundelete: Block bitmap checksum does not match bitmap when trying to examine filesystem
I couldn't find any information about it. How can I solve this problem?

Chanjung Kim
(111 rep)
Jul 10, 2018, 05:25 PM
• Last activity: Aug 2, 2025, 11:00 PM
1
votes
1
answers
2062
views
Compiling the Linux kernel and booting with UEFI
I recently compiled and installed a Linux kernel on my Kubuntu computer. The way I did this was, I downloaded the source .tar.gz from kernel.org, extracted it and used the following commands (running in the top directory of the source package) to compile and install it: make oldconfig make -j4 sudo...
I recently compiled and installed a Linux kernel on my Kubuntu computer. The way I did this was, I downloaded the source .tar.gz from kernel.org, extracted it and used the following commands (running in the top directory of the source package) to compile and install it:
make oldconfig
make -j4
sudo make modules_install
sudo make install
When I rebooted, however, I got a message saying "Error: out of memory" and when I pressed a key to continue it gave a kernel panic screen saying "not syncing: VFS: Unable to mount root fs on unknown-block(0,0)".
My other kernels work fine, so I can still boot up normally. But I'm curious to know why that kernel doesn't work and what I can do to get it working.
I tried this with a few versions (5.9.12, 5.9.14 and 5.10.2) and got the same result, so the exact version doesn't seem to be the issue here. But I know that I used to compile kernels like this all the time and they ran without issues. So I tried a bunch of stuff and eventually figured out that UEFI appears to be the culprit. This same kernel will work if I install it on a legacy system. Secure boot is disabled on the (UEFI) PC in question, so I figure it can't have to do with secure boot keys. It seems to be something about UEFI, but not secure boot, that breaks it.
However, upon searching the internet I couldn't find anything on getting a compiled Linux kernel to boot with UEFI. So is there really some additional thing I must do? Or is the problem something else?
**Edit:** I don't understand why my question was closed. But in case it requires more clarification, I am asking as follows: If I download the linux kernel source code from kernel.org or the code from which the Ubuntu kernels are built from here (https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10.4/) and compile it using the commands above, I find that it will boot fine in BIOS but not UEFI. My question is why.
Isaac D. Cohen
(243 rep)
Dec 28, 2020, 02:32 AM
• Last activity: Aug 2, 2025, 03:10 AM
2
votes
0
answers
18
views
cgroup / cpu scheduler tuning questions, cpu pressure & uclamp behavior
I've been working on this for a few days and I'm scratching my head. The kernel docs for cgroups, pressure stall information, and the scheduler have not helped me shed any light on this so far, so I am hoping you can help. I have 3 related processes which run in their own cgroup. It is a root partit...
I've been working on this for a few days and I'm scratching my head. The kernel docs for cgroups, pressure stall information, and the scheduler have not helped me shed any light on this so far, so I am hoping you can help.
I have 3 related processes which run in their own cgroup. It is a root partition and the only partition which may use cpus 3-10. One application runs on CPU 11 and all other processes run on cpus 0-2.
$ cat cpuset.cpus.effective
3-10
Aside from the cpuset the other cgroup properties are currently defaults. It's just using the normal SCHED_OTHER
scheduler class right now.
$ for PROC in $(cat cgroup.procs); do chrt -p $PROC; done
pid 16049's current scheduling policy: SCHED_OTHER
pid 16049's current scheduling priority: 0
pid 16058's current scheduling policy: SCHED_OTHER
pid 16058's current scheduling priority: 0
pid 16059's current scheduling policy: SCHED_OTHER
pid 16059's current scheduling priority: 0
The cgroup is never getting throttled
$ cat cpu.stat
usage_usec 1724410414
user_usec 737614077
system_usec 986796337
nr_periods 0
nr_throttled 0
throttled_usec 0
Yet somehow cpu.pressure
is full ~1% of the time
$ cat cpu.pressure
some avg10=6.85 avg60=5.87 avg300=3.98 total=45578161
full avg10=1.00 avg60=0.73 avg300=0.27 total=9479354
If I change cpu.uclamp.min
to max
* full drops to 0%
* some drops to ~3%
* the main application in the group's CPU usage drops from ~156% to ~100%
* average CPU utilization drops (see graph below, where it drops is when I set cpu.uclamp.min to max)

$ cat cpu.pressure
some avg10=6.85 avg60=5.87 avg300=3.98 total=45578161
full avg10=1.00 avg60=0.73 avg300=0.27 total=9479354
$ echo max > cpu.uclamp.min
# wait a lil bit
$ cat cpu.pressure
some avg10=3.00 avg60=3.18 avg300=4.09 total=61530804
full avg10=0.00 avg60=0.06 avg300=0.32 total=12734850
No CPU core is ever fully loaded in either case, and it isn't being throttled, so I'm really confused how CPU pressure can ever have a nonzero value for full - wouldn't that mean there are CPU cores sitting idle while threads are not being scheduled?
# with cpu.uclamp.min = 0
CPU [22%@1971,16%@1971,17%@1971,4%@1971,39%@729,38%@729,40%@729,36%@729,36%@729,37%@729,37%@729,10%@729]
# with cpu.uclamp.min = max
CPU [26%@729,14%@1971,21%@729,2%@1971,29%@806,26%@1971,26%@1971,27%@1971,20%@729,25%@729,25%@729,7%@727]
I am assuming that setting the minimum uclamp value is causing the scheduler to prioritize scheduling this cgroups threads but given that the group has exclusive access to the cores it is running on, and no core in the system is fully utilized, I'm struggling to understand the exact mechanism at play here.
There's no memory or io pressure system wide with either cpu.uclamp.min
setting. The system has 47 GiB of free memory, ~5 GiB in use, and ~1.5 Gib as caches.
1. How can I have CPU pressure when none of my CPUs are full, and there's no memory or io pressure?
2. Why does changing the uclamp.min
value result in lower CPU usage when the system has excess CPU, memory, and IO resources available?
* especially since no other process is allowed to use those cores either way
3. Are there other scheduler classes or settings I can use to tune the performance so that my processes aren't waiting for CPU while my cores sit idle?
4. Any other ways I can debug what the bottleneck is?
Edit:
Additional details - I'm running 5.15.148
kernel on aarch64 using a (customized) poky based yocto image.
tbot
(21 rep)
Aug 1, 2025, 07:52 PM
• Last activity: Aug 1, 2025, 07:56 PM
Showing page 1 of 20 total questions