Tuesday, May 31, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


You to know how many sectors to load from in the boot loader

Posted: 31 May 2022 05:08 PM PDT

So I was exploring how boot loaders works and I came across one question that I can't seem to find any answer. How does the boot loader knows exactly how many sectors it has to read to load the whole kernel ?

I'm writing a boot loader and it's a pain in the ass to have to manually change how many sectors to read by calculating the exact amount of sectors. Surely there is a way to automate this process but I don't know how. I heard about filesystems, BPB and BDB and I get confused about all of those things. I truly want to know how the whole process works. Fat12 is a simple filesystem but what happens if the kernel is too big for a floppy disk ?

Any explanation would be welcome.

Only apply neovim rule to one folder

Posted: 31 May 2022 04:51 PM PDT

I have a notes folder that is also a git repo with an autocmd in my init.vim set to auto-commit to the repo every time the file gets saved. This behavior is undesirable in git repo folders with actual code, so I was wondering how to selectively apply the rule to only one folder.

how can i append this command to add the hostname next to the IP Address within python

Posted: 31 May 2022 04:15 PM PDT

how can i append this command to add the hostname next to the IP Address I have the majority of the detail that I want so far,however it would be great if the IP Address was to resolve to its hostname.

***# Import modules  import subprocess  import ipaddress  # Prompt the user to input a network address  net4 = input("Enter a network address in CIDR format(ex.192.168.1.0/24): ")  # Create the network  ip_net = ipaddress.ip_network(net4)  # Get all hosts on that network  all_hosts = list(ip_net.hosts())  # Configure subprocess to hide the console window  info = subprocess.STARTUPINFO()  info.dwFlags |= subprocess.STARTF_USESHOWWINDOW  info.wShowWindow = subprocess.SW_HIDE  # For each IP address in the subnet,   # run the ping command with subprocess.popen interface  for i in range(len(all_hosts)):  output = subprocess.Popen(['ping', '-n', '1', '-w', '500', str(all_hosts[i])],   stdout=subprocess.PIPE, startupinfo=info).communicate()[0]      if "Destination host unreachable" in output.decode('utf-8'):       print(str(all_hosts[i]), "is Offline")   elif "Request timed out" in output.decode('utf-8'):       print(str(all_hosts[i]), "is Offline")   else:       print(str(all_hosts[i]), "is Online")***  

zsh: tab rotates between directories, what key to select and enter one?

Posted: 31 May 2022 03:40 PM PDT

I am trying to complete path within a directory tree. When I press tab at any directory level, completion rotates among all possible directory completions. Is there a way to bind a key to "select" & enter a directory to then hit tab again and complete the files/directories in that folder?

`unexpected end of file` after a while loop

Posted: 31 May 2022 03:44 PM PDT

The entirety of my Openbox autostart file is as follows:

# Compositor  picom &    # Korean input  ibus-daemon -dr &    # Screensaver  xscreensaver -no-splash &    # Wallpaper  while true; do      nitrogen --random --set-auto      sleep 3600  end  

But when I login, it appears as though only picom was run successfully.

Running bash ~/.config/openbox/autostart from a terminal indicates

/home/max/.config/openbox/autostart: line 33: syntax error: unexpected end of file  

so I think something is wrong with my while loop, but what?

Unable to print in Firefox on Debian

Posted: 31 May 2022 04:13 PM PDT

Here is what I have done on my env.:

# Install the driver with the deb file  sudo dpkg -i --force-all brscan4–0.4.10-1.amd64.deb  # Verify that the driver was correctly installed  dpkg -l | grep Brother  # Find all the devices on your network that have the open ports 9100, 515, 631  # The device that has those open ports (and might have the name: (Hon Hai Precision Ind.)) should be your printer/scanner  sudo nmap -p 9100,515,631 192.168.0.0/24  # Setup your printer on your system  brsaneconfig4 -a name=DCP-L2550DW model=DCP-L2550DW ip=192.168.0.0  # Verify that it is set up correctly  brsaneconfig4 -q | grep DCP-L2550DW  

Here is the evidence that the printer is registered properly:

* DCP-L2550DW  [  192.168.0.109]  DCP-L2550DW  

I am able to scan documents with gscan2pdf (printer/scanner). But I am unable to print with Firefox. All I see when I try to print is to export the page into a PDF format.

Is there something I am missing?

More details:

  • uname -r 4.19.0-20-amd64
  • lsb_release -a
     No LSB modules are available.       Distributor ID: Debian       Description:    Debian GNU/Linux 10 (buster)       Release:        10       Codename:       buster  

How to sync fingerprint login across Windows 11 and Linux Mint 20

Posted: 31 May 2022 03:31 PM PDT

I am a novice and I am trying to sync my fingerprints across Windows 11 and Linux Mint on a dual boot Lenovo T480. GitHub suggests an edit to the "/etc/python-validity/dbus-service.yaml" file, which is read only. I have attempted to edit the file with text editor without success. Any suggestions on how to do this?

CONFIG_SOMETHING on vendor/phone_defconfig won't work, have to pass them on `make`

Posted: 31 May 2022 02:52 PM PDT

On https://github.com/MoonBase-Project/MSM-4.19-MiBengal/ I had to do

make CONFIG_HAVE_KVM=y CONFIG_KVM=y CONFIG_KVM_ARM_HOST=y O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- vendor/citrus-perf_defconfig  make CONFIG_HAVE_KVM=y CONFIG_KVM=y CONFIG_KVM_ARM_HOST=y O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- -j$(nproc --all) 2>&1 | tee kernel.log  

because putting

CONFIG_HAVE_KVM=y   CONFIG_KVM=y   CONFIG_KVM_ARM_HOST=y  

on vendor/citrus-perf_defconfig wouldn't work no matter what I tried. The .config generated from it wouldn't have the KVM configs.

Also I tried to print:

$(info ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KVM)  $(info $$CONFIG_KVM_ARM_HOST is [${CONFIG_KVM_ARM_HOST}])  

but it was empty, except when passed on make

What is happening?

Backup created with rsync takes up more space on external drive than on source

Posted: 31 May 2022 02:24 PM PDT

I am using rsync to make a backup of Ubuntu running on a Raspberry Pi. I exclude all the usual directories whose contents are only created after boot up anyway.

The rsync writes to a backup image that I partition format and loop device mount and that image is written to an attached external USB drive. The data on the USB storage drive takes up a lot more space compared with the space it occupies on the source SD Card .. about 5325MB vs 3881MB.

Trying to Debug
I ran this rsync command to double check if some mysterious extra files were being created on the destination that are not on the source or were the same files getting bigger when they were on the destination compared with them on the source:

sudo rsync -nrlpgoDv --delete --exclude-from='/home/ubuntu/exclude-list.txt' / /mnt/dst_root/

But I don't see any big differences between the source and destination in terms of numbers of files or the size they occupy in source vs destination.

My Question
Why is this? Is it something to do with the Sector size?

Using fdisk -l my source Ubuntu OS has:

Disk /dev/mmcblk0: 29.54 GiB, 31719424000 bytes, 61952000 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  Disklabel type: dos  Disk identifier: 0x12345678    Device         Boot  Start      End  Sectors  Size Id Type  /dev/mmcblk0p1 *      2048   526335   524288  256M  c W95 FAT32 (LBA)  /dev/mmcblk0p2      526336 61951966 61425631 29.3G 83 Linux  

I write the backup to an image file on the external storage drive. I partitioned the backup image like this:

echo "label: dos" | sfdisk "${IMGFILE}" > /dev/null      sfdisk "${IMGFILE}" <<EOF > /dev/null  ,256MiB,c  ,+,83  EOF  

I then format the root partition of that backup image file in a script like this:
mkfs.ext4 -q -b 4096 "${LOOP}p2" > /dev/null

Now fdisk on that loop device attached backup image gives:

Disk /dev/loop6: 5.62 GiB, 6035603456 bytes, 11788288 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  Disklabel type: dos  Disk identifier: 0x12345678    Device       Boot  Start      End  Sectors  Size Id Type  /dev/loop6p1        2048   526335   524288  256M  c W95 FAT32 (LBA)  /dev/loop6p2      526336 11788287 11261952  5.4G 83 Linux  

fdisk -l on that external storage drive that the backup image is saved to:

Disk /dev/sda: 3.64 TiB, 4000752599040 bytes, 7813969920 sectors  Disk model: My Passport 2627  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 4096 bytes  I/O size (minimum/optimal): 4096 bytes / 4096 bytes  Disklabel type: gpt  Disk identifier: B5B6FD62-945C-466D-7T49-YU5D4RRE7087    Device     Start        End    Sectors  Size Type  /dev/sda1   2048 7813967871 7813965824  3.6T Linux filesystem  

Is the data taking up more space on the USB drive because of differences in Sector Size vs I/O size maybe?

Separately my backup script tries to shrink down the root file system on the backup image using resize2fs (after the file system is unmounted). There are no errors but resize2fs does a really bad job of eliminating the free space in the backed up root file system. It never eliminates all the empty space and sometimes removes no empty space. Maybe this is also related to the sector size?

Update

After some investigation I think the issue might be related to - snap. It is installed in my Ubuntu system. From reading it looks like snap applications are stored in compressed squashfs file systems. Maybe when I rsync those they take up more space in the destination ext4 file system?

Any advice much appreciated!

Unable to play videos in browsers on Fedora 35

Posted: 31 May 2022 02:09 PM PDT

I upgraded from Fedora 32 to Fedora 35 in last December. Lately I have found out that I am unable to play any videos on web browsers. The video loads but never starts. It's stuck at 00:00. If I move the video forward on the slider, the video skips to the correct frame, but still just sticks there. I get the message "If playback doesn't begin shortly, try restarting you device." in the browser. This happens at least on Firefox, Chrome and Midori.

Rebooting the system makes the problem go away, but it comes back shortly afterwards.

Playing locally stored MP4 files from my own filesystem on VLC is working OK.

What could be the reason for this?

When using fedy to install pulseaudio-module-bluetooth-freeworld-1.4-8.fc35.x86_64 this error shows up: Error: Problem: problem with installed package pulseaudio-module-bluetooth-freeworld-1.4-8.fc35.x86_64 - package pulseaudio-module-bluetooth-freeworld-1.4-8.fc35.x86_64 conflicts with pulseaudio-module-bluetooth < 15.0-100 provided by pipewire-pulseaudio-0.3.38-1.fc35.x86_64. I tried "sudo dnf remove pulseaudio" but it told me that this would also remove gnome-shells. How would I go about resolving the conflict?

How do you prevent uas and usb_storage kernel modules from being automatically loaded when a USB flash drive is connected?

Posted: 31 May 2022 02:08 PM PDT

I generate a kernel Image using buildroot that I put onto an SD card to boot from. In buildroot I modularized USB Mass Storage. When I boot up my board without a USB connected to it I can see that no modules are running by using lsmos. But the instant I plug my USB in, the modules uas and usb_storage automatically load and allow access to the USB. I want to prevent this and only allow access to the USB if I manually load in those two modules.

I have read a few articles online about blacklisting the modules or editing files related to the modules; however, this doesn't work because any changes I make are erased when I power off. So I need another option that is permanent, perhaps done in the buildroot settings prior to generating the Image?

High IO load by [md0_raid1]

Posted: 31 May 2022 05:07 PM PDT

I'm experiencing a 99% IO load caused by [md0_raid1] process every 20-30 seconds. That 99% IO is very short-term, about 1-2 seconds, but it causes lag for other processes due to io wait (it's very harmful for gaming server). Is this normal behaviour? How can I avoid these high IO lags? I would be grateful for any advice.

I have SW RAID 1 (Ext4) on new Linux Debian 9.3 server, I run apache/mysql webserver and several Minecraft servers.

iotop:

Total DISK READ :       0.00 B/s | Total DISK WRITE :      15.30 K/s  Actual DISK READ:       0.00 B/s | Actual DISK WRITE:        0.0 B/s    TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND    199 be/4 root        0.00 B/s    0.00 B/s  0.00 % 99.99 % [md0_raid1]  45302 be/4 root        0.00 B/s    3.82 K/s  0.00 %  0.00 % java -Xms~spigot.jar  51303 be/4 root        0.00 B/s    3.82 K/s  0.00 %  0.00 % java -Xms~spigot.jar  51306 be/4 root        0.00 B/s    3.82 K/s  0.00 %  0.00 % java -Xms~spigot.jar  51200 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % java -Xmx~ee-private      1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init      2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]      3 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]      5 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/0:0H]  

mdstat:

md1 : active raid1 sda5[0] sdb5[1]      33501184 blocks super 1.2 [2/2] [UU]    md0 : active raid1 sda1[0] sdb1[1]      943111168 blocks super 1.2 [2/2] [UU]      bitmap: 5/8 pages [20KB], 65536KB chunk  

HW specs:

Intel Xeon 1231v3 (3.4 Ghz) 4C/8T 8MB  32 GB DDR3 ECC 1600 MHz  2x SATA 6G 1TB 7.2k (SW RAID 1)  

lspci specs:

https://gist.github.com/FreeWall/98f4bc8029387dbe4d47feacdd37aa85

How to remove newline character within a column in a tsv file?

Posted: 31 May 2022 02:58 PM PDT

enter image description here

I need "This contains newline" in one row, newline from the column2 and column4 need to remove.

nb: For your understanding the data I upload an image if you want I will upload the text content

"column1"   "column2"          "column3"    "column4"           " column5"  "DATA"       "THIS                 "DATA"   "THIS                "DATA"               CONTAIN NEWLINE"                 CONTAIN NEWLINE"    I need to remove the newline and output looks like:  "column1"   "column2"                "column3"  "column4"                " column5"  "DATA"      "THIS CONTAIN NEWLINE"    "DATA"    "THIS CONTAIN NEWLINE"     "DATA"  

User's incrontab not working (only root's) when incrond is run as a service

Posted: 31 May 2022 03:03 PM PDT

Here is my incrontab (tony's incrontab):

/home/tony/Workspace/cocoonr/ui/static/ui/img/icons/vector IN_MODIFY,IN_CREATE,IN_MOVED_TO /bin/sh /home/tony/Workspace/cocoonr/boilerplate/svg2djangohtml $@/$# /home/tony/Workspace/cocoonr/ui/templates/inc/icons/  

I tested it multiple times changing some things, no way to make it work when incrond is run as a service (using openrc).

If I run incrond in foreground (incrond -n), then tony's incrontab works

If I set root's incrontab to the one given above, it works even when run as a service.

My tony is in /etc/incron.allow:

root  tony  

And there is no /etc/incron.deny.

I even tried with a much simpler incrontab:

/tmp/foo IN_ATTRIB touch /tmp/bar  

The results are the same.

How to make user's incrontab working?

/sbin/init does not exist - Bailing out, you are on your own. Good luck

Posted: 31 May 2022 03:24 PM PDT

I'm trying to install arch linux. When I boot up, it gives me the message found below.

ERROR: Root device mounted successfully, but /sbin/init does not exist.  Bailing out, you are on your own now. Good luck.    sh: can't access tty: job control turned off  [rootfs /]# _  

Linux Mint 14.1 with Cinnamon - Mouse Sensitivity not Working

Posted: 31 May 2022 04:05 PM PDT

64-bit if that matters. My mouse sensitivity slider does nothing, but my acceleration slider works. I'd like acceleration off and sensitivity how I like it, but it refuses to work. I have tested the option on two computers, and both do not change the sensitivity. Any help?

No comments:

Post a Comment