Monday, May 3, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


File names changing during googledrive or dropbox sync'ing

Posted: 03 May 2021 10:35 AM PDT

when i copy/paste files or just move them from googledrive cloud their name's change to a long weird senseless sequence of characters. Anyone knows how to fix it?

I am using manjaro.

Thanks

MacOS: Installed openssh via brew, ssh-agent doesn't start by default

Posted: 03 May 2021 10:34 AM PDT

I installed openssh via brew install openssh. I added the following to my .profile:

export SSH_AUTH_SOCK="~/.ssh/agent"  ssh-add -l 2>/dev/null >/dev/null  if [ $? -ge 2 ]; then    ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null  fi  

... which throws the following error:

unix_listener: cannot bind to path ~/.ssh/agent: No such file or directory  

And I still have to execute:

eval "$(ssh-agent)"  

And then do the following:

ssh-add ~/.ssh/id_ecdsa_sk  Enter passphrase for /Users/myuser/.ssh/id_ecdsa_sk:  Identity added: /Users/myuser/.ssh/id_ecdsa_sk  

even though I have the following in my ~/.ssh/config:

Host *      IgnoreUnknown UseKeychain      UseKeychain yes      AddKeysToAgent yes      IdentityFile ~/.ssh/id_ecdsa_sk  

(I had to add the IgnoreUnknown bit b/c the install from brew installs a version that breaks the UseKeychain bit.) But now, I don't know how to wire things up properly...

Help appreciated!

No GUI Program for Network(Both for WiFi and Ethernet) {Ocurred after reinstalling some packages}

Posted: 03 May 2021 10:20 AM PDT

I am using Kali Linux

grep VERSION /etc/os-release                VERSION="2021.1"  VERSION_ID="2021.1"  VERSION_CODENAME="kali-rolling"    uname -v                                    #1 SMP Debian 5.10.28-1kali1 (2021-04-12)    uname -r                                    5.10.0-kali7-amd64  

I accidentally deleted some packages such as dnsmasq-base libndpo libnma-common libnma0 libteamdctlo network-managaer. (since these deleted packages were associated with Network,I was unable to connect internet), But I was able to reinstall it successfully and I was able to reconnect to internet again.But I found that there was no icon of Network(Both WiFi/Ethernet) in task bar,But I was able to connect to internet .( only because it was a saved network) Output of ip aiswlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000. And Ethernet is also working properly , But I can't see available networks and option to switch the available networks, output of service network-manager status is giving Unit network-manager.service could not be found. I don't know why it is giving error,before it used to print current status.

I am assuming from above situation that my I have no Program for Network GUI.

I founded some alternates to connect to unknown-WiFi using terminal, But it's very difficult to connect to wifi (To connect to encrypted WiFi, I would have to manually type the Hexadecimal/ASCII form of the password)

Is there anyway to restore the old Network GUI program, in any ways ?

lastly, I am not using any external adapters.

Network controller: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter  

How to mount a disk/volume only for specific users?

Posted: 03 May 2021 10:27 AM PDT

This is probably a basic question for most of you, but I don't have a good knowledge of this topic (yet). Please forgive my ignorance.

use-case:
I have a small RaspberryPi that I want to use to backup my Mac, using rsync. I got this part working with some test-data.

Now I would like to hide that backup from the normal user by adding a second harddisk, which I only want to be visible to a specific user mac

I used /etc/fstab in the past, but I guess that is for all users, right? Is there a way to only mount that disk for user mac (and potentially also root?) Also, I don't want to modify the file permissions because if I ever have to rsync-back my data, I want the permissions to be exactly as they were before the backup

Any pointers on how to achieve that?
thanks so much
ChrisV

How to open a visible filename in editor from terminal?

Posted: 03 May 2021 09:52 AM PDT

Coming from MacOS iTerm2, I was able to open a file in my editor by clicking (or right click?) on the filename, especially useful in a git diff or when opening a failed unit test.

There must be a way to set this up in default terminal and/or Terminator, Tilix ?

how to diff automatically between file.txt.orig and file.txt

Posted: 03 May 2021 09:24 AM PDT

Currently, I am editing files on vim by setting patchmode=.orig and then, having two files:

  1. file.txt.orig <- backup without changes
  2. file.txt <- update file

However, I would like to generate a diff without having to rename the .orig file, so patch understands it is just file.txt which has been updated.

Ideally I would really enjoy a workflow I could run

diff -u file.txt which would automatically compare file.txt.orig and file.txt and output a .diff containing

--- file.txt    2021-05-03 17:47:12.685416342 +0200  +++ file.txt    2021-05-03 17:47:30.538750593 +0200  @@ -1 +1,2 @@   foo bar  +bar baz  

instead of diff -u file.txt.orig file.txt

--- file.txt.orig   2021-05-03 17:47:12.685416342 +0200  +++ file.txt    2021-05-03 17:47:30.538750593 +0200  @@ -1 +1,2 @@   foo bar  +bar baz  

The above does require me to manually edit the .diff file every time. If using .orig files automatically, would be possible at all, I would love to integrate vim patchmode with diff and have a valid patch without extra effort.

Perhaps there's an even better approach to this? Any suggestions would be appreciated. Both diff or git diff would work for my case.

Delete all files older than X days and all empty folder (linux/bash)

Posted: 03 May 2021 10:41 AM PDT

I am deleting all files recursively with:

$ find . -type f -name "*.*" -daystart -mtime +100 -exec rm -rf {} \;  

Followed by all empty folders with:

$ find . -type d -empty -delete  

since I don't want to delete folders older than e.g. 100 days that might contain files younger than 100 days.

But is there a more clean way to do this or am I misunderstanding something?

file name completion in a subshell stopped working after moving to CentOS 7.6 from 6.*

Posted: 03 May 2021 08:53 AM PDT

Before the switch to the "new" OS I was able to type

(cmd <char><tab>  

and I got filename completion. Now I don't. But I still can do this without the opening parenthesis!

KVM CPU compatibility requirements for live migration on aarch64

Posted: 03 May 2021 08:52 AM PDT

I'm trying to understand the CPU (and possibly kernel) requirements for a successful live migration of a KVM VM (OpenWRT) on aarch64 in order to decide on which SBC I should get as a second host.

My primary host is an ODROID-N2 (Amlogic S922X, 4 x Cortex-A73 + 2 x Cortex-A53) running Arch Linux on a very recent mainline kernel. The machines are managed by libvirt. Due to the heterogeneous architecture on this host I had to pin two Cortex-A53 vCPUs to the two cores that model, otherwise the VM wouldn't start.

I've also got an ODROID-C2 (Amlogic S905, 4 x Cortex-A53), also running Arch Linux. However, when I bought it I overlooked that its cores don't implement the AES crypto extensions. The cores also have a few more differences:

/proc/cpuinfo on ODROID-N2

processor   : 0  BogoMIPS    : 48.00  Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd03  CPU revision    : 4    processor   : 1  BogoMIPS    : 48.00  Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd03  CPU revision    : 4    processor   : 2  BogoMIPS    : 48.00  Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd09  CPU revision    : 2    processor   : 3  BogoMIPS    : 48.00  Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd09  CPU revision    : 2    processor   : 4  BogoMIPS    : 48.00  Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd09  CPU revision    : 2    processor   : 5  BogoMIPS    : 48.00  Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd09  CPU revision    : 2  

/proc/cpuinfo on ODROID-C2:

processor   : 0  BogoMIPS    : 48.00  Features    : fp asimd evtstrm crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd03  CPU revision    : 4    processor   : 1  BogoMIPS    : 48.00  Features    : fp asimd evtstrm crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd03  CPU revision    : 4    processor   : 2  BogoMIPS    : 48.00  Features    : fp asimd evtstrm crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd03  CPU revision    : 4    processor   : 3  BogoMIPS    : 48.00  Features    : fp asimd evtstrm crc32 cpuid  CPU implementer : 0x41  CPU architecture: 8  CPU variant : 0x0  CPU part    : 0xd03  CPU revision    : 4  

The qemu documentation states that (unlike on x86) the CPU model always has to be passed through from the host. (This is why I had to pin the vCPUs: when I didn't do it, qemu/libvirt/the kernel would try to run vCPUs on random cores and fail most of the time, due to that reason.) There are some features that can be toggled (sve128, etc) but those don't map to the missing flags in cpuinfo.

So I can't just deactivate features on one host or emulate them on another. The cores have to be identical.

My question is, how similar do the cores on the hosts have to be?

Would it be enough if Cortex-Axx model + cpuflags are identical on both hosts?

Adding and subtracting multiple columns into new column

Posted: 03 May 2021 10:19 AM PDT

I have copied a partial csv file.

publish_date,headline_text,likes_count,comments_count,shares_count,love_count,wow_count,haha_count,sad_count,thankful_count,angry_count  20030219,aba decides against community broadcasting licence,1106,118,109,155,6,5,2,0,6  20030219,act fire witnesses must be aware of defamation,137,362,67,0,0,0,0,0,0  20030219,a g calls for infrastructure protection summit,357,119,212,0,0,0,0,0,0  20030219,air nz staff in aust strike for pay rise,826,254,105,105,21,45,7,0,90  20030219,air nz strike to affect australian travellers,693,123,153,17,113,4,103,0,7  20030219,ambitious olsson wins triple jump,488,57,161,0,0,0,0,0,0  20030219,antic delighted with record breaking barca,386,60,80,3,4,0,93,0,68  20030219,aussie qualifier stosur wastes four memphis match,751,45,297,0,0,0,0,0,0  20030219,aust addresses un security council over iraq,3847,622,141,1,0,0,0,0,0  20030219,australia is locked into war timetable opp,1330,205,874,0,0,0,0,0,0  20030219,australia to contribute 10 million in aid to iraq,3530,130,0,23,16,4,1,0,0  20030219,barca take record as robson celebrates birthday in,13875,331,484,0,0,0,0,0,0  20030219,bathhouse plans move ahead,11202,450,2576,433,51,20,4,0,34  20030219,big hopes for launceston cycling championship,3988,445,955,0,0,0,0,0,0  20030219,big plan to boost paroo water supplies,460,101,92,0,0,0,0,0,0  20030219,blizzard buries united states in bills,303,223,193,0,0,0,0,0,0  

I would like to find a shell command that will help me able to make a new column that will add up each entries (likes_count+ love_count + thankful_count) - (angry_count + sad_count) and name the column emotional_polarity.

I have tried

awk -F , {$12=$3+$6+$10-$11-$9;}{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12} file  

but it does not work for some reason the columns become mixed together. i think this may be because I am losing the comma when I perform this

tail -1 file1 >> file2 without \n

Posted: 03 May 2021 08:30 AM PDT

it might be simple but after looking around I could not find a way to resolve my issue, I am recovering the last line from file1 using tail -1 file1 and want to add it to an existing file that is a table, so I can fill columns (that are separated by a comma) by doing:

tail -1 file1 >> file2  echo "," >> file2  tail -1 file3 >> file2  echo "," >> file2  ....  

but my issue is that each new entry is done in a new row. how can I prevent this?

best regards

What are the options to create a single volume of multiple different hard drives with redundancy (i.e. heterogeneous RAID)

Posted: 03 May 2021 08:17 AM PDT

I have about 8 hard drives lying around, and enough SATA ports in my main PC (running openSUSE Tumbleweed) to connect them all. Some of the drives are more than 5 years old, and the sizes range from 384GB to 2TB.

I think it'd be a shame to let all that storage space go unused, so I'd like to install and use them, but obviously not as separate volumes. I used to run mdadm RAID5 and RAID6 arrays with older disks, but in this case, that would become tedious (one 8-drive array of 384GB per disk, one 7-drive array with the difference to the next-larger ... and so on). So I've been looking for alternatives.

I've also been running a BTRFS RAID5 array on 4 identical drives for a while now, and given my experience with that (about one full restore per year needed, with some files lost...), and the fact that even the developers don't seem to expect they're going to make it work reliably without users having to stay very alert makes me doubt that BTRFS for a heterogeneous array like this would be a wise choice.

I've heard miracoulous things about ZFS and its RAIDZ feature being able to accommodate different-sized drives with even 3 parity blocks but most of the advice I've been able to find so far only deals with identical drives, or at least identically-sized RAID partitions.

My priority is neither speed nor access times as the machine is only used by me and hard drive throughput is very rarely a concern. My intention is to use the space on those hard drives in relative comfort for the remainder of their lives, and not have to worry about the occasional drive failure costing me data or copious amounts of time. I'd like to have some setup where I can just bundle them all together and if one of the drives fails, I'd remove it and carry on (or maybe add a new one if I need the space).

I don't mind doing some extra up-front configuration as long as I can rest assured that it does not need my personal attention unless a drive breaks, and that it will let me know if/when that happens. Having 2 or 3 drive failures covered would be nice but I'd also be fine if I could use half the capacity (i.e. RAID10-like), as long as I can make use of all the drives, and most of the space on them.

  1. Does something like this exist?
  2. What are the options?
  3. Is there a how-to that explains how to set things up?

Find command question - how to list subdirectories and files under a directory without listing the base directory

Posted: 03 May 2021 09:10 AM PDT

Find command - how to list only subdirectories and files under a directory without listing the base directory, which is passed as a parameter.

Example:

find /abc/def/ghi -mtime +10   

Above command output is also resulting in base directory being listed along with subdirectory and files inside.

/abc/def/ghi   /abc/def/ghi/fff  /abc/def/ghi/abc.txt  

I want output to be just as below.

/abc/def/ghi/fff  /abc/def/ghi/abc.txt  

The reason for this question is - find command output is being used to remove the directory and files recursively. so if the base directory - /abc/def/ghi is not used for 10 days it also gets listed and ultimately gets deleted.

find /abc/def/ghi -mtime +10 -exec rm -rf {} \;  

awk: line 1: syntax error at or near {

Posted: 03 May 2021 09:05 AM PDT

I have been trying to get a maximum and a minimum value in the text file that have a numerical table. In order to do this, I opened up each column in the file using awk function for loop. But I got this error below. I am beginner to use awk, and I cannot find what the problem is. Please help me out!

I got stuck in this problem with:

awk: line 1 : syntax error at or near {  awk: line 1 : syntax error at or near }  awk: line 1 : syntax error at or near {  awk: line 1 : syntax error at or near }  

This is my script:

#!/bin/bash  for i in {1..11}  do      #print minimum value in the text file.      awk -F' ' '{print ${i}}' [filename].txt | sort -n | head -1      #print maximum value in the text file.      awk -F' ' '{print ${i}}' [filename].txt | sort -n | tail -1  done  

Error :“the command '/bin/sh -c source protected-env/bin/activate' returned a non-zero code: 127” while I'm trying to configure my first dockerfile

Posted: 03 May 2021 08:44 AM PDT

I'm trying to learn docker. This is my first experiment. I have written this dockerfile :

FROM nvidia/cudagl:11.3.0-base-ubuntu20.04    LABEL Author="ZioMario"  LABEL Title="Firefox/Docker20.10.6/Ubuntu20.04"    # Enviorment variables    ENV DEBIAN_FRONTEND noninteractive  ENV LC_ALL C.UTF-8  ENV LANG C.UTF-8  ENV PATH "$PATH:/bin/2.82/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"  ENV FIREFOX_PATH "/bin/2.82"  ENV FIREFOXPIP "/bin/2.82/python/bin/pip3"  ENV FIREFOXPY "/bin/2.82/python/bin/python3.7m"  ENV HW="GPU"    # Install dependencies    RUN apt-get update && apt-get install -y \       apt-utils \      wget \       libopenexr-dev \       bzip2 \       build-essential \       zlib1g-dev \       libxmu-dev \       libxi-dev \       libxxf86vm-dev \       libfontconfig1 \       libxrender1 \       libgl1-mesa-glx \       xz-utils \      firefox \      openjdk-8-jre    # Download the Python source    RUN wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz \       && tar -xzf Python-3.7.0.tgz \       && cp -r Python-3.7.0/Include/* $FIREFOX_PATH/python/include/python3.7m/ \       && rm -rf Python-3.7.0.tgz \       && rm -rf Python-3.7.0     # Installing a modern version of numpy    RUN rm -rf ${FIREFOX_PATH}/python/lib/python3.7/site-packages/numpy     # Must first ensurepip to install Firefox pip3 and then new numpy    RUN ${FIREFOXPY} -m venv protected-env    RUN source protected-env/bin/activate    RUN ${FIREFOXPY} -m ensurepip && ${FIREFOXPIP} install --upgrade pip && ${FIREFOXPIP} install numpy  RUN deactivate    # Set the working directory  WORKDIR /  

Unfortunately it does not work. This is the error that I'm getting :

The command '/bin/sh -c source protected-env/bin/activate' returned a non-zero code: 127

the wrong line is this :

RUN source protected-env/bin/activate

Do you have any idea about how to fix it ? thanks.

Prevent pam_mount unmounting if there are other active sessions?

Posted: 03 May 2021 09:30 AM PDT

I use pam_mount to decrypt (gocryptfs) and mount my home directory:

# /etc/pam.d/system-login excerpt  # ...  session [success=2 default=ignore]  pam_exec.so  quiet /usr/bin/mountpoint -q "/home/$PAM_USER"  session [success=1 default=ignore]  pam_succeed_if.so  service = systemd-user quiet  session    optional   pam_mount.so  # ...  
<!-- /etc/security/pam_mount.conf.xml excerpt -->  <!-- ...defaults... -->    <!-- Encrypted home -->  <volume user="%(USER)" fstype="fuse" options="nodev,nosuid,quiet,nonempty,allow_other"      path="/usr/bin/gocryptfs#/home/%(USER).cipher" mountpoint="/home/%(USER)"  />    </pam_mount>  

This works well for a single tty. The problem is if I open another, though my pam_exec line prevents it trying to re-mount, when I exit that second tty, it still unmounts. (Worse, it doesn't even unmount correctly, leaving 'transport endpoint is not connected', and I have to manually fusermount -uz "$HOME". I tried adding <fuseumount>fusermount -uz %(MNTPT)</fuseumount> to the config, but no change.)

How can I prevent pam_mount from unmounting until the last session exits? (If tty1 that created the mount exited before tty2, I would want it to be kept mounted for tty2 even though it skipped mounting it itself.)


In fact, with <debug enable="1" /> it logs:

May 03 15:19:39 hostname login[6607]: (pam_mount.c:441): pmvarrun says login count is 1  May 03 15:19:39 hostname login[6607]: (pam_mount.c:734): username seems to have other remaining open sessions  May 03 15:19:39 hostname login[6607]: (pam_mount.c:743): pam_mount execution complete  

but then the next thing is everything complaining that 'transport endpoint is not connected', and sure enough I have no home dir in the first tty.

I've also noticed if I then fusermount -uz $HOME, it actually ends up mounted, as if pam_mount for the first login session (in which I manually unmount it to fix the error, expecting to have to manually mount it again) is automatically re-mounting it?

Increase Firefox tabs in Plasma 5 on high DPI laptop with small screen

Posted: 03 May 2021 08:19 AM PDT

In order to increase size I have used larger fonts (beside some other settings like toolbar icons size in Dolphin) and a global scale of 112%.

enter image description here

This is how my panel looks for me to be comfortable with it. But Firefox tabs are too small.

enter image description here

The fonts are OK, fallowing the system settings for font size, but tabs and buttons are not ok, global scaling seems to have no effect...

This is on Fedora 34 KDE with Plasma 5.21 - KDE Frameworks 5.80.

Filter the data to generate the outermost points only

Posted: 03 May 2021 09:56 AM PDT

I have the following data, when plotted gives me the following enter image description here

I would like to save and plot only the outermost points with a line plot. Pls do suugest on how to proceed with this and advise on how to filter the data

How to start an X.org desktop session manually?

Posted: 03 May 2021 10:15 AM PDT

For example, I have these sessions: ls -l /usr/share/xsessions/

-rw-r--r-- 1 root root 268 май 20  2017 cinnamon2d.desktop  -rw-r--r-- 1 root root 155 май 20  2017 cinnamon.desktop  -rw-r--r-- 1 root root  86 авг  6  2011 lightdm-xsession.desktop  

A want to disable GUI by sudo systemctl set-default multi-user.target and after that (after reboot) run manually one of my desktops:

How will I do that?

P.S. My Distro:

Operating System: Debian GNU/Linux 9 (stretch)  Kernel: Linux 4.9.0-7-amd64  Architecture: x86-64  

GRUB2 Loading into CLI on reboot instead of bootloader

Posted: 03 May 2021 08:22 AM PDT

I recently did a fresh install of Pop!_os after getting a little brave and wrecking some stuff on accident. I dual boot Windows 10 and Pop on separate drives. Upon restart, GRUB loads into its grub> prompt instead of my boot menu, and I have to use a series of commands to get it to load into the bootloader menu:

grub> set prefix=(hd1,gpt3)/boot/grub  grub> set root=(hd1,gpt3)  grub> insmod linux  grub> insmod normal  grub> normal  

This will throw me into my bootloader menu without a problem, but the change does not persist on the next boot. I do a sudo update-grub every time I get into Pop, to no avail. I'm wondering if there is a config file I can edit or something in order to make these changes persistent, as I'm not a fan of having to issue these commands every time I want to get to my grub menu. The worst part is, I had this exact issue on my previous install, and it annoyed me for weeks, until I eventually got it to work. I cannot remember what I changed for the life of me. I'm not very familiar with the more involved workings of Linux like boot and all that, so I apologize if this is a very obvious stupid question. Thank you!

Unable to rename files in samba share

Posted: 03 May 2021 10:08 AM PDT

I'm accessing a samba share on a Windows Server 2019 from a PC with an updated Debian 10 buster OS with the command:

sudo mount -t cifs -o vers=3.11,username=myname,uid=1000,gid=1000 //the.server/some/share/ /home/myname/some/dir  

On the top level I'm able to create and rename files without problems:

>> cd ~/some/dir  >> touch del.me  >> mv del.me del1.me  

However, if I try to rename a file in a subdirectory, it doesn't work anymore:

>> cd ~/some/dir  >> mkdir subdir  >> cd subdir  >> touch del.me  >> ls -la  total 8  drwxr-xr-x 2 myname myname    0 Apr 27 11:56 .  drwxr-xr-x 2 myname myname 8192 Apr 27 11:56 ..  -rwxr-xr-x 1 myname myname    0 Apr 27 11:56 del.me  >> mv del.me del1.me      mv: cannot move 'del.me' to 'del1.me': No such file or directory  

Deleting the file created in the subdirectory with rm del.me works without problems.

What could be the reason? I've tried looking online for the problem but cannot find a solution. In other shares on the same server (//the.server/another/share/) mounted in the same way and with the same permissions, moving files works without problems. I've also tried accessing the share from a different PC (running a Debian testing OS), and the problem persists. My samba version is 4.9.5-Debian.

Linux installation not able to find the first partition of the disk during the boot up

Posted: 03 May 2021 09:29 AM PDT

I have an hard disk image of an openSUSE installation from a x86-64 machine which I no longer have access to. I'm trying to boot from this raw disk using quemu. If I start the virtual machine with for example qemu-system-x86_64 -m 4096 -curses -hda srv.sda -enable-kvm or qemu-system-x86_64 -m 4096 -curses -drive id=disk,file=srv.sda,if=none,format=raw -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -enable-kvm, then I end up in the GRUB 2.02 shell, where I can specify the Linux kernel and initial ramdisk with commands below:

grub> linux (hd0,msdos1)/boot/vmlinuz  grub> initrd (hd0,msdos1)/boot/initrd  grub> boot  

This starts the boot process which always ends here:

              [    0.234732] NET: Registered protocol family 10                [    0.235188] lo: Disabled Privacy Extensions                [    0.235592] lib80211: common routines for IEEE802.11 drivers                [    0.236014] registered taskstats version 1                [    0.236439]   Magic number: 1:617:774                [    0.236774] mem zero: hash matches                [    0.237151] rtc_cmos 00:01: setting system clock to 2021-04-22 07:46:24 UTC (                1619077584)                [    0.237802] Freeing unused kernel memory: 896k freed                [    0.238330] Write protecting the kernel read-only data: 10240k                [    0.238762] Freeing unused kernel memory: 1616k freed                [    0.239578] Freeing unused kernel memory: 748k freed                doing fast boot                Creating device nodes with udev                [    0.255337] udev: starting version 157                mount: devpts already mounted or /dev/pts busy                mount: according to mtab, devpts is already mounted on /dev/pts                Boot logging started on /dev/char/../tty1(/dev/console) at Thu Apr 22 10:46:24 2                021                resume device  not found (ignoring)                Waiting for device /dev/sda1 to appear: [    1.072809] input: ImExPS/2 Generic E                xplorer Mouse as /devices/platform/i8042/serio1/input/input1                ..............................Could not find /dev/sda1.                Want me to fall back to /dev/sda1? (Y/n)  

Can I modify the disk settings of the qemu in some way that the first and only partition of the disk becomes available for Linux? For example, looks like GRUB is able to access it as it successfully reads the /boot/vmlinuz and /boot/initrd.

EDIT 1: After recreating the initial ramdisk and including the ata_piix kernel module the qemu-system-x86_64 boot process is following:

              [    0.244118] rtc_cmos 00:01: setting system clock to 2021-04-27 15:31:52 UTC (                1619537512)                [    0.244762] Freeing unused kernel memory: 896k freed                [    0.245284] Write protecting the kernel read-only data: 10240k                [    0.245716] Freeing unused kernel memory: 1616k freed                [    0.246529] Freeing unused kernel memory: 748k freed                doing fast boot                [    0.266568] SCSI subsystem initialized                [    0.267653] megasas: 00.00.04.17.1-rc1 Thu. Oct. 29, 11:41:51 PST 2009                [    0.278467] scsi0 : ata_piix                [    0.278833] scsi1 : ata_piix                [    0.279164] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc060 irq 14                [    0.279562] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc068 irq 15                Creating device nodes with udev                [    0.444780] udev: starting version 157                mount: devpts already mounted or /dev/pts busy                mount: according to mtab, devpts is already mounted on /dev/pts                Boot logging started on /dev/char/../tty1(/dev/console) at Tue Apr 27 18:31:52 2                021                resume device  not found (ignoring)                Waiting for device /dev/sda1 to appear: [    1.080811] input: ImExPS/2 Generic E                xplorer Mouse as /devices/platform/i8042/serio1/input/input1                ..............................Could not find /dev/sda1.                Want me to fall back to sda1? (Y/n)    

As seen above, the ata_piix module seems to be loaded, but /dev/sda1 is still not found.

EDIT 2: I modified the /etc/fstab in chroot environment in a way that /dev/sda1 / reiserfs acl,user_xattr 1 1 was replaced with UUID=dafc3c3a-1469-44b1-b85c-deb904aac291 / reiserfs acl,user_xattr 1 1, regenerated the initial ramdisk and tried to boot this system by specifying the Linux kernel and initial ramdisk in the GRUB shell:

grub> linux (hd0,msdos1)/boot/vmlinuz root=UUID=dafc3c3a-1469-44b1-b85c-deb904aac291  grub> initrd (hd0,msdos1)/boot/initrd  grub> boot  

Unfortunately, the system did not boot. I'll also add the mkinitrd output:

# mkinitrd -v -k vmlinuz-2.6.34.10-0.6-default -i initrd-2.6.34.10-0.6-default -d /    Kernel image:   /boot/vmlinuz-2.6.34.10-0.6-default  Initrd image:   /boot/initrd-2.6.34.10-0.6-default  [MODULES]       02-start.sh: reiserfs thermal megaraid_sas ata_piix ata_generic processor fan  [MODULES]       02-start.sh:  [MODULES]       03-rtc.sh: rtc_cmos  [MODULES]       03-storage.sh: reiserfs  [MODULES]       11-usb.sh: usbcore  [MODULES]       11-usb.sh: ohci_hcd  [MODULES]       11-usb.sh: uhci-hcd  [MODULES]       11-usb.sh: ehci_hcd  [MODULES]       11-usb.sh: usbhid  [MODULES]       'modinfo -k "2.6.34.10-0.6-default" -F supported'  returned with an error.  Kernel Modules: reiserfs thermal_sys thermal scsi_mod megaraid_sas libata ata_piix ata_generic processor fan usbcore pcmcia_core pcmcia mmc_core ssb ohci-hcd ehci-  hcd uhci-hcd usbhid  [MOUNT] Root:   /  Features:       usb resume.userspace resume.kernel  Bootsplash:     openSUSE (640x480)  Shared libs:    /lib/udev/collect_lvm is a script  /lib/udev/findkeyboards is a script  /lib/udev/idedma.sh is a script  /lib/udev/iwlwifi-led.sh is a script  /lib/udev/keyboard-force-release.sh is a script  /lib/udev/kpartx_id is a script  /lib/udev/udev-add-printer is a script  /lib/udev/write_cd_rules is a script  /lib/udev/write_net_rules is a script  /lib/mkinitrd/bin/ipconfig.sh is a script  /sbin/ifup is a script  /lib/mkinitrd/bin/ipconfig.sh is a script  /lib/mkinitrd/bin/linuxrc is a script  /usr/bin/on_ac_power is a script  lib64/ld-2.11.2.so lib64/libacl.so.1.1.0 lib64/libattr.so.1.1.0 lib64/libblkid.so.1.1.0 lib64/libcap.so.2.16 lib64/libcom_err.so.2.1 lib64/libcrypto.so.1.0.0 lib64  /libc-2.11.2.so lib64/libdevmapper.so.1.02 lib64/libdl-2.11.2.so lib64/libgcrypt.so.11.5.2 lib64/libgpg-error.so.0.5.0 lib64/libkeyutils-1.3.so lib64/liblzo2.so.2.  0.0 lib64/libm-2.11.2.so lib64/libncurses.so.5.7 lib64/libpcre.so.0.0.1 lib64/libpthread-2.11.2.so lib64/libreadline.so.6.1 lib64/libresolv-2.11.2.so lib64/librt-2  .11.2.so lib64/libselinux.so.1 lib64/libsepol.so.1 lib64/libssl.so.1.0.0 lib64/libudev.so.0.8.2 lib64/libutil-2.11.2.so lib64/libuuid.so.1.3.0 lib64/libz.so.1.2.3  usr/lib64/libatasmart.so.4.0.3 usr/lib64/libcups.so.2 usr/lib64/libdal-0.3.so.0.0.0 usr/lib64/libdirect-1.2.so.9.0.0 usr/lib64/libdirectfb-1.2.so.9.0.0 usr/lib64/l  ibfusion-1.2.so.9.0.0 usr/lib64/libglib-2.0.so.0.2400.1 usr/lib64/libgssapi_krb5.so.2.2 usr/lib64/libk5crypto.so.3.1 usr/lib64/libkrb5.so.3.3 usr/lib64/libkrb5supp  ort.so.0.1 usr/lib64/libparted.so.0.0.1 usr/lib64/libreiserfs-0.3.so.0.0.0 usr/lib64/libsplashycnf.so.1.0.0 usr/lib64/libsplashy.so.1.0.0 usr/lib64/libusb-0.1.so.4  .4.4 usr/lib64/libusb-1.0.so.0.0.0 lib64/libnss_dns-2.11.2.so lib64/libnss_dns.so.2 lib64/libnss_files-2.11.2.so lib64/libnss_files.so.2 lib64/libgcc_s.so.1  37516 blocks  Perl-Bootloader: 2021-05-03 18:57:38 ERROR: UDEVMAPPING: dmdev /dev/dm-0 doesn't have defined DM_NAME in udev  #  

There is an error about the DM_NAME variable in udev, but on the other hand, new initial ramdisk file is created and for example, adding the ata_piix clearly worked. I have also tried with different root devices(-d option) for mkinitrd like sda1.

NFS Cannot allocate memory

Posted: 03 May 2021 08:13 AM PDT

The other night I was trying to restart NFS services but then I received the following error messages:

kernel: [81818.428785] nfsd: unable to allocate nfsd_file_hashtbl  rpc.nfsd[15567]: error starting threads: errno 12 (Cannot allocate memory)  systemd[1]: nfs-server.service: Main process exited, code=exited, status=1/FAILURE  

That is a weird error to get considering that the system had 12+GB of RAM left in buff/cache. As far as I understand buff/cache memory - that is memory that is used by the kernel to cache information but still available to applications to use if they need RAM.

I then ran the following command:

sync && echo 3 > /proc/sys/vm/drop_caches  

And the memory shifted from buff/cache to free and NFS started without any issues.

Everything that I'm reading suggests that is basically one of the worst things to do.

My question is that is this a bug in NFS or something else? It appears that this is a quite heated topic and I'm not arguing whether it is ok or not - all I can report is when I ran that NFS started without any issues and I am curious to know why.

I'm running Debian 10, with proxmox 6.3-6, NFS version 1:1.3.4-2.5+deb10u1

Edit:

I have also noticed issues with proxmox (ie VNC console not working or can't connect to different nodes) - running that mentioned command on both of my nodes clears up all of those issues.

How to fix infinite bash loop (bashrc + bash_profile) when ssh-ing into an ec2 server?

Posted: 03 May 2021 10:00 AM PDT

I mistakenly have source .bash_profile in the bashrc file and vice versa. Now when I tried to ssh into the machine (ec2), it will stuck at loading bash and get connection closed in a second. Is there a way I could fix it? Could I mount the disk to another ec2 instance to fix the bash files?


Update 1: I tried the following:

%  ssh -i "my-pem.pem" -t ubuntu@<server_address>.amazonaws.com "/bin/bash --noprofile --norc"  Connection to <server_address>.amazonaws.com closed.  

Nothing else showed up. Do you have any idea on what was going wrong?

For sanity check, if I do ssh -i "my-pem.pem"ubuntu@<server_address>.amazonaws.com, the message will be

...    28 packages can be updated.  0 of these updates are security updates.  To see these additional updates run: apt list --upgradable    New release '20.04.2 LTS' available.  Run 'do-release-upgrade' to upgrade to it.      Last login: Mon Feb 22 23:17:41 2021 from ip  Connection to <server_address>.amazonaws.com closed.  

Solution

Just ssh onto the machine and immediately do Ctrlc and fix the bash files.

How to COMPLETELY turn off system beep sounds forever for good for real

Posted: 03 May 2021 09:47 AM PDT

I use Nautilus to explore my files. I use a Debian-based OS with KDE Plasma 5.

I use the keyboard a lot. When I press the key up when navigating files, if I'm already at the extremity of the list of files, Nautilus sends a big system beep which I will hear at 100% volume through my headphones. My reaction is comparable to getting electrified.

I have placed the following lines in ~/.bashrc for the sudo (root) user and for my regular desktop user:

# Turn off system beep in console:  xset b off  xset b 0 0 0  

However, despite the beep going away from some places in the OS (such as erasing an empty line in the gnome-terminal), it's still in Nautilus. I believe it's because Nautilus doesn't source any of the .bashrc or because it ignores the xset commands.

How do I fix this?

What I need might be at a deeper level than the .bashrc, some file that is executed by everything, but which can still control the sound. Otherwise, disabling the sound another way or replacing it could be interesting.

Changing the theme for default windows in Awesome WM

Posted: 03 May 2021 09:01 AM PDT

How can I change the theme for default windows in Awesome WM?

By default windows I mean the window that pops out when you open the preference window in gnome terminal, or pop out the noscript add-on in Firefox. Windows that theme wasn't specified otherwise basically.

Mounting efi disk on external USB

Posted: 03 May 2021 10:02 AM PDT

Recently I bought new sshd to replace my old one on my notebook, but I have problem. I installed Ubuntu 15.10 on new one and put the old on usb case I have, but the disk on USB doesnt have partition (I screamed for 5 minutes because I can't lose data).

So I moved back my old disk inside the disk bay and put the new on usb case, and all my data was here intact but the disk on usb shows no partition.

Both of disks when in usb case show the model and factory correctly but not the partitions. The case is OK, tested with old HDD that doesn't have GPT/EFI partition.

How can I mount the external disk so I can transfer my files?

Ouput of commands:

 $ sudo blkid /dev/sdb    /dev/sdb: PTTYPE="PMBR"       $ sudo parted /dev/sdb print    Error: /dev/sdb: unrecognised disk label   Model: ST1000LM 014-1EJ164 (scsi)                                        Disk /dev/sdb: 1000GB Sector size (logical/physical): 4096B/4096B   Partition Table: unknown Disk Flags:    $ sudo gdisk /dev/sdb   GPT fdisk (gdisk) version 1.0.0    Partition table scan:    MBR: protective    BSD: not present    APM: not present    GPT: not present  

How to disable beep tone in xfce when the delete button is pressed?

Posted: 03 May 2021 09:35 AM PDT

I newly installed xfce on Arch Linux. xfce makes a beep noise every time I press the delete button or backspace, which is really annoying. How can I disable this?

I tried un-commenting set bell-style none, but that didn't work.

How to have a newline before bash prompt?

Posted: 03 May 2021 09:03 AM PDT

How can I configure my bash prompt to have a newline before it?

Instead of:

Output1  Output2  kshitiz@ksh$  

It should have:

Output1  Output2    kshitiz@ksh$  

How to get core temperature of haswell i7 cores in i3status

Posted: 03 May 2021 09:04 AM PDT

I want to use i3status to display my CPU-Core temperatures (haswell i7). However the setting:

order += "cpu_temperature 1"  #...  cpu_temperature 1{          format = "T: %degree °C"  }  #  

doesn't display the correct core temperature. The numbers it shows seem to correspond to the value xsensors shows for temp1, if I change the 1 to 2 above it corresponds to xsensors temp2. Trying 3 or 4 doesn't have any effect. However I want to get the true core temperatures of all 4 cores with i3 status. How can I do this?

No comments:

Post a Comment