Tuesday, October 26, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Pop OS - conflict between Bluez and Blueman? BT not working

Posted: 26 Oct 2021 12:00 PM PDT

So I am running Pop!_OS 21.04 with a 5.13.0-7614-generic Kernel on an Acer Aspire 5 with a Wifi/Bluetooth Adapter by Mediatek Corp mt7921e

Right out of the box Wifi worked but Bluetooth didn't. So I installed Blueman besides Bluez.

Now when I boot up I get the Blueman-applet in the right hand upper corner but as soon as I enable it, it disappears. I am not sure if it crashes. When trying to use the Bluetooth options in the settings, it always appear to be turned off. But as soon as I turn it off (that option still appears), the Blueman-applet reappears. So neither Blueman nor Bluez is really working and I wonder if they are in conflict with each other?

Blueman-manager tells me:

blueman-manager version 2.1.4 starting  blueman-manager 21.51.22 ERROR    Manager:118 on_dbus_name_appeared: Default adapter not found, trying first available.  blueman-manager 21.51.22 ERROR    Manager:122 on_dbus_name_appeared: No adapter(s) found, exiting  

systemctl status bluetooth gives me:

bluetooth.service - Bluetooth service       Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)       Active: active (running) since Tue 2021-10-26 21:14:21 EEST; 40min ago         Docs: man:bluetoothd(8)     Main PID: 1191 (bluetoothd)       Status: "Running"        Tasks: 1 (limit: 18798)       Memory: 1.6M       CGroup: /system.slice/bluetooth.service               └─1191 /usr/lib/bluetooth/bluetoothd    Oct 26 21:14:21 pop-os systemd[1]: Starting Bluetooth service...  Oct 26 21:14:21 pop-os bluetoothd[1191]: Bluetooth daemon 5.56  Oct 26 21:14:21 pop-os systemd[1]: Started Bluetooth service.  Oct 26 21:14:21 pop-os bluetoothd[1191]: Starting SDP server  Oct 26 21:14:21 pop-os bluetoothd[1191]: Bluetooth management interface 1.20 initialized  

Everything is unblocked in rfkill:

ID TYPE      DEVICE              SOFT      HARD   0 wlan      acer-wireless  unblocked unblocked   1 bluetooth acer-bluetooth unblocked unblocked   2 bluetooth hci0           unblocked unblocked   3 wlan      phy0           unblocked unblocked  

I tried uninstalling Blueman but that just left me with Bluez not working.

Is there way to resolve a potential conflict here? What could keep Blueman from working properly?

Thank you very much in advance!

No sound on Ubuntu 20.04 , only Dummy Output on Huawei Matebook D16

Posted: 26 Oct 2021 11:15 AM PDT

I am having a problem with my audio where neither internal speakers, microphone and headphone jack show up as output/input options, only HDMI shows up. I have Ubuntu 20.04 installed with dual boot with Windows installed in a Huawei Matebook D16. Audio works fine in Windows.

I've tried many solutions posted in all sorts of forums and nothing seems to work. These are some output logs:

sudo lspcl:

00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Root Complex  00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Renoir IOMMU  00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge  00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge  00:02.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge  00:02.3 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge  00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge  00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus  00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 51)  00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)  00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 0  00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 1  00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 2  00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 3  00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 4  00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 5  00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 6  00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 7  01:00.0 Network controller: Intel Corporation Wi-Fi 6 AX200 (rev 1a)  02:00.0 Non-Volatile memory controller: Yangtze Memory Technologies Co.,Ltd Device 1001 (rev 03)  03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c7)  03:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Device 1637  03:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor  03:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir USB 3.1  03:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir USB 3.1  03:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor (rev 01)  

aplay -l:

**** List of PLAYBACK Hardware Devices ****  card 1: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 1: Generic [HD-Audio Generic], device 7: HDMI 1 [HDMI 1]    Subdevices: 1/1    Subdevice #0: subdevice #0  card 1: Generic [HD-Audio Generic], device 8: HDMI 2 [HDMI 2]    Subdevices: 1/1    Subdevice #0: subdevice #0  

pacmd list-cards:

1  card(s) available.      index: 0      name: <alsa_card.pci-0000_03_00.1>      driver: <module-alsa-card.c>      owner module: 7      properties:          alsa.card = "1"          alsa.card_name = "HD-Audio Generic"          alsa.long_card_name = "HD-Audio Generic at 0xd03c0000 irq 86"          alsa.driver_name = "snd_hda_intel"          device.bus_path = "pci-0000:03:00.1"          sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:03:00.1/sound/card1"          device.bus = "pci"          device.vendor.id = "1002"          device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"          device.product.id = "1637"          device.string = "1"          device.description = "HD-Audio Generic"          module-udev-detect.discovered = "1"          device.icon_name = "audio-card-pci"      profiles:          output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5900, available: no)          output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 800, available: no)          output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 800, available: no)          output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 38468, available: unknown)          output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5700, available: no)          output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 600, available: no)          output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 600, available: no)          off: Off (priority 0, available: unknown)      active profile: <output:hdmi-stereo-extra1>      sinks:          alsa_output.pci-0000_03_00.1.hdmi-stereo-extra1/#12: HD-Audio Generic Digital Stereo (HDMI 2)      sources:          alsa_output.pci-0000_03_00.1.hdmi-stereo-extra1.monitor/#12: Monitor of HD-Audio Generic Digital Stereo (HDMI 2)      ports:          hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)              properties:                  device.icon_name = "video-display"          hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: yes)              properties:                  device.icon_name = "video-display"                  device.product.name = "LG IPS FULLHD"          hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no)              properties:                  device.icon_name = "video-display"  

lspci -nnk | grep -A2 Audio:

03:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Device [1002:1637]      Subsystem: Device [1e83:3e30]      Kernel driver in use: snd_hda_intel  --  03:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor [1022:15e2] (rev 01)      Subsystem: Device [1e83:3e30]      Kernel driver in use: snd_rn_pci_acp3x  

I've tried:

  • Adding my user to the audio group
  • pulseaudio -k && sudo alsa force-reload
  • Modifying /etc/modprobe.d/alsa-base.conf by adding:
options snd-hda-intel model=generic  options snd-hda-intel dmic_detect=0  blacklist snd_soc_skl  
  • And many other suggested solutions

Please help! Thanks in advance!

Problem changing kernel version

Posted: 26 Oct 2021 10:57 AM PDT

I tried to change the kernel version on AWS, everything is ok if i dont change /etc/default/grub file. If I change that file, the server is not running. Where I did wrong exactly ?

root@ip-172-31-88-82:~# uname -an  Linux ip-172-31-88-82 5.8.0-63-generic #71~20.04.1-Ubuntu SMP Thu Jul 15 17:46:08 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux  root@ip-172-31-88-82:~# grep -A100 submenu  /boot/grub/grub.cfg |grep menuentry  submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-e8070c31-bfee-4314-a151-d1332dc23486' {      menuentry 'Ubuntu, with Linux 5.8.0-63-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.8.0-63-generic-advanced-e8070c31-bfee-4314-a151-d1332dc23486' {      menuentry 'Ubuntu, with Linux 5.8.0-63-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.8.0-63-generic-recovery-e8070c31-bfee-4314-a151-d1332dc23486' {      menuentry 'Ubuntu, with Linux 5.4.0-1045-aws' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-1045-aws-advanced-e8070c31-bfee-4314-a151-d1332dc23486' {      menuentry 'Ubuntu, with Linux 5.4.0-1045-aws (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-1045-aws-recovery-e8070c31-bfee-4314-a151-d1332dc23486' {  submenu 'Advanced options for Ubuntu 20.04.2 LTS (20.04) (on /dev/nvme0n1p1)' $menuentry_id_option 'osprober-gnulinux-advanced-e8070c31-bfee-4314-a151-d1332dc23486' {      menuentry 'Ubuntu (on /dev/nvme0n1p1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.4.0-1045-aws--e8070c31-bfee-4314-a151-d1332dc23486' {      menuentry 'Ubuntu, with Linux 5.4.0-1045-aws (on /dev/nvme0n1p1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.4.0-1045-aws--e8070c31-bfee-4314-a151-d1332dc23486' {      menuentry 'Ubuntu, with Linux 5.4.0-1045-aws (recovery mode) (on /dev/nvme0n1p1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-5.4.0-1045-aws-root=PARTUUID=5198cbc0-01 ro recovery nomodeset dis_ucode_ldr panic=-1-e8070c31-bfee-4314-a151-d1332dc23486' {  root@ip-172-31-88-82:~#   

vim /etc/default/grub

GRUB_DEFAULT="gnulinux-advanced-e8070c31-bfee-4314-a151-d1332dc23486>gnulinux-5.8.0-63-generic-advanced-e8070c31-bfee-4314-a151-d1332dc23486"  

update-grub

Python script not launching properly on reboot/startup Raspberry Pi

Posted: 26 Oct 2021 10:55 AM PDT

For context, I am using Raspberry Pi model 3B+. Currently I am trying to run a python script at the Pi's boot up. But I am struggling with getting the program to launch properly. When I use the following service file, it does launch but it relaunches every 10 seconds causing the program to be launched infinitely many times. I just want the program to launch once.

[Unit]  Description=Start Bling    [Service]  User=pi  Environment=DISPLAY=:0  WorkingDirectory=/home/pi/facial_recognition  Environment=XAUTHORITY=/home/pi/.Xauthority  Environment="prog_path"=/home/pi/facial_recognition  ExecStart=/usr/bin/python /home/pi/facial_recognition/run_on_start.py    Restart=always  RestartSec=10s  KillMode=process  TimeoutSec=infinity    [Install]  WantedBy=graphical.target  

But if I remove this part:

Restart=always  RestartSec=10s  KillMode=process  TimeoutSec=infinity  

or change it to Restart=on-failure, nothing happens when the Raspberry Pi boots up.

The program does not necessarily need to run in Desktop auto-login so if there is a possible fix in the console version that is fine as well. I just have it this way currently, so it is easier to check if the program is working as intended.

I have also tried using crontab, but then nothing happened on reboot. Not with and not without the '&' at the end.

How may i get /var/log/dnf.log to log times in my system timezone?

Posted: 26 Oct 2021 10:33 AM PDT

How may i get /var/log/dnf.log to log times in my system timezone? Neither man dnf nor google have yet enlightened me on this. Centos8/rhel8.

X2Go shows black box but working desktop + icons on Wayland Xfce4 Raspberry Pi

Posted: 26 Oct 2021 09:53 AM PDT

I don't know what else to do. I am done with VNC's limitations and genuinely believe it's time for a big old tech replacement era, where all these old corpses like (X)org, VNC etc... get replaced by newer, modern and broader solutions.

So I installed X2Go on the Windows 10 Client and Raspberry Pi 4 Host, which I will refer to as the Server from now on.

The Server has all the needed packages for both rdp and x2goserver installed (with apt).

The client shows the following result when connecting to it via XFCE selected @ 1024x768: enter image description here

As you can see, the black box is permanent. It was the only thing I saw when starting the session and the rest was only visible after I resized the window.

How can I get rid of that black box?

Add a variable inside double quotes with a dollar

Posted: 26 Oct 2021 10:11 AM PDT

I am trying to write for a command line through a serial port but on the text I have a variable that has a dollar sign $ and I am trying that with bash

My example:

echo "setId(\"$ID\")" > /dev/tty.usbserial-1410  

The thing is that the ID variable has a dollar sign: $blabla

My question is: how can I do that?

Steps to getting internet access in linux

Posted: 26 Oct 2021 09:32 AM PDT

My local system is not connecting to the internet. I am not able to access the internet. Could you please tell me the steps and files that I have to check for getting internet access. Im using linux.

What is the difference between a Btrfs filesystem and a Btrfs partition?

Posted: 26 Oct 2021 09:56 AM PDT

The excerpt from here: https://linuxhint.com/resize_a_btrfs_filesystem/

The Btrfs filesystem can be resized online (when the filesystem is mounted), but if you want to resize a partition that is added to a Btrfs filesystem, you will have to do it offline (when the filesystem is not mounted). You can grow/expand or shrink a Btrfs filesystem online and grow/expand or shrink a Btrfs partition offline.

What is the difference between a Btrfs filesystem and a Btrfs partition in this context?

What i believe is that the partition is just a space range on a disk, which is written in some partition table. And the filesystem is the data structure inside that space range. How does this fit in the context of Btrfs resizing in the mentioned article?

EDIT: what would be the reasons for rezising/shrinking a filesystem without shrinking its partition? Is it possible for two filesystems to be on the same partition? I want to online shrink Btrfs and create a new partition with the freed space, but this confuses me.

Linux REGEX editor compatible with PCRE2

Posted: 26 Oct 2021 08:29 AM PDT

Currently I'm using REGEX 101 to test/fix my texts, is there any Linux editor which is compatible with PCRE2 (PHP >= 7.3) so I can fix my texts even if I'm offline. ps: tried with Featherpad and Geany, seems missing some features (not sure if it's lack of configuration).

"systemctl list-timers" shows 2 days left for a "daily" timer

Posted: 26 Oct 2021 08:25 AM PDT

I created a systemd timer with the following specification

[Timer]  OnCalendar=daily UTC   OnBootSec=1minute  OnClockChange=true  Persistent=true  AccuracySec=1minute  

I wanted to test how the daily UTC would work, so I ran sudo timedatectl set-ntp 0 && sudo timedatectl set-time "2021-10-23 18:57:30". As expected, the timer triggered on time change. Given my current timezone, I expected the timer to trigger again within three and a half minutes (accounting for 1 minute accuracy spec). However, it did not. When it didn't trigger even after another several minutes, I ran systemctl list-timers which showed that my "daily" timer had 2 days left.

What does this mean? How can I create and test a proper daily timer?

UPDATE: I think the cause of the "2 days left" is the fact that I ran the test on Oct 26, but the test was going back to Oct 23. However, I still think my question is valid. When the system clock was changed, why wasn't systemd's next trigger time re-evaluated based on the new UTC time?

write awk script to find the sum of all numbers with same name

Posted: 26 Oct 2021 09:43 AM PDT

//add the numbers of same name:

input file contains:

a:12  b:11  c:14  a:13  c:21  b:24  

output should be:

a:25  b:35  c:35  

here a has 12 and 13 so the sum is 25


the input file contains two columns name and a number separated by ":" we have to find the sum all number associated with the same name for example "a" has 12 and 13 so the sum is 25

How to resize mpg files with FFMPEG with minimum visual artifacts?

Posted: 26 Oct 2021 08:40 AM PDT

I have a mpg file that is 1920x360 in size. I am trying to resize it to 3840x576. My computer has a intel core i5 processor.

I tried the command

ffmpeg -i input.mpg -vf scale=3840x576 output.mpg  

but the output has lots of visual artifacts though the input has no visual artifacts at all. What is the FFMPEG command to achieve this while minimizing the amount of visual artifacts?

Can not link executable

Posted: 26 Oct 2021 08:35 AM PDT

So I'm trying to install xedit on Termux. I tried to execute configure with ./configure but it produces this error:

configure: error: in '/data/data/com.termux/files/home/xedit-1.2.2.tar.xz/xedit-1.2.2': configure: error: C compiler cannot create executables  

I checked GCC to see if it's working since the error also notified me that the C compiler doesn't work. And sure enough, it doesn't work and it produced this error:

CANNOT LINK EXECUTABLE "clang": cannot locate symbol "__emutls_get_address" referenced by "/data/data/com.termux/files/usr/lib/libclang-cpp.so"...  

I'm using clang v13.0.0. This is on my phone, I'm using termux.

Can I give a single non-sudo user access to run a single command without sudo?

Posted: 26 Oct 2021 10:04 AM PDT

Is it possible to give a single user without sudo access, the ability to run a sudo protected command like chmod?

Bash, clear vs Ctrl-L

Posted: 26 Oct 2021 09:30 AM PDT

It seems that clear and bash Ctrl-L are quite different; clear completely removes all previous terminal information (so you cannot scroll up) while Ctrl-L just scrolls the screen so that the cursor is at the top of the page so that you can still scroll up and see previous information. I much prefer the Ctrl-L system. Is there a way to override clear so that it does a Ctrl-L instead of wiping all previous terminal information? This is not a huge issue, but I'm just wondering out of curiosity if there is a way to alias clear to point at my preferred Ctrl-L functionality.

As a side note, I just noticed that PowerShell also has a binding for Ctrl-L and it performs the same way as Ctrl-L on bash, seems the designers there took a lot from bash, but that cmd.exe consoles do not have this functionality).

How to substitute/delete a new line (\n)?

Posted: 26 Oct 2021 09:38 AM PDT

I got access to busybox 1.27.2 only.

I'm currently processing a dictionary with more than half a million words and more than 6,000 pages (which was extracted from a PDF with ghostscript and converted to plain text). Is in a 20MB .txt file. Originally, every single word in this dictionary has a leading -> to make it easier to search for a word.

What I am trying to achive is to make it *nix friendly. Meaning that if I do this: grep -e '->myfancyword' ./dictionary.txt.

I should get as a result:

->fancyword: This is a very fancy word. *Definition going on for more than 6 lines*  

That's easily done by stripping al newlines \n so every word will have all of its definition on a very long line, which is ok. I can replace all \n with tr -d '\n' and then have the output of that going through sed 's/->/\n->/g' so I'll be ending up with all word's definition on a single line. Even on this huge document, its something that's done in less than 5 seconds.

I am almost getting the result I want, but is not perfect. I can do this grep -e '->word' ./dictionary.txt and get the full definition of the word. But it is not cosmetically perfect.

The reason why I'm not pleased with the output is because the original pdf was formatted to be printed on A4 pages, meaning that when there is a long word, it's chopped. Like this:

e.g

->word: This is a defini-  tion.  

If I process the file with the previous work flow, I got: ->word: This is a defini- tion. when grepping the desired word.

So far what I managed to accomplish is this:

  1. input
->firstword: This is a defini-  tion.  ->secondword: This is a second defini-  tion.  
  1. applied tr -d '\n' < ./dictionary.txt > ./dictionary2.txt

  2. output is:

->firstword: This is a defini- tion. ->secondword: This is a second defini- tion.  
  1. ran: sed -e 's/->/\n->/g' ./dictionary2.txt

  2. Ending up with:

output

->firstword: This is a defini- tion.  ->secondword: This is a second defini- tion.  

Before even doing the second step I would like to remove the dash and new line (-\n) to "join" all chopped lines together.

So, my question is: How can I substitute/delete the specific string containing the dash - and the newline char \n (-\n) at the end of the line?

What I like to get is:

output (please, do check the dash and space (- ) not being present anymore)

->firstword: This is a definition.  ->secondword: This is a second definition.  

enter image description here

Thank you.

Uninstall Pop!_OS?

Posted: 26 Oct 2021 11:35 AM PDT

Ok. So I'm not a linux user generally, but I haven't had a good experience with Windows so I decided to switch over and install Pop_OS. It was really good for a time, but I eventually realized I couldn't install a lot of the software I need to use for my work (Unity/Unreal/DaVinci Resolve for example). I want to uninstall the OS and switch to Windows 11 but I can't because every time I try to get to the boot menu, dialogue pops up and says "encryption key?". Then when I enter it, it just goes straight back into Pop!_OS. Is there any way to wipe the ssd or to get the computer to run from a thumb drive (actually access the boot menu)?

Can you set RLIMIT_NOFILE to RLIM_INFINITY?

Posted: 26 Oct 2021 08:26 AM PDT

I'm using setrlimit() from within my C++ code to try and set the RLIMIT_NOFILE to RLIM_INFINITY (getrlimit then set rlim_cur & rlim_max to RLIM_INFINITY and setrlimit()), but I get "Operation not permitted" error. The code runs as root.

is it even possible to set RLIM_INFINITY for RLIMIT_NOFILE?

Unable to mount HDD and concerns over the partition setup

Posted: 26 Oct 2021 09:56 AM PDT

Final Edit A quick note to say thanks for the comments, I certainly learned a lot. Unfortunately, having decided to return the HDD they tested it themselves and concluded that the device was faulty.

I recently bought an internal 4TB HDD to add to a Ubuntu machine. This is my first attempt at adding an HDD to an established machine and mounting it to a specific location. Unfortunately, I'm running into some problems and all similar posts I've seen haven't quite resolved my issue. Therefore, I will try and give a complete breakdown of the steps I understood, followed and the errors I'm facing.

My version of Ubuntu:

Distributor ID: Ubuntu  Description:    Ubuntu 20.04.3 LTS  Release:    20.04  Codename:   focal  

Firstly, after many failed efforts at adding a partition to the HDD and mounting the HDD I've killed the table so consider this as my baseline:

sudo dd if=/dev/zero of=/dev/sdc bs=1M count=10  

The disk is /dev/sdc

When I use lsblk this is the output (sdc is at the bottom):

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT  loop0    7:0    0  55.5M  1 loop /snap/core18/2074  loop1    7:1    0     4K  1 loop /snap/bare/5  loop2    7:2    0  55.4M  1 loop /snap/core18/2128  loop3    7:3    0   219M  1 loop /snap/gnome-3-34-1804/66  loop4    7:4    0   219M  1 loop /snap/gnome-3-34-1804/72  loop5    7:5    0  65.1M  1 loop /snap/gtk-common-themes/1515  loop6    7:6    0  65.2M  1 loop /snap/gtk-common-themes/1519  loop7    7:7    0    51M  1 loop /snap/snap-store/542  loop8    7:8    0    51M  1 loop /snap/snap-store/547  loop9    7:9    0  32.3M  1 loop /snap/snapd/13170  loop10   7:10   0  32.4M  1 loop /snap/snapd/13270  sda      8:0    0 465.8G  0 disk   ├─sda1   8:1    0   512M  0 part /boot/efi  ├─sda2   8:2    0     1K  0 part   └─sda5   8:5    0 465.3G  0 part /  sdb      8:16   0 931.5G  0 disk   ├─sdb1   8:17   0   116M  0 part   ├─sdb2   8:18   0   506M  0 part   └─sdb3   8:19   0 930.9G  0 part   sdc      8:32   0   3.7T  0 disk   sr0     11:0    1  1024M  0 from   

And with sudo fdisk -l

Disk /dev/sdc: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors  Disk model: TOSHIBA MG03ACA4  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes  

I then use gdisk (I have tried using parted) to assign a partition table with type and name etc.

Adding a new partition:

Command (? for help): n  Partition number (1-128, default 1): 1  First sector (34-7814037134, default = 2048) or {+-}size{KMGTP}: 2048  Last sector (2048-7814037134, default = 7814037134) or {+-}size{KMGTP}: 7814037134  Current type is 8300 (Linux filesystem)  Hex code or GUID (L to show codes, Enter = 8300):   Changed type of partition to 'Linux filesystem'  

Let's look at it with p (print)

Number  Start (sector)    End (sector)  Size       Code  Name     1            2048      7814037134   3.6 TiB     8300  Linux filesystem  

I want to call it store:

Command (? for help): c store  Using 1  Enter name: store  

(after a print)

Number  Start (sector)    End (sector)  Size       Code  Name     1            2048      7814037134   3.6 TiB     8300  store  

Finally write the partition table to disk and exit (with w):

Command (? for help): w    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING  PARTITIONS!!    Do you want to proceed? (Y/N): Y  OK; writing new GUID partition table (GPT) to /dev/sdc.  The operation has completed successfully.  

Let's look at the drives and mount points again (lsblk):

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT  loop0    7:0    0  55.5M  1 loop /snap/core18/2074  loop1    7:1    0     4K  1 loop /snap/bare/5  loop2    7:2    0  55.4M  1 loop /snap/core18/2128  loop3    7:3    0   219M  1 loop /snap/gnome-3-34-1804/66  loop4    7:4    0   219M  1 loop /snap/gnome-3-34-1804/72  loop5    7:5    0  65.1M  1 loop /snap/gtk-common-themes/1515  loop6    7:6    0  65.2M  1 loop /snap/gtk-common-themes/1519  loop7    7:7    0    51M  1 loop /snap/snap-store/542  loop8    7:8    0    51M  1 loop /snap/snap-store/547  loop9    7:9    0  32.3M  1 loop /snap/snapd/13170  loop10   7:10   0  32.4M  1 loop /snap/snapd/13270  sda      8:0    0 465.8G  0 disk   ├─sda1   8:1    0   512M  0 part /boot/efi  ├─sda2   8:2    0     1K  0 part   └─sda5   8:5    0 465.3G  0 part /  sdb      8:16   0 931.5G  0 disk   ├─sdb1   8:17   0   116M  0 part   ├─sdb2   8:18   0   506M  0 part   └─sdb3   8:19   0 930.9G  0 part   sdc      8:32   0   3.7T  0 disk   └─sdc1   8:33   0   3.7T  0 part   sr0     11:0    1  1024M  0 rom    

I now want to mount my drive to a location called /store (yes, the same name as the partition on sdc1 - I hope that isn't confusing). This is where I run into an error:

(base) anthony@Shodan:/dev$ sudo mount -o rw /dev/sdc1 /store  mount: /store: wrong fs type, bad option, bad superblock on /dev/sdc1, missing codepage or helper program, or other error.  

I am really not sure what to do from here. I've repeated the same process above but using parted. The steps are successful but again it fails when I try mounting.

EDIT #1 Thanks for the comments. Turns out I didn't create a filesystem so I executed the following but had an error:

(base) anthony@Shodan:~$ sudo mkfs.ext4 /dev/sdc1  [sudo] password for anthony:   mke2fs 1.45.5 (07-Jan-2020)  Creating filesystem with 976754385 4k blocks and 244195328 inodes  Filesystem UUID: d6b2219f-b4fe-490b-bf21-513fec50c625  Superblock backups stored on blocks:       32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,       4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,       102400000, 214990848, 512000000, 550731776, 644972544    Allocating group tables: done                              Writing inode tables: done                              Creating journal (262144 blocks): done  Writing superblocks and filesystem accounting information: mkfs.ext4: Input/output error while writing out and closing file system  

I then install smartmodtools and used smartctl to test the new drive but I ran into a further problem:

(base) anthony@Shodan:~$ sudo smartctl --smart=on -T permissive /dev/sdc  smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.11.0-37-generic] (local build)  Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org    Short INQUIRY response, skip product id  === START OF ENABLE/DISABLE COMMANDS SECTION ===  unable to fetch IEC (SMART) mode page [scsi response fails sanity test]  A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.  

EDIT #2 I'm still struggling to get this drive to work. The disk support SMART (just checked BIOS), and this is what the kernel sees:

(base) anthony@Shodan:/$ dmesg | egrep -i "sdc"  [    1.696642] sd 2:0:0:0: [sdc] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)  [    1.696658] sd 2:0:0:0: [sdc] Write Protect is off  [    1.696661] sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00  [    1.696680] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA  [    1.930394]  sdc: sdc1  [    1.943940] sd 2:0:0:0: [sdc] Attached SCSI disk  [ 2857.111158] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=90s  [ 2857.111168] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 35 c0 08 00 00 00 00 08 00 00  [ 2857.111172] blk_update_request: I/O error, dev sdc, sector 901777408 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0  [ 2857.111184] Buffer I/O error on dev sdc1, logical block 901775360, lost async page write  [ 2857.111191] Buffer I/O error on dev sdc1, logical block 901775361, lost async page write  [ 2857.111199] Buffer I/O error on dev sdc1, logical block 901775362, lost async page write  [ 2857.111204] Buffer I/O error on dev sdc1, logical block 901775363, lost async page write  [ 2857.111208] Buffer I/O error on dev sdc1, logical block 901775364, lost async page write  [ 2857.111212] Buffer I/O error on dev sdc1, logical block 901775365, lost async page write  [ 2857.111215] Buffer I/O error on dev sdc1, logical block 901775366, lost async page write  [ 2857.111223] Buffer I/O error on dev sdc1, logical block 901775367, lost async page write  [ 2857.111365] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111370] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 36 00 08 00 00 00 00 08 00 00  [ 2857.111371] blk_update_request: I/O error, dev sdc, sector 905971712 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0  [ 2857.111375] Buffer I/O error on dev sdc1, logical block 905969664, lost async page write  [ 2857.111378] Buffer I/O error on dev sdc1, logical block 905969665, lost async page write  [ 2857.111407] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111410] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 36 40 08 00 00 00 00 08 00 00  [ 2857.111410] blk_update_request: I/O error, dev sdc, sector 910166016 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0  [ 2857.111430] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111432] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 36 80 08 00 00 00 00 08 00 00  [ 2857.111433] blk_update_request: I/O error, dev sdc, sector 914360320 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0  [ 2857.111451] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111453] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 36 c0 08 00 00 00 00 08 00 00  [ 2857.111454] blk_update_request: I/O error, dev sdc, sector 918554624 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0  [ 2857.111471] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111473] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 37 00 08 00 00 00 00 08 00 00  [ 2857.111474] blk_update_request: I/O error, dev sdc, sector 922748928 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0  [ 2857.111484] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111486] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 37 40 08 00 00 00 00 08 00 00  [ 2857.111487] blk_update_request: I/O error, dev sdc, sector 926943232 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0  [ 2857.111517] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111520] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 37 80 08 00 00 00 00 08 00 00  [ 2857.111521] blk_update_request: I/O error, dev sdc, sector 931137536 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0  [ 2857.111539] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111541] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 37 c0 08 00 00 00 00 08 00 00  [ 2857.111542] blk_update_request: I/O error, dev sdc, sector 935331840 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0  [ 2857.111567] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 2857.111569] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 38 00 08 00 00 00 00 08 00 00  [ 2857.111570] blk_update_request: I/O error, dev sdc, sector 939526144 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0  [ 3053.218272] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 3053.218285] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00  [ 3638.943105] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 3638.943112] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00  [ 3653.216166] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 3653.216179] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00  [ 3971.568186] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 3971.568192] sd 2:0:0:0: [sdc] tag#0 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00  [ 3971.568197] blk_update_request: I/O error, dev sdc, sector 0 op 0x1:(WRITE) flags 0x800 phys_seg 0 prio class 0  [ 3971.568235] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 3971.568237] sd 2:0:0:0: [sdc] tag#0 CDB: Read(16) 88 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00  [ 3971.568238] blk_update_request: I/O error, dev sdc, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0  [ 3971.568256] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 3971.568258] sd 2:0:0:0: [sdc] tag#0 CDB: Read(16) 88 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00  [ 3971.568259] blk_update_request: I/O error, dev sdc, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0  [ 3971.568262] Buffer I/O error on dev sdc, logical block 0, async page read  [ 3971.568276] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 3971.568278] sd 2:0:0:0: [sdc] tag#0 CDB: Read(16) 88 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00  [ 3971.568279] blk_update_request: I/O error, dev sdc, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0  [ 3971.568281] Buffer I/O error on dev sdc, logical block 0, async page read  [ 3971.569093] sd 2:0:0:0: [sdc] Read Capacity(16) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK  [ 3971.569103] sd 2:0:0:0: [sdc] Sense not available.  [ 3971.569160] sd 2:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK  [ 3971.569164] sd 2:0:0:0: [sdc] Sense not available.  [ 3971.569203] sd 2:0:0:0: [sdc] 0 512-byte logical blocks: (0 B/0 B)  [ 3971.569280] sdc: detected capacity change from 7814037168 to 0  [ 4048.513170] sd 2:0:0:0: [sdc] Read Capacity(16) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK  [ 4048.513175] sd 2:0:0:0: [sdc] Sense not available.  [ 4048.513197] sd 2:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK  [ 4048.513198] sd 2:0:0:0: [sdc] Sense not available.  [ 4053.558167] sd 2:0:0:0: [sdc] Read Capacity(16) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK  [ 4053.558170] sd 2:0:0:0: [sdc] Sense not available.  [ 4053.558188] sd 2:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK  [ 4053.558189] sd 2:0:0:0: [sdc] Sense not available.  [ 4253.213080] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 4253.213094] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00  [ 4853.209760] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s  [ 4853.209774] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00  

Time-delay file editing

Posted: 26 Oct 2021 10:37 AM PDT

In pharmacies, certain drugs are put in a time-delay safe, which means there is a fixed lag between the retrieval request and the time the safe is able to open (say maybe 15 minutes). I'm wondering if it's possible to do this with the editing permissions of a file, where the delay is enforced even if you're root.

And, if this is not possible, is it possible to encrypt a file in a time-delayed manner? Something more elegant and precise than "it would take about n years to brute force it".

Create hotkey for hotkey sequence

Posted: 26 Oct 2021 10:27 AM PDT

I am using Ubuntu 20.04, and I'm one of those who enjoys Gnome. Even so, sometimes I like tiling my terminals for work. Usually I'll set them up like so:

enter image description here

I use the Terminator terminal to achieve that effect.

Now, it takes a lot of hotkeys to get to that setup. I have Terminator set as Super-T; then I need to split vertically (Ctrl-Shift-O), then split horizontally (Ctrl-Shift-O). Then I shift the terminals around with Ctrl-Down and Ctrl-Right. I'd like to create a single hotkey that can sequence all those combinations in a single press. I tried to write a script using xdotool:

#!/bin/bash  xdotool key super+j  xdotool key shift+F1  xdotool key super+Up  xdotool key ctrl+shift+o  xdotool key ctrl+shift+e  xdotool key ctrl+shift+Down  xdotool key ctrl+shift+Down  xdotool key ctrl+shift+Down  xdotool key ctrl+shift+Down  xdotool key ctrl+shift+Down  xdotool key ctrl+shift+Down  xdotool key ctrl+shift+Down  xdotool key alt+Down  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key ctrl+shift+Left  xdotool key alt+Right  xdotool ipython  

This was going to be a quick and dirty start to get done what I need to get done, but all that it does is open a new workspace (Super-J) and a Terminator instance (Shift-F1). The other keypresses don't register in the Terminator window in order to effect the necessary window customizations.

Does anyone have a better recommendation of how to do this?

shell script read from csv column and search files

Posted: 26 Oct 2021 11:04 AM PDT

I am creating a shell script to take input from CSV files, having two rows ( One Column mentioning time and another file string ).. My script works when there is one row... But it isnot working in multiple rows and also how can i know which row it is searching didnt got the files .

Sample file:

1300,N213  1245,N218  1400,N222  1600,N225  

Code, I am trying to make it work.

#!/bin/bash  tr_filepath=/var/opt/data/nms_umts_pms_seg/segment1/  echo "Folder to search for traces ${tr_filepath}"  tr_newpath=/var/opt/ericsson/nms_umts_pms_seg/segment1/edos/4G/  CNTRL_FILE=/home/vx622325/filematch.csv  echo "File Contents of ${CNTRL_FILE} to match with pattern"    for i in $CNTRL_FILE;  do      t=$(cat $i | awk -F"," '{ print $1}')    n=$(cat $i | awk -F"," '{ print $2}')    X=`find "$tr_filepath" -type f -iname "A*."$t"*,*="$n"*.bin.gz"`    echo -e "Traces To Copy \n $X\n" >> /home/vx622325/result_`date +"%d_%m_%Y"`.csv      if [ -d "$tr_newpath" ]; then          y= cp -rp $X $tr_newpath  else          echo "Output folder $tr_newpath not found" > /home/vx622325/result_`date +"%d_%m_%Y"`.csv    fi  done  

Files to search for

A20190118.2200+0300-2201+0300_SubNetwork=ONRM_RootMo,SubNetwork=N213,MeContext=N213,ManagedElement=1_rnc_gpehfile_Mp0.bin.gz  A20190118.2200+0300-2201+0300_SubNetwork=ONRM_RootMo,SubNetwork=N213,MeContext=N213,ManagedElement=1_rnc_gpehfile_Mp10.bin.gz  A20190118.2200+0300-2201+0300_SubNetwork=ONRM_RootMo,SubNetwork=N213,MeContext=N213,ManagedElement=1_rnc_gpehfile_Mp11.bin.gz  

Debian 9.4 stretch - unmet dependencies

Posted: 26 Oct 2021 10:02 AM PDT

I'm trying to get a game server started using SRCDS but whenever I try to get the dependencies using this command:

sudo dpkg --add-architecture i386; sudo apt update; sudo apt -f install mailutils postfix curl wget file bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc tmux lib32gcc1 libstdc++6 libstdc++6:i386 lib32tinfo5

I get the following error:

Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies:   lib32gcc1 : Depends: libc6-i386 (>= 2.2.4) but it is not going to be installed   lib32tinfo5 : Depends: libc6-i386 (>= 2.16) but it is not going to be installed   libstdc++6:i386 : Depends: libc6:i386 (>= 2.18) but it is not going to be installed                     Depends: libgcc1:i386 (>= 1:4.2) but it is not going to be installed  E: Unable to correct problems, you have held broken packages.  

I've tried using fixes around the internet, such as apt-get -f install, which didn't work. I still get the same error. I tried updating my sources.list to the following, but that also didn't work.

#------------------------------------------------------------------------------#  #                   OFFICIAL DEBIAN REPOS  #------------------------------------------------------------------------------#    ###### Debian Main Repos  deb http://deb.debian.org/debian/ stable main contrib non-free  deb-src http://deb.debian.org/debian/ stable main contrib non-free    deb http://deb.debian.org/debian/ stable-updates main contrib non-free  deb-src http://deb.debian.org/debian/ stable-updates main contrib non-free    deb http://deb.debian.org/debian-security stable/updates main  deb-src http://deb.debian.org/debian-security stable/updates main    deb http://ftp.debian.org/debian stretch-backports main  deb-src http://ftp.debian.org/debian stretch-backports main  

Anyone have any ideas?

How to extract the Root CA and Subordinate CA from a certificate chain in Linux?

Posted: 26 Oct 2021 11:51 AM PDT

I have an end-entity/server certificate which have an intermediate and root certificate. When I cat on the end-entity certificate, I see only a single BEGIN and END tag. It is the only the end-entity certificate.

Is there any way I can view the intermediate and root certificate content. I need only the content of BEGIN and END tag.

In Windows I can see the full cert chain from the "Certification Path". Below is the example for the Stack Exchange's certificate.

enter image description here

From there I can perform a View Certificate and export them. I can do that for both root and intermediate in Windows. I am looking for this same method in Linux.

enter image description here

Extend a LUKS encrypted partition to fill disk

Posted: 26 Oct 2021 11:44 AM PDT

I recently upgraded my disk from a 128GB SSD to 512GB SSD. The / partition is encrypted with LUKS. I'm looking for help extending the partition to use all the free space on the new disk. I've already dd'd the old drive onto the new one:

[root@localhost ~]# fdisk -l /dev/sda  Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 sectors  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: dos  Disk identifier: 0x00009f33    Device     Boot   Start       End   Sectors   Size Id Type  /dev/sda1  *       2048   1026047   1024000   500M 83 Linux  /dev/sda2       1026048 250064895 249038848 118.8G 83 Linux  

There's about 380GB of unused space after sda2.

More relevant info:

[root@localhost ~]# vgs    VG             #PV #LV #SN Attr   VSize   VFree    fedora_chocbar   1   3   0 wz--n- 118.75g 4.00m    [root@localhost ~]# lvs    LV   VG             Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert    home fedora_chocbar -wi-a----- 85.55g                                                        root fedora_chocbar -wi-a----- 29.30g                                                        swap fedora_chocbar -wi-a-----  3.89g    [root@localhost ~]# pvs    PV                    VG             Fmt  Attr PSize   PFree    /dev/mapper/encrypted fedora_chocbar lvm2 a--  118.75g 4.00m  

There seems to be a lot of info regarding how to do this, but very little explanation. I appreciate any help on this.

Can nmap display only hosts with specific ports open?

Posted: 26 Oct 2021 12:27 PM PDT

Can nmap list all hosts on the local network that have both SSH and HTTP open? To do so, I can run something like:

nmap 192.168.1.1-254 -p22,80 --open  

However, this lists hosts that have ANY of the list ports open, whereas I would like hosts that have ALL of the ports open. In addition, the output is quite verbose:

# nmap 192.168.1.1-254 -p22,80 --open    Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-31 10:14 EST  Nmap scan report for Wireless_Broadband_Router.home (192.168.1.1)  Host is up (0.0016s latency).  Not shown: 1 closed port  PORT   STATE SERVICE  80/tcp open  http    Nmap scan report for new-host-2.home (192.168.1.16)  Host is up (0.013s latency).  PORT   STATE SERVICE  22/tcp open  ssh  80/tcp open  http    Nmap done: 254 IP addresses (7 hosts up) scanned in 3.78 seconds  

What I'm looking for is output simply like:

192.168.1.16  

as the above host is the only one with ALL the ports open.

I certainly can post-process the output, but I don't want to rely on the output format of nmap, I'd rather have nmap do it, if there is a way.

RTOS in a virtual machine

Posted: 26 Oct 2021 09:04 AM PDT

Are there any opensource/free Unix like RTOS that can run a virtual machine like QNX Neutrino RTOS (http://www.qnx.com/products/evaluation/eval-target.html)?

Running Python script over multiple directories and multiple files

Posted: 26 Oct 2021 12:02 PM PDT

Here is my command line for python:

python script.py -a .faa -n .fna  

I have a directory containing multiple directories. Out of these multiple directories, there could be 1 or more folders.

In these 1 or more folders, I need to run my python script on the .faa and .fna files.

How do I do this?

Example tree:

Staph1 ----> [CO1, CO2] ----> [.fna, .faa] from CO1, [.fna, .faa] from CO2    Staph2 ----> [CO6] ----> [.fna, .faa] from CO6

My Python script will use the inputs .fna and .faa and output within the folder. Also the folder and directory are synonymous.

No comments:

Post a Comment