Monday, July 18, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to remove Firefox supplementary English spellchecking dictionaries?

Posted: 18 Jul 2022 03:36 AM PDT

Normally I have the US English spell-checking dictionary as default then I add others that I need (French, Romanian, etc). But in Fedora 36 Firefox came with a lot of different English dictionaries that fill the menu.

enter image description here

resource://gre/dictionaries/ shows only en-US, and about:addons only what I have added (French).

Avoid printing of 'tee' trace line

Posted: 18 Jul 2022 04:24 AM PDT

I have the following in a script:

#!/bin/bash    logFile='script.log'  echo -n > $logFile  log="tee -a $logFile"    set -x  ssh user@host "    echo '...message...'    " 2>&1 | $log  { set +x ;} 2> /dev/null  # avoids trace output of '++ set +x'  

The output is:

++ ssh user@host '    echo '\''> ...message...'\''    '  ++ tee -a script.log  > ...message...  

Can the ++ tee ... trace line be suppressed somehow, as well?

Exclude last N lines that has been last modified from list and with file extension ending in .gz

Posted: 18 Jul 2022 04:03 AM PDT

I want to use the find command on AIX to exclude files ending in .gz, and it must also exclude the last 2 lines from the list. For example, inside the directory, I have:

shop14_0_Log0002019754.gz  shop14_0_Log0002019755.gz  shop14_0_Log0002019756.gz  shop14_0_Log0002019757  shop14_0_Log0002019758.gz  shop14_0_Log0002019759.gz  shop14_0_Log0002019760.gz  shop14_0_Log0002019761.gz  shop14_0_Log0002019762  

I want to get the output shown below by retrieving only the uncompressed files, but excluding the last 2 files from the bottom:

Output command must achieve:

shop14_0_Log0002019757  

I am able to exclude the last 2 lines using the ls command, but how can I do this by excluding files whose names end with .gz? I am struggling to find a way in AIX/UNIX:

ls -ltr | awk '{print $9} |  sed '$d' |  sed '$d'  

Using find, I am able to achieve the list of files that are not compressed by excluding .gz from the list, but it includes the last 2 files, which I do not want:

find . -type f ! -name '*\.gz'  -print   

The above find command returns:

./shop14_0_Log0002019757  ./shop14_0_Log0002019762  

The file shop14_0_Log0002019762 should be excluded from the list and if shop14_0_Log0002019761 was also uncompressed, then it must also be excluded from the list. How can I do this?

Copying files from USB drive fails - I/O error or Invalid Argument

Posted: 18 Jul 2022 03:21 AM PDT

I'm trying to copy files from an USB stick to another drive. At least the file names appear to be corrupt, ls shows them as:

'ZHECMIv'$'\027''.PDF'  'ZHEKMI>2.P─F'   ZHENIL~1.PDF  'эeloѤyfɯrɥvdr.2uOroä䁲igez_o_聴eŢe'$'\340\240\256''Ű聤f'  'ၙan­P⁩ѥòѳen-ၐoint-M䁯rѴ&`df'  

Copying fails with errors like these:

cp: error reading '/media/pg/VERBATIM/2012/03/MVANES~0.PDF': Input/output error  cp: cannot create regular file '/media/pg/Elements SE/verba/2012/03/ERANmS~3.P'$'\004''B': Invalid argument  cp: cannot stat '/media/pg/VERBATIM/2014/09/f5'$'\004''7'$'\004''0'$'\004''.': No such file or directory  

On the chance that only the filenames are corrupt, I tried this:

pg@TREX:~$ cp /media/pg/VERBATIM/2012/02/'YQ83A1'$'\177''0.╨DF' ./1.pdf  cp: error reading '/media/pg/VERBATIM/2012/02/YQ83A1'$'\177''0.╨DF': Input/output error  

fsck.vfat -n shows:

fsck.fat 4.2 (2021-01-31)  There are differences between boot sector and its backup.  This is mostly harmless. Differences: (offset:original/backup)    65:01/00    Not automatically fixing this.  FATs differ but appear to be intact.    Using first FAT.  Cluster 113918 out of range (67222785 > 1968189). Setting to EOF.  Cluster 113928 out of range (2211211 > 1968189). Setting to EOF.  Cluster 113929 out of range (67222860 > 1968189). Setting to EOF.  Cluster 113937 out of range (2211092 > 1968189). Setting to EOF.  ...  Cluster 657871 out of range (1). Setting to EOF. (Several)  ...  Cluster 1940714 out of range (1342259Internal error: next_cluster on bad cluster  52 > 1968189). Setting to EOF. (once)  

fdisk -l output:

pg@TREX:~$ sudo fdisk -l /dev/sde  Disk /dev/sde: 30.05 GiB, 32262586368 bytes, 63012864 sectors  Disk model: STORE N GO        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: 0x00000000    Device     Boot Start      End  Sectors Size Id Type  /dev/sde1          32 63012863 63012832  30G  c W95 FAT32 (LBA)  

Are these files lost for good, or is there a tool I can try to recover them with?

  • Debian Bullseye fully up to date
  • $LANG is set to en_US.UTF.8
  • USB stick 32GB, VFAT
  • Data added to drive with Win10 Pro

libopenjp2-7-dev : No package found even after installing package in docker container

Posted: 18 Jul 2022 01:11 AM PDT

I have been trying to run some commands at the docker entrypoint

docker run -v $(pwd):/oin -w /oin --entrypoint /bin/sh ubuntu -c "apt-cache show kernel glibc systemd bash coreutils grub2-pc libmodulemd | tee manifest-ubu:Core.txt; apt-cache search glibc kernel | tee manifest-ubu:Old.txt; apt-cache show libopenjp2-7-dev | tee manifest-ubu:Graphics.txt" eric/ubuntu_image:latest_image

However, I get an error message as E: No packages found. ( Error message related to the package libopenjp2-7-dev)

Here are all the things I have done till now:

  1. Cloned ubuntu's image and named it eric/ubuntu_image and its corresponding container as ubuntu_image_container.

    Mounted volume onto this container, but everything works absolutely fine except for one package - libopenjp2-7-dev.libopenjp2-7-dev is an equivalent for openjpeg2 in ubuntu, as far as I could learn.

  2. Even after installing libopenjp2-7-dev in the cloned image ( as base images are immutable) and after running the above command, I receive the following error: Package not found.

  3. Was also able to find the installed package inside the cloned image's container. The package location using the find command was found to be ./usr/share/doc/libopenjp2-7-dev

  4. Everything works fine when I remove the line which has libopenjp2-7- dev.

Some help will be deeply appreciated. I just don't understand why it is not able to find the package libopenjp2-7-dev

when `mv` command delete original directories or files

Posted: 18 Jul 2022 01:00 AM PDT

I am moving a large directory(contains many other directoris and files), after several minutes, I found that the original directory is not getting smaller, still the same size as begining. Does mv command deleting all directories and files once all directories/files moved? not delete directory/file once the single directory/file deleted?

`json.decoder.JSONDecodeError` when executing `list queues` with `rabbitmqadmin`

Posted: 18 Jul 2022 01:59 AM PDT

I want to list available queues on a remote RabbitMQ server with the following command: rabbitmqadmin --host=a.b.c.com --port=443 --username=user --password=pwd list queues

But it ends with an error:

Traceback (most recent call last):    File "/usr/bin/rabbitmqadmin", line 1150, in <module>      main()    File "/usr/bin/rabbitmqadmin", line 494, in main      method()    File "/usr/bin/rabbitmqadmin", line 694, in invoke_list      format_list(self.get(uri), cols, obj_info, self.options)    File "/usr/bin/rabbitmqadmin", line 523, in get      return self.http("GET", "%s/api%s" % (self.options.path_prefix, path), "")    File "/usr/bin/rabbitmqadmin", line 597, in http      die(json.loads(resp.read())['reason'])    File "/usr/lib/python3.8/json/__init__.py", line 357, in loads      return _default_decoder.decode(s)    File "/usr/lib/python3.8/json/decoder.py", line 337, in decode      obj, end = self.raw_decode(s, idx=_w(s, 0).end())    File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode      raise JSONDecodeError("Expecting value", s, err.value) from None  json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)  

I have tried lots of variants of the command: without credentials, with -k option... but without success. The error has always been the same.

nmap tells me that the host a.b.c.com is alive and the port 443 is open.

The error may indicate a problem with python, but how the workaround may look like? Installing another version of rabbitmqadmin (the current one is 3.8.2) or another python version (the current one is 3.8.10)?

I've also downloaded rabbitmqadmin from the remote server as explained here https://www.rabbitmq.com/management-cli.html and used it.

The downloaded version was 3.8.19 but it didn't help.

Not sure what is going on behind the scenes that causes this error...

Can't copy files to folder due to space issue after mand mount

Posted: 18 Jul 2022 12:44 AM PDT

I tried doing mandatory mount using the following the command

mount -t tmpfs -o mand,size=1m tmpfs ./FileLockFail/  

Now when I am trying to copy a folder to the mounted directory, its giving me error

cp -r data/ FileLockFail/  

Error :

cp: error writing 'FileLockFail/data/folder2/file_1.txt': No space left on device  cp: error writing 'FileLockFail/data/folder2/file_2.txt': No space left on device  cp: error writing 'FileLockFail/data/folder2/file_3.txt': No space left on device  cp: error writing 'FileLockFail/data/folder1/file_3.txt': No space left on device  cp: error writing 'FileLockFail/data/folder1/file_1.txt': No space left on device  cp: error writing 'FileLockFail/data/folder1/file_2.txt': No space left on device  

This is the output of df -h which shows I definitely have space

[root@himanshu/]# df -h  Filesystem                             Size  Used Avail Use% Mounted on  devtmpfs                               3.8G     0  3.8G   0% /dev  tmpfs                                  3.8G     0  3.8G   0% /dev/shm  tmpfs                                  3.8G   17M  3.8G   1% /run  tmpfs                                  3.8G     0  3.8G   0% /sys/fs/cgroup  /dev/mapper/ol-root                     35G   19G   17G  53% /  /dev/mapper/frel-cache                  40G  318M   40G   1% /opt/FBR  /dev/sda1                             1014M  366M  649M  37% /boot  tmpfs                                  767M     0  767M   0% /run/user/0  //aws.amazon.com.compute.ecr           20T   18T  2.5T  88% /root/media  tmpfs                                  1.0M   16K 1008K   2% /FileLockFail  

Why must gparted be run as root?

Posted: 18 Jul 2022 02:15 AM PDT

My user has access to USB-block devices (member of group plugdev). But even so gparted needs to be run as root:

$ ls -l /dev/sdd  brw-rw---- 1 root plugdev 8, 48 Jul 17 19:05 /dev/sdd  $ gparted /dev/sdd  (requires root)  

Is there any technical reason for this?

I have a full disk image including partition table in a file. Running gparted on this fails, so I instead have to do the losetup -Pf circus.

Is there any technical reason for this?

Making two files same length by taking average of specific values in a column according to a given row

Posted: 18 Jul 2022 03:51 AM PDT

I have two CSV files of differing lengths (can easily convert format if needed). The goal is to make the files the same length in terms of chr values (in the first column) by copying data from the shorter file.

The number of chr's for each chr will be different. For example, file A may have 4 chr6 and 8 chr9 while B may have 4 chr 6 and 20 chr9 values, but file B will always have more (or the same). So I want to check the specific chr values between each file and make sure they match, and if they don't then create a new row for file A so more chr values can be added.

For the samples where there are more chr instances, I need to fit the start and end cols (col 2 and 3), and then average the seg.means across that distance (see output).

A python or linux solution would be great.

File A:  chr,start,end,seg.mean  chr1,1250000.5,119750000.5,0  chr1,120250000.5,248750000.5,1  chr2,750000.5,89250000.5,1  chr2,96250000.5,242750000.5,0  chr3,250000.5,197750000.5,0  chr3,250000.5,197750000.5,0  chr3,250000.5,197750000.5,0  chr3,250000.5,197750000.5,0  chr3,250000.5,197750000.5,0  chr4,750000.5,173250000.5,0  chr4,173750000.5,190750000.5,0  chr5,750000.5,50750000.5,0  chr5,51250000.5,161250000.5,0  chr5,161750000.5,180250000.5,0  
File B:   chr,start,end,seg.mean  chr1,0,1360771,0  chr1,4444749,4989517,0  chr1,145554552,146843221,1  chr2,0,561623,0  chr2,2238888,2785649,1  chr2,31559035,32114545,0  chr2,39254490,39796519,1  chr2,51290451,51839230,0  chr2,95983522,96867402,0  chr2,133383630,133926312,0  chr2,239667697,240244621,0  chr3,0,607142,0  chr3,57956530,58499576,0  chr3,93537754,94090293,0  chr3,124986659,125561401,0  chr3,172604928,173147779,0  chr4,0,620261,0  chr4,53156319,53724732,0  chr5,0,691869,0  chr5,5190275,5736755,0  chr5,50161050,50719035,0  chr5,122538725,123091102,0  chr5,127515073,128064714,0  chr5,168927295,169476122,0      

Ideally, file A would then look like this (note how seg.mean col changes):

File A result

And file B would look like this:

enter image description here

Thanks!

line start string and end string matches then it needs to replace end string of a line and ignore any string that matches in between of same line

Posted: 18 Jul 2022 03:55 AM PDT

Require a shell script for the below issue

elecj_test: |1009676|F|269.13348200|3|348415|237.06|0.00|0.00|||SSPPPSSSPSSS|UNTESTED||  

If a line starts with elecj_test: and ends with || it needs to replace with | |

Here Space is added in between | |

In the middle of the line if it is found || it must not replace only it must replace at end of the line.

When pressing tab, how can I make fish complete to directory/ instead of directory/prefix?

Posted: 18 Jul 2022 01:40 AM PDT

I'm using fish shell. Let's say that I have a directory named books, containing files title-1, title-2 and title-3:

$ tree books  books/  ├── title-1  ├── title-2  └── title-3    0 directories, 3 files  

If I type git add boo and press tab, fish will automatically complete to git add books/title- . I can press tab multiple times to cycle through the files books/title-1, books/title-2 and books/title-3.

I would prefer it if fish completed to git add books/ instead, the way bash or zsh does it. I'm used to that way, and it's more convenient to run git add against a directory rather than a list of files. How can I configure fish to complete this way?

How to move a set of files and directories, excluding another (sub-)set

Posted: 18 Jul 2022 01:41 AM PDT

I have two bash arrays, one of them (named toMove) contains paths to files and directories to move (not copy) somewhere else, and the other one (named exclude) contains paths to files and directories to exclude from moving.

toMove=(      tree/subtree1      tree/subtree2      tree/subtree3/leaffile3  )  exclude=(      tree/subtree1/leafdir1      tree/subtree2/leaffile2  )    # move code ?  

This is the test directory structure:

mkdir -p tree/{subtree1/leafdir1,subtree2/leafdir2,subtree3/leafdir3}  touch tree/{subtree1/leaffile1,subtree2/leaffile2,subtree3/leaffile3}  tree tree      tree      ├── subtree1      │   ├── leafdir1      │   └── leaffile1      ├── subtree2      │   ├── leafdir2      │   └── leaffile2      └── subtree3          ├── leafdir3          └── leaffile3  

Desired outcome after moving:

tree tree      tree      ├── subtree1      │   └── leafdir1      ├── subtree2      │   └── leaffile2      └── subtree3          └── leafdir3    tree destination      destination      ├── subtree1      │   └── leaffile1      ├── subtree2      │   └── leafdir2      └── subtree3          └── leaffile3  

In rsync, there is an --exclude-from= option, that (in combination with the --remove-source-files option) does exactly what I want, but unfortunately rsync copies files but I need to move them (for performance reasons), if they are on the same filesystem.

The solution I have in mind, is using find to obtain a list of all paths (including the contents of the dirs) in the toMove array, iterating over this list and filtering out all paths starting with the paths in the exclude array. Is this the right approach to the problem, or is there a simpler and/or more elegant way (possibly using some standard utilities) to solve this?

UPDATE:

As it turns out, this problem is not as trivial as one might think first looking at it and this question was poorly phrased -- it should have been about "filtering out paths from other paths, preserving unaffected trees as a whole".

I ultimately went with the solution below, although it does not preserve empty leafdirs and has the second drawback that it moves each file, when it would be sufficient, to move only a parent tree in some cases.

...  comm \      -23 \      <(find "${toMove[@]}"  ! -type d 2>/dev/null | sort -u || true) \      <(find "${exclude[@]}" ! -type d 2>/dev/null | sort -u || true) |          parallel -j "$(nproc)" -- moveFile {}  ...  

(moveFile is an exported bash function that handles the moving. parallel was used to speed up the (few) times when the script will not operate on one filesystem.)

Stéphane Chazelas' answer told me a lot I didn't know before and seems to be the way to go, if zsh is an option.

rename the header of multifasta files

Posted: 18 Jul 2022 01:52 AM PDT

I have multi-fast files like this

>aaaaa.1_prot_CAA66754.1_10  MEKLLDAYLSSLRLNRRQVSEQTGLNYTTLQRASDKDALMISPRILWGIAMMVDKTPGQVLDELIELEMK  >bbbbb.1_prot_CAA66753.1_11  MMSKQDRINRRRRNIMKDAHRIAKLIVSNVGDYMVAMKLALKTVYAYKAMRKEVSSRGNAVEMHTLPLLD  GYARQQFEPEFVAGIPAWAIKKDFMSSSAQDILYFTIDTKVVKETEKAVEIEFATKNPKEHGYVDHHHTW  VAKSIMAA  

I want to rename the header like this by sed or awk

>aaaaa.1_10  MEKLLDAYLSSLRLNRRQVSEQTGLNYTTLQRASDKDALMISPRILWGIAMMVDKTPGQVLDELIELEMK  >bbbbb.1_11  MMSKQDRINRRRRNIMKDAHRIAKLIVSNVGDYMVAMKLALKTVYAYKAMRKEVSSRGNAVEMHTLPLLD  GYARQQFEPEFVAGIPAWAIKKDFMSSSAQDILYFTIDTKVVKETEKAVEIEFATKNPKEHGYVDHHHTW  VAKSIMAA  

but I just know sed a little, like

sed 's/.\(.\)$/\1/'  

to remove the penultimate letter of each line. Can you give me some advice?

I have text file. want to add commas to time/date stamp in txt file or convert below text to csv in 3 columns

Posted: 18 Jul 2022 02:12 AM PDT

I have text file. want to add commas to time/date stamp

$ cat sample.txt   name1 [jdk]                 Mon Nov 01 12:14:04 EST 2004     Mon Jan 01 00:37:19 EST 2035  

I want output like below and need to convert to csv file.

name1 [jdk],Mon Nov 01 12:14:04 EST 2004,Mon Jan 01 00:37:19 EST 2035  

pip install gives TypeError: expected string or bytes-like object

Posted: 18 Jul 2022 02:22 AM PDT

I have seen this error in other sites and in here as well, but the solutions provided are not fixing it. Operating System: Mendel GNU/Linux 5 (Eagle) (debian). When trying to install psutil, I am getting an error:

sudo pip3 install --upgrade psutil  Collecting psutil  Exception:  Traceback (most recent call last):    File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 143, in main      status = self.run(options, args)    File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 338, in run      resolver.resolve(requirement_set)    File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 102, in resolve      self._resolve_one(requirement_set, req)    File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 256, in _resolve_one      abstract_dist = self._get_abstract_dist_for(req_to_install)    File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 209, in _get_abstract_dist_for      self.require_hashes    File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 218, in prepare_linked_requirement      req.populate_link(finder, upgrade_allowed, require_hashes)    File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 164, in populate_link      self.link = finder.find_requirement(self, upgrade)    File "/usr/lib/python3/dist-packages/pip/_internal/index.py", line 572, in find_requirement      all_candidates = self.find_all_candidates(req.name)    File "/usr/lib/python3/dist-packages/pip/_internal/index.py", line 534, in find_all_candidates      self._package_versions(page.iter_links(), search)    File "/usr/lib/python3/dist-packages/pip/_internal/index.py", line 702, in _package_versions      v = self._link_package_versions(link, search)    File "/usr/lib/python3/dist-packages/pip/_internal/index.py", line 777, in _link_package_versions      support_this_python = check_requires_python(link.requires_python)    File "/usr/lib/python3/dist-packages/pip/_internal/utils/packaging.py", line 33, in check_requires_python      return python_version in requires_python_specifier    File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/specifiers.py", line 676, in __contains__      return self.contains(item)    File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/specifiers.py", line 681, in contains      item = parse(item)    File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/version.py", line 28, in parse      return Version(version)    File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/version.py", line 219, in __init__      match = self._regex.search(version)  TypeError: expected string or bytes-like object  

I could not find the file /usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/version.py (as there was nothing after the .whl file but my guess was that packaging-19.0-py2.py3-none-any.whl is a wheel that depended on pip3. So I searched for version.py in my system.

$ sudo find / -name version.py  /usr/lib/python3/dist-packages/debianbts/version.py  /usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/version.py  /usr/lib/python3/dist-packages/chardet/version.py  /usr/lib/python3/dist-packages/numpy/version.py  /usr/lib/python3/dist-packages/numpy/ma/version.py  /usr/lib/python3/dist-packages/OpenGL/version.py  /usr/lib/python3/dist-packages/setuptools/version.py  /usr/lib/python3/dist-packages/setuptools/_vendor/packaging/version.py  /usr/lib/python2.7/distutils/version.py  /usr/lib/python2.7/dist-packages/pkg_resources/_vendor/packaging/version.py  /usr/lib/python2.7/dist-packages/IPython/utils/version.py  /usr/lib/python3.7/distutils/version.py  /usr/local/lib/python3.7/dist-packages/pydantic/version.py  /usr/local/lib/python3.7/dist-packages/websockets/version.py  /usr/local/lib/python3.7/dist-packages/flask_cors/version.py  /usr/local/lib/python3.7/dist-packages/packaging/version.py  /usr/share/python3/debpython/version.py  /usr/share/dh-python/dhpython/version.py  /usr/share/python/debpython/version.py  

I edited both files that have packaging/version.py, which are:

/usr/local/lib/python3.7/dist-packages/packaging/version.py  

This did not affect the output of the pip3 install, the change was: match = self._regex.search(version) to match = self._regex.search(str(version))

I then proceeded to change the other files that had /packaging/version.py

/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/version.py  /usr/lib/python3/dist-packages/setuptools/_vendor/packaging/version.py  

But nothing is changing. I've seen that it might be a problem of the wheel in debian (the error is not exactly the same, but downgrading the wheel seems kind of okay?), but I am not sure nor do I know how much can this screw my system (I've had package manager problems before and had to delete my linux distribution, so I want to be careful).

EDIT: pip3 version:

$ pip3 --version      pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)  

EDIT: This problem arose when trying to install PyAccessPoint. For some reason, installing it the hard way, worked, but still doesn't fix this issue nor future issues with the wheel:

sudo apt update && sudo apt --yes --force-yes install dnsmasq hostapd python3-dev unzip python3-pip && cd ~ && wget --output-document=pyaccesspoint-master.zip https://github.com/Goblenus/pyaccesspoint/archive/master.zip && unzip pyaccesspoint-master.zip && cd pyaccesspoint-master && sudo python3 setup.py install && cd ~ && sudo rm -rf pyaccesspoint-master.zip pyaccesspoint-master  

rename the filename

Posted: 18 Jul 2022 02:21 AM PDT

The following files exist in the current directory

 GCF_000901975.1_ViralProj181986_genomic.fna.gz     GCF_001885505.1_ViralProj344311_genomic.fna.gz   GCF_000901995.1_ViralProj181990_genomic.fna.gz     GCF_001041015.1_ViralProj287961_genomic.fna.gz  

and i want to rename the current file like this

 GCF_000901975.1   GCF_001885505.1   GCF_000901995.1   GCF_001041015.1  

I'm using the below script to get it but it's failed

 for file in `ls | grep .gz`   do      newfile=`echo $file | awk -F "_" '{print $1,"_",$2,".gz"| sed 's/ //g"`      mv $file $newfile   done  

anybody can give me some advice? or maybe i should try the "Split" , appreciate it

Ubuntu will no longer boot after upgrade from 20.04 to 20.10

Posted: 18 Jul 2022 01:03 AM PDT

Thanks in advance for the help.

I have a Dell Precision 7540 that has Ubuntu 20.10 installed (previously 20.04). It is a pretty normal installation with a single physical nvme disk, with separate partition for boot and LUKS on the main partition. I can no longer boot past the Grub boot screen. The options I have to select from are:

Ubuntu with Linux 5.8.0-26-generic

Ubuntu with Linux 5.8.0-26-generic (recovery mode)

Both of these options have the same behavior. After 10-15 seconds, it brings me to a (initramfs) prompt. Typing exit gives the following:

Gave up waiting for root file system device. Common problems:   - Boot args (cat /proc/cmdline)    - Check rootdelay= (did the system wait long enough?)   - Missing modules (cat /proc/modules; ls /dev)  ALERT! /dev/mapper/vgubuntu-root does not exist. Dropping to a shell!  

Things I have tried: I have tried booting from a Live USB, and I can successfully mount the LUKS partition. I have installed and run boot-repair from the live USB, and after the repair, it gave me a pastebin link, below, but still will not boot:

http://pastebin.ubuntu.com/p/HxXj4qfrqS/

I have also chrooting into my installation and running update-grub, grub-install, and update-initramfs, but none of these have changed anything.

Let me know if there is any other information that would help to diagnose this.

UPDATE: I have gotten it to boot, but only after unlocking the LUKS partition from initramfs. By doing the following command:

cryptsetup luksOpen /dev/nvme0n1p3 nvme0n1p3_crypt and entering the password, then: exit It will boot. How can I make it prompt me for this instead of timing out and dropping me to initramfs?

SSH - Permission denied (publickey) - doesn't work in case of one node

Posted: 18 Jul 2022 01:43 AM PDT

I have 3 nodes: node A, B and C. A wants to connect to B and C via ssh. B and C are identical servers. A can connect to B but cannot to C.

ssh user@node  

The error I see:

Permission denied (publickey).  

I've tried:

  • The ownership settings on the ida_rsa and the authorized_keys files are correct and are the same on server B and C
  • The /etc/ssh/sshd_config file is also identical on both nodes
  • I can telnet to both node B and C via port 22 so it's not a firewall issue either

What have I missed? What else should I check?

So far I fail to see what forbids me from connecting to node C.

Unable to connect to remote server using lftp

Posted: 18 Jul 2022 04:02 AM PDT

I'm trying to establish a new ftps connection between two servers, say A and B.

Below are the commands I'm using for establishing the connection. I guess i'm able to connect to the remote server but unable to perform operations like cd,ls while in the remote server.

It just hangs while performing the cd operation(as shown below)

$ lftp  lftp :> set ftp:ssl-allow true  lftp :> set ftp:ssl-force true  lftp :> set ftp:ssl-protect-data true  lftp :> set ftp:ssl-protect-list true  lftp :> open -p 2121 sos13a-0501a.eu.hedani.net  lftp xxxx-xxxxx.xx.xxxxx.net:> cd /secure/gtd/VTXT  cd `/secure/gtd/VTXT' [Logging in...]   

CentOS7 full disk encryption

Posted: 18 Jul 2022 02:06 AM PDT

I have one physical server and would like to configure full disk encryption for it.

First I was playing around with an virtual machines (CentOS7) and have enabled it during installation:

enter image description here

On reboot I get the following prompt and can successfully unlock the drive:enter image description here

[root@srv~]# lsblk  NAME                                          MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT  sda                                             8:0    0   20G  0 disk  ├─sda1                                          8:1    0    1G  0 part  /boot  └─sda2                                          8:2    0   19G  0 part    └─luks-9ca13c53-317d-42c5-a3ea-c6039274bf38 253:0    0   19G  0 crypt      ├─centos_otrs-root                        253:1    0   17G  0 lvm   /      └─centos_otrs-swap                        253:2    0    2G  0 lvm   [SWAP]  sr0                                            11:0    1 1024M  0 rom  

AFAICS the bootpartition is not encrypted. How could I possibly perform a true full disk encryption and still be able to use the crypt-ssh dracut module for remote unlocking of systems with disk encryption via ssh.

Thanks!

Kali Linux inverted scroll direction

Posted: 18 Jul 2022 02:00 AM PDT

I have a problem with my Kali installation. Since I have updated it today, the mouse scrolling is inverted.

I have tried the .Xmodmap method and also checking 'natural scroll' option but without success.

Could anybody help me?

Exclude the output from ssh and only log the error if found

Posted: 18 Jul 2022 03:01 AM PDT

typeset -f | sshpass -e ssh -o StrictHostKeyChecking=no user@${IPADDRESS} "    $(cat);    IFERROR=$(checkscript);    echo "$IFERROR"" > ${SSHTEMPFILE} 2>&1      

This line...I can't exclude the "user authorized" message from the ssh...IFERROR returns the values I need to track, but also, the "!!! AUTHORIZED USE ONLY !!!" horrible message from the ssh... Already tried something like this, but its not working:

typeset -f | sshpass -e ssh -o StrictHostKeyChecking=no user@${IPADDRESS} "    $(cat);    IFERROR=$(checkscript);    echo "$IFERROR"" | grep -v "AUTHORIZED"  > ${SSHTEMPFILE} 2>&1      

Removing KDE from Fedora21, groupremove not working

Posted: 18 Jul 2022 02:42 AM PDT

I am trying to remove KDE from my Fedora 21 installation in favor of XFCE. I have tried a few different commands and neither of them work.

#yum groupremove "KDE Plasma Workspaces"  

and also

#yum  groupremove  kde-desktop-environment  --exclude=fedora-release\*  

Both fail to find the kde group and remove it. I think it has something to do with the fact that I upgraded from fedora20 with fedup and used the non-product selection.

Force pubkey-auth user to set password at first login

Posted: 18 Jul 2022 04:13 AM PDT

When I create a new user account I ask users to send me a public key, and want to force users to set the password the first time they log in with keypair authentication. If I create an account with an impossible/disabled and expired password, but put a pubkey in their .ssh/authorized_keys file, the user is required to change their password at first login, but cannot enter the current one!

# adduser --disabled-password foo  …  # chage -d0 foo  

What is a more appropriate way to go about this?

No comments:

Post a Comment