Monday, February 21, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


chmod -R g+s with group permissions

Posted: 21 Feb 2022 03:49 AM PST

I have two users inside the group sftpusers.

I have set the folder permissions on /var/sftpuser/data like so:

chmod -R g+s /var/sftpuser/data  

But now I have the problem that a file/folder created by user A can't be deleted by user B. How can I change this?

Why does ethernet interface stop?

Posted: 21 Feb 2022 02:56 AM PST

I am using USB wired modem to connect internet(over eth0 interface) in Debian Bullseye. Sometimes, my ethernet interface suddenly stops. Interestingly :

  1. I can ping to gateway(success),
  2. I can ping to 8.8.8.8(success),
  3. Interface seems up (I checked ip addr show)
  4. I restart interface by ifdown first, and then by ifup, nothing happened, ethernet number changed, but no internet connection.
  5. I checked the output of ip route, it was the same configuration as with eth0 when it was working.

I checked the previous question&answers (such as no connection, etc.). I can ping to 8.8.8.8 but there is not internet.

There is no error about interface and it is up. Only I have to unplug and replug USB cable and then connection re-established.

  1. Is there other ways/commands to check what is the root cause of the problem?

  2. How can I solve it without unplugging/replugging the cable?

How to remove the Title Bar of Gnome applications

Posted: 21 Feb 2022 02:24 AM PST

Problem

I have one Ubuntu20 Desktop(Gnome) and I want it to be fully black and ideal. As reference, I have taken one Ubuntu20 Server and Installed openbox on it.

I hided the title bar of all the applications in OpenBox by editing the configurations in /etc/xdg/openbox/rc.xml and added

<application class="*">        <decor>no</decor>        <maximized>false</maximized>      </application>    </applications>  

So that it will hide the title-bar of all the applications. Also, I am able to achieve my demand. Image shown below as example. openbox

I want to perform the same on Gnome Desktop as well, but I don't know which config file to be edited for the same. Currently, my Gnome Looks like this gnome

Any help for the following is appreciated Thank you.

NOTE: I don't want to use only terminal, but will be using other applications like Firefox, chrome, VLC, etc. without title-bar

Alsa driver only for amplifier?

Posted: 21 Feb 2022 03:41 AM PST

Does ALSA have the concept of a driver only for an amplifier/attenuator? I want to control my amplifier volume when I adjust system volume. I could copy the current soundcard driver and add code to handle my amplifier, but I was hoping to avoid having to maintain the whole driver.

This isn't a Hi-fi application and I'm open to other ways of doing it if e.g. pulseaudio has the right concept. I can already control the amplifier programmatically: I just want to know what bit of the ecosystem to throw dev time at.

Change boot partition to another disk

Posted: 21 Feb 2022 02:50 AM PST

So I installed dual boot fedora and win10 weeks ago. Booting to win10 almost take no time but booting to fedora takes about 1.5 minute (I already checked with systemd-analyze and disabled some services).

Then I noticed that my /boot partition is in HDD sda5, is there anyway to change/move it to my SSD(nvme)? I expect it increase my boot time.lsblk

What should dirname and basename be in this command?

Posted: 21 Feb 2022 03:32 AM PST

With this command, we can recursively unzip archives in a directory and its sub-directories and remain its structure in the current working directory.

find . -name "*.zip" |     xargs -P 5 -I fileName sh -c '      unzip -o -d "$(dirname "fileName")/$(basename -s .zip "fileName")" "fileName"    '  

But when I run it, all the unzipped folders keep in the original directory. Can we hard-code basename and dirname in the bash environment?

How to restrict a jump user (into openSSH jumpbox) to only SSH to another server?

Posted: 21 Feb 2022 03:36 AM PST

i do need your assistance here please.

My Goal: restrict a jump users (into openSSH jumpbox) to only SSH to another server. Users should not be able to list directories, cd or anything else except ssh from jumpbox to another server.

What i have:

  • Active directory users login into jump server then SSH to another servers
  • OpenSSH jump server configured on Ubuntu 20.04

What i've done: edited the /etc/ssh/sshd_config:

Match User testuser AllowTcpForwarding yes X11Forwarding no AllowAgentForwarding no ForceCommand /bin/false

When i do add "ForceCommand /bin/false" testuser cannot even ssh to jump server. Without it, user can login to jump server but can still list directories and cd.

Thanks for your help!

How to make a "dynamic" etc/fstab

Posted: 21 Feb 2022 03:20 AM PST

I have manually installed linux on a USB drive. It works and boots up when I plug the drive into the original computer.

The problem comes when the drive is on a different computer or there are other drives plugged in and my USB is NOT /dev/sdb. I then get an error that the root drive can not be mounted because etc/fstab says root is /dev/sdb1.

How can I make the /etc/fstab either change on bootup or make it automatically use the partition that the kernel is in (my root partition)?

how to reflash printer manually

Posted: 21 Feb 2022 02:42 AM PST

My printer is a HP 1020, and I successfully installed all of the drivers and hot plug, but it still has a problem.

When I reconnect the printer, hot plug can upload firmware to my printer, but when I print the test page, the status become "waiting printer to become available". I try add a printer, but my printer can't be recognized unless I restart CUPS.

My CUPS runs in a Docker container; if I restart CUPS, the container will stop and will not open automatically.

How can I reflash the local printer manually?

Find "latest" path, filename, date, and time at every level of a folder subtree with Bash

Posted: 21 Feb 2022 02:43 AM PST

Using Bash, I want to find for any specified directory and its subtree the filename, creation_date and creation_time for the file last created in that directory. For example, the output would be:

/home/dir    filename0  creation_date0 creation_time0  /home/dir/subdir1    filename1  creation_date1  creation_time1  /home/dir/subdir2    filename2  creation_date2  creation_time2  

Packet Forwarding on Debian 11

Posted: 21 Feb 2022 02:36 AM PST

I am running Debian 11 on a small form factor box.

I am wanting to take all traffic from a network tap upstream on ethernet interface eno2 and output it on sfp+ interface eno8.

I've set up bridging using the following commands:

brctl addbr br0  brctl addif br0 eno2 eno8  ip link set br0 up  

When I do a tcpdump -ni eno2 I see a TON of traffic, which is expected. But when I do a tcpdump -ni eno8 I see very little traffic and it seems to be limited to UDP traffic. I'm wanting all traffic from eno2 to go to eno8.

Somehow it's not bridging the TCP traffic.

The output of ip a

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00      inet 127.0.0.1/8 scope host lo         valid_lft forever preferred_lft forever      inet6 ::1/128 scope host         valid_lft forever preferred_lft forever  2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000      link/ether ac:1f:6b:72:d0:2a brd ff:ff:ff:ff:ff:ff      altname enp7s0      inet 10.0.20.250/24 brd 10.0.50.255 scope global eno1         valid_lft forever preferred_lft forever      inet6 fe80::ae1f:6bff:fe72:d02a/64 scope link         valid_lft forever preferred_lft forever  3: eno2: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000      link/ether ac:1f:6b:72:d0:2b brd ff:ff:ff:ff:ff:ff      altname enp8s0  4: eno3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000      link/ether ac:1f:6b:72:d0:2c brd ff:ff:ff:ff:ff:ff      altname enp11s0f0  5: eno4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000      link/ether ac:1f:6b:72:d0:2d brd ff:ff:ff:ff:ff:ff      altname enp11s0f1  6: eno5: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000      link/ether ac:1f:6b:72:d0:2e brd ff:ff:ff:ff:ff:ff      altname enp11s0f2  7: eno6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000      link/ether ac:1f:6b:72:d0:2f brd ff:ff:ff:ff:ff:ff      altname enp11s0f3  8: eno7: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq master br0 state DOWN group default qlen 1000      link/ether ac:1f:6b:72:d9:ba brd ff:ff:ff:ff:ff:ff      altname enp4s0f0  9: eno8: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000      link/ether ac:1f:6b:72:d9:bb brd ff:ff:ff:ff:ff:ff      altname enp4s0f1  16: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000      link/ether 72:69:25:12:99:da brd ff:ff:ff:ff:ff:ff      inet6 fe80::7069:25ff:fe12:99da/64 scope link         valid_lft forever preferred_lft forever  

Can anyone point me in a direction to solve this issue?

Boot taking forever with a 106 JBOD attached. - WARNING: Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds

Posted: 21 Feb 2022 03:26 AM PST

When attaching a 106 JBOD enclsoures (106 18TB drives via HBA card) to a Debian Bullseye server, i get spammed with the following for each path to any of the 106 drives.

It makes a reboot take a huge amount of time.

Example:

WARNING: Device /dev/sdcf not initialized in udev database even after waiting 10000000 microseconds  

enter image description here

What is causing this? I seem unable to figure out.

GRUB set default entry to the second os

Posted: 21 Feb 2022 03:23 AM PST

I have dual boot Ubuntu and Arch, and I think there must be a way to set the default boot entry for GRUB to boot second OS, e.g., when I reboot from Arch it will boot to Ubuntu, and vice versa. Maybe it's possible by creating a new grub entry, but I don't know how to check previous boot entry, and so select another one.

Install Raspbian to SSD with existing OS

Posted: 21 Feb 2022 02:45 AM PST

I have an SSD which I previously installed a Raspberry Pi image of NextcloudPi.

It works fine, but I would like to switch to Raspbian now.

Preparing to install raspbian to the SSD using the rpi-imager, I cannot find the SSD the list of storage options, nor in the list of disks in Nautilus.

The Rpi has no problem booting from the SSD, but connecting to another computer yields no response.

The SSD is connected to my laptop using a USB-SATA cable.

It worked when I first purchased the SSD, but now that there is an OS on it, I can't access it.

Any ideas?

Perform "systemctl edit" with ansible?

Posted: 21 Feb 2022 02:46 AM PST

I recently learned to perform sudo systemctl edit <SERVICE> instead of editting the service file under /lib/systemd/...

Problem is, I'd like to do this with ansible.

This doesn't seem to be possible with either the systemd module or the service module:

https://docs.ansible.com/ansible/2.10/collections/ansible/builtin/systemd_module.html

https://docs.ansible.com/ansible/2.10/collections/ansible/builtin/service_module.html

Am I missing an option, or will I have to do this manually?

ALSA aplay mono file but returns channel count non available

Posted: 21 Feb 2022 02:39 AM PST

I have a test.wav file that I wanna play through speaker using ALSA. I also have sox installed on the system. All sound cards are installed properly. aplay -L and arecord -L return the correct value.

However I wasn't able to play this test.wav.

aplay -c1 -r 48000 -f S16_LE test.wav  $ Playing WAVE 'test.wav': Signed 16 bit Little Endian, Rate 48000 Hz, Mono    aplay: set_params:1345: Channels count non available  

But when i used sox, the system had no problem and it shows that the file is indeed 1 channel at 16-bit

$ Encoding: Signed PCM    Channels: 1 @ 16-bit    Samplerate: 48000Hz  

I really have no clue what the reason could be. Any help is appreciated! Thank you guys in advance!

EDIT:

  1. My mistake when I hand typed the message printed in the terminal, it is indeed 1@16 bit when I used SoX instead.

  2. .asoundrc

pcm.!default {   type hw   card 0  }  ctl.!default {   type hw   card 0  }  
  1. When I use arecord, I need to specify the channel counts: arecord -c 2 -r 48000 -f S16_LE test.wav Otherwise it will return the same error above. But then I have no problem playing test.wav if it is recorded using arecord. It is weird that I can't play a test.wav if it is imported from elsewhere.

Configuring homebrew for multiple users on MacOs

Posted: 21 Feb 2022 02:40 AM PST

UPDATES

brew --prefix returns:

/usr/local

CONTEXT

A MacOs Mojave desktop is:

  1. initially configured with brew
  2. a new user is added

A new group, brew, is added per instructions and user 2 was added to the brew group:

Change group of installation directory to "brew":

sudo chgrp -R brew $(brew --prefix)/*  

"brew" group given write access:

sudo chmod -R g+w $(brew --prefix)/*  

The goal is to enable the brew command for any user.

ERRORS

brew update returns

warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/error.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/explicit_namespace.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/gem_inflector.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/inflector.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/kernel.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/loader.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/loader/callbacks.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/real_mod_name.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/registry.rb': Permission denied  warning: unable to unlink 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/version.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/error.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/explicit_namespace.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/gem_inflector.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/inflector.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/kernel.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/loader.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/loader/callbacks.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/real_mod_name.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/registry.rb': Permission denied  error: unable to unlink old 'Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.1/lib/zeitwerk/version.rb': Permission denied  Already up-to-date.  

QUESTIONS

The goal is to enable the brew command for user 2. The directory /Library/Homebrew does not exist.

  1. What is causing brew update warning & error messages?
  2. What remedies are available?

Why are there no device unit files in Debian?

Posted: 21 Feb 2022 03:21 AM PST

I've been reading up on systemd and doing a little probing regarding device unit-files.

According to the man pages:

systemd will dynamically create device units for all kernel devices that are marked with the "systemd" udev tag (by default all block and network devices, and a few others). This may be used to define dependencies between devices and other units. To tag a udev device, use "TAG+="systemd"" in the udev rules file, see udev(7) for details.

I have tried looking in /lib/systemd/system, as described in the Debian Wiki:

Unit files provided by Debian are located in the /lib/systemd/system directory.

But these are nowhere to be found.

Yet

~$ sudo systemctl list-units --type=device  

does display devices units (such as disks, sound card, ethernet controller etc...)

I would like to know where I can find device unit files in Debian? or if these do not exist then why not and how is systemd handling these units in Debian?

Any clarifications/comments/insights would be much appreciated.

Hibernate menu option not working, but s2disk works

Posted: 21 Feb 2022 03:38 AM PST

I set up a swap partition on my computer so I could hibernate. It's twice as big as my RAM, and shows up in System Monitor. When I run sudo s2disk, my computer hibernates, and resumes successfully. when I press my power button (which brings up the Power Menu) and click Hibernate, the screen freezes, turns black, turns back on, then shuts down. It doesn't show any sign of resuming when I boot. Is there a way to edit the command the Hibernate button uses? Or fix the issue with the button?

Why am I getting different outputs from parted and fdisk?

Posted: 21 Feb 2022 02:38 AM PST

note: I am a Linux beginner, and trying to learn from the following book: How Linux Works

Running parted -l I get:

Model: KBG30ZMV256G TOSHIBA (nvme)  Disk /dev/nvme0n1: 256GB  Sector size (logical/physical): 512B/512B  Partition Table: gpt  Disk Flags:     Number  Start   End    Size   File system  Name                  Flags   1      1049kB  538MB  537MB  fat32        EFI System Partition  boot, esp   2      538MB   256GB  256GB  ext4         

While running fdisk-l I get:

...    Disk /dev/nvme0n1: 238,5 GiB, 256060514304 bytes, 500118192 sectors  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes  Disklabel type: gpt  Disk identifier: BCB099F2-0FCD-4A90-83C2-A76C3E49682D    Device           Start       End   Sectors  Size Type  /dev/nvme0n1p1    2048   1050623   1048576  512M EFI System  /dev/nvme0n1p2 1050624 500117503 499066880  238G Linux filesystem  

Another thing I noticed when running lsblk -a:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT  ...  nvme0n1     259:0    0 238,5G  0 disk   ├─nvme0n1p1 259:1    0   512M  0 part /boot/efi  └─nvme0n1p2 259:2    0   238G  0 part /  

I have a basic understanding of the difference between creating partitions with fdisk vs. parted; however, I am curious about: Why do I get a different output (and partition sizes) between fdisk and parted?

my system information running uname -a:

Linux  5.3.0-28-generic #30~18.04.1-Ubuntu SMP Fri Jan 17 06:14:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux  

Smbclient protocol negotiation failed

Posted: 21 Feb 2022 03:22 AM PST

Im trying to transfer a file using samba. I started a smbserver and can not connect to it.

Command: smbclient -L //ip address/temp

Error: protocol negotiation failed: NT_STATUS_NOT_SUPPORTED

Using Perl rename to rename files and directories

Posted: 21 Feb 2022 02:37 AM PST

I'm using the Perl rename command line tool to search recursively through a directory to rename any directories as well as files it finds. The issue I'm running into is the rename command will rename a sub-directory of a file then attempt to rename the parent directory of the same file. This will fail because the sub-directory has been renamed resulting in a "No such file or directory"

Command:

rename -f 's/foo/bar/' **  rename -f 's/Foo/Bar/' **  

For example, here is an original file that I would like to replace 'foo' with 'bar'

File:

/test/foo/com/test/foo/FooMain.java  

Failure:

Can't rename /test/foo/com/test/foo/FooMain.java /test/bar/com/test/foo/FooMain.java: No such file or directory  

Preferred File:

/test/bar/com/test/bar/BarMain.java  

You can see from the error message that it's attempting to rename the parent directory but at that point the subdirectory has already been changed resulting in the file not found error. Is there parameters for the rename command that will fix this or do I need to go about this in a different way?

How does dig find my WAN-IP-address? What is "myip.opendns.com" doing?

Posted: 21 Feb 2022 02:47 AM PST

I needed to automatically get my own WAN-IP-address from my router. I found this question and, among others, a solution with dig was proposed:

dig +short myip.opendns.com @resolver1.opendns.com  

It works perfectly, but now I want to understand what it is doing. Here is what I (hope to) understand so far (please correct me, if I am wrong):

  • +short just gives me a short output
  • @resolver1.opendns.com is the DNS server, which is asked what IP address belongs to the given domain

What's not clear to me is myip.opendns.com. If I would write www.spiegel.de instead, I would get the IP address of the domain www.spiegel.de, right? With myip.opendns.com I get the WAN-IP of my router. So is myip.opendns.com just emulating a domain, which is resolved to my router? How does it do it? Where does it get my IP from? And how is it different to what webpages, like e.g., www.wieistmeineip.de, are doing? They also try to get my IP.

In the answer of Krinkle on the question I mentioned, it is stated that this "dns-approach" would be better than the "http-approach".  Why is it better and what is the difference?

There has to be a difference, because the WAN-IP I get from dig +short myip.opendns.com @resolver1.opendns.com (ip1) is the one I can also see in the web interface of my router, whereas www.wieistmeineip.de (and other similar sites too) is giving me another IP address (ip2). I could imagine that my ISP is using some kind of sub-LAN, so that my requests to webservers are going through another (ISP-) router which has ip2, so that www.wieistmeineip.de is just seeing this address (ip2). But, again, what is myip.opendns.com doing then?

Additionally: Opening ip1 from within my LAN is giving me the test website from my RasPi, opening it from the outside of my LAN (mobile internet) does not work. Does it mean, that ip1 is no proper "internet IP" but more like a LAN IP?

mount: wrong fs type, bad option, bad superblock

Posted: 21 Feb 2022 02:45 AM PST

I added a new hard drive (/dev/sdb) to Ubuntu Server 16, ran parted /dev/sdb mklabel gpt and sudo parted /dev/sdb mkpart primary ext4 0G 1074GB. All went fine. Then I tried to mount the drive

mkdir /mnt/storage2  mount /dev/sdb1 /mnt/storage2  

It resulted in

mount: wrong fs type, bad option, bad superblock on /dev/sdb1,         missing codepage or helper program, or other error           In some cases useful info is found in syslog - try         dmesg | tail or so.  

I tried mount -t ext4 /dev/sdb1 /mnt/storage2 with identical outcome. I've done this stuff many times before and have never ran into anything like this. I've already read this mount: wrong fs type, bad option, bad superblock on /dev/sdb on CentOS 6.0 to no avail.

fdisk output regarding the drive

Disk /dev/sdb: 1000 GiB, 1073741824000 bytes, 2097152000 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: gpt  Disk identifier: 0E136427-03AF-48E2-B56B-A467E991629F    Device     Start        End    Sectors  Size Type  /dev/sdb1   2048 2097149951 2097147904 1000G Linux filesystem   

Open Port 25 CentOS 6 with Plesk

Posted: 21 Feb 2022 03:03 AM PST

I've bought an unmanaged dedicated server. Mainly to help me learn.

My email isn't working and the host support have told me I that need to open port 25 to enable smtp. Note I can't send or receive email.

I've used SSH to login and I've tried a few of the sample snippets of code from this forum but I just get a command not found back.

My server is running centOS and it has a Plesk GUI.

I've connected to the server using ssh root@myipaddress

Access a subversion repository on a Windows share from Linux

Posted: 21 Feb 2022 03:22 AM PST

For a long time we put SVN repositories on a Windows share (worked great as only one person was working on one project).

Now, we are moving dev machines away from Windows to Ubuntu and we need to access those repositories from Ubuntu.

I mounted the svn repositories share like this:

//win_serv/svn /mnt/svn cifs credentials=/home/u/.smbcreds,iocharset=utf8,sec=ntlm 0 0  

I managed to change repository URL to /mnt/svn/some_project. However, trying to do svn up causes an error:

svn: E200033: Another process is blocking the working copy database, or the underlying filesystem does not support file locking; if the working copy is on a network filesystem, make sure file locking has been enabled on the file server  svn: E200033: sqlite[S5]: database is locked  svn: E200033: Additional errors:  svn: E200033: sqlite[S5]: database is locked  

Am I doing something wrong (besides the 'svn repository on windows share' fact)?

Is it even possible to access an svn repo on a Windows share from Linux?

Fix EXT4-fs bad geometry (block count exceeds size of device)

Posted: 21 Feb 2022 02:33 AM PST

I have a micro SD card which has a FAT32 partition and an EXT4 partition. The EXT4 partition will no longer mount. dmesg shows the following error:

EXT4-fs (sdb2): bad geometry: block count 2199023779840 exceeds size of device (524288 blocks)  

I've Googled, but still don't fully understand where the problem is (in the partition table? the filesystem?) nor how to fix it. I have attempted a number of solutions:

  • Using testdisk to write the partition table
  • Using fsck to restore the superblock from the backups (I've tried all of them). e.g. fsck.ext4 -b 163840 -B 4096 /dev/sdb2
  • Using fsck -cc to check for bad blocks
  • Using resize2fs to set the size of the partition. Output: The combination of flex_bg and !resize_inode features is not supported by resize2fs.

When I run fsck, it comes up with a bunch of errors (full output below), which it claims to fix. If I run it again, however, it shows the same errors all over again, every time.

How can I fix the bad geometry issue and make my filesystem mountable again? How did this happen?

fsck output:

e2fsck 1.42 (29-Nov-2011)  One or more block group descriptor checksums are invalid.  Fix<y>? yes    Group descriptor 0 checksum is invalid.  FIXED.  Group descriptor 1 checksum is invalid.  FIXED.  Group descriptor 2 checksum is invalid.  FIXED.  Group descriptor 3 checksum is invalid.  FIXED.  Group descriptor 4 checksum is invalid.  FIXED.  Group descriptor 5 checksum is invalid.  FIXED.  Group descriptor 6 checksum is invalid.  FIXED.  Group descriptor 7 checksum is invalid.  FIXED.  Group descriptor 8 checksum is invalid.  FIXED.  Group descriptor 9 checksum is invalid.  FIXED.  Group descriptor 10 checksum is invalid.  FIXED.  Group descriptor 11 checksum is invalid.  FIXED.  Group descriptor 12 checksum is invalid.  FIXED.  Group descriptor 13 checksum is invalid.  FIXED.  Group descriptor 14 checksum is invalid.  FIXED.  Group descriptor 15 checksum is invalid.  FIXED.  /dev/sdb2 contains a file system with errors, check forced.  Pass 1: Checking inodes, blocks, and sizes  Pass 2: Checking directory structure  Pass 3: Checking directory connectivity  Pass 4: Checking reference counts  Pass 5: Checking group summary information  Free blocks count wrong for group #0 (24465, counted=24466).  Fix<y>? yes    Free blocks count wrong for group #2 (4788, counted=5812).  Fix<y>? yes    Free blocks count wrong for group #3 (8710, counted=8881).  Fix<y>? yes    Free blocks count wrong for group #8 (5682, counted=22066).  Fix<y>? yes    Free blocks count wrong (299742, counted=317322).  Fix<y>? yes    Inode bitmap differences:  -(8193--8194) -8197 -8208 -(8225--8226) -8229 -(8240--8241) -(8257--8258) -8261 -8272 -8274 -(8289--8290) -8293 -(8304--8306) -(8321--8322) -8325 -8336 -8339 -16387 -16389 -16400 -16419 -16421 -(16432--16433) -16451 -16453 -16464 -16466 -16483 -16485 -(16496--16498) -16515 -16517 -16528 -16531 -24577 -24579 -24581 -24592 -24609 -24611 -24613 -(24624--24625) -24641 -24643 -24645 -24656 -24658 -24673 -24675 -24677 -(24688--24690) -24705 -24707 -24709 -24720 -24723 -(32770--32771) -32773 -32784 -(32802--32803) -32805 -(32816--32817) -(32834--32835) -32837 -32848 -32850 -(32866--32867) -32869 -(32880--32882) -(32898--32899) -32901 -32912 -32915 -(40961--40963) -40965 -40976 -(40993--40995) -40997 -(41008--41009) -(41025--41027) -41029 -41040 -41042 -(41057--41059) -41061 -(41072--41074) -(41089--41091) -41093 -41104 -41107 -(49156--49157) -49168 -(49188--49189) -(49200--49201) -(49220--49221) -49232 -49234 -(49252--49253) -(49264--49266) -(49284--49285) -49296 -49299 -57345 -(57348--57349) -57360 -57377 -(57380--57381) -(57392--57393) -57409 -(57412--57413) -57424 -57426 -57441 -(57444--57445) -(57456--57458) -57473 -(57476--57477) -57488 -57491 -65538 -(65540--65541) -65552 -65570 -(65572--65573) -(65584--65585) -65602 -(65604--65605) -65616 -65618 -65634 -(65636--65637) -(65648--65650) -65666 -(65668--65669) -65680 -65683 -(73729--73730) -(73732--73733) -73744 -(73761--73762) -(73764--73765) -(73776--73777) -(73793--73794) -(73796--73797) -73808 -73810 -(73825--73826) -(73828--73829) -(73840--73842) -(73857--73858) -(73860--73861) -73872 -73875 -(81923--81925) -81936 -(81955--81957) -(81968--81969) -(81987--81989) -82000 -82002 -(82019--82021) -(82032--82034) -(82051--82053) -82064 -82067 -90113 -(90115--90117) -90128 -90145 -(90147--90149) -(90160--90161) -90177 -(90179--90181) -90192 -90194 -90209 -(90211--90213) -(90224--90226) -90241 -(90243--90245) -90256 -90259 -(98306--98309) -98320 -(98338--98341) -(98352--98353) -(98370--98373) -98384 -98386 -(98402--98405) -(98416--98418) -(98434--98437) -98448 -98451 -(106497--106501) -106512 -(106529--106533) -(106544--106545) -(106561--106565) -106576 -106578 -(106593--106597) -(106608--106610) -(106625--106629) -106640 -106643 -114694 -114704 -114726 -(114736--114737) -114758 -114768 -114770 -114790 -(114800--114802) -114822 -114832 -114835 -122881 -122886 -122896 -122913 -122918 -(122928--122929) -122945 -122950 -122960 -122962 -122977 -122982 -(122992--122994) -123009 -123014 -123024 -123027  Fix<y>? yes    Free inodes count wrong for group #0 (7803, counted=7804).  Fix<y>? yes    Free inodes count wrong (130683, counted=130684).  Fix<y>? yes      /dev/sdb2: ***** FILE SYSTEM WAS MODIFIED *****  /dev/sdb2: 388/131072 files (22.7% non-contiguous), 206966/524288 blocks  

fdisk -l output:

Disk /dev/sdb: 16.0 GB, 16012804096 bytes  64 heads, 32 sectors/track, 15271 cylinders, total 31275008 sectors  Units = sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes  Disk identifier: 0x0005ce93       Device Boot      Start         End      Blocks   Id  System  /dev/sdb1   *        2048    27080703    13539328    c  W95 FAT32 (LBA)  /dev/sdb2        27080704    31275007     2097152   83  Linux  

find: prune does not ignore specified path

Posted: 21 Feb 2022 03:34 AM PST

I need to exclude .git from my find search. To achive that, I am using the -path ./.git -prune switch:

$ find . -path ./.git -prune -o \( -type f -o -type l -o -type d \) | grep '.git'  ./.git  

However, even though this skips the contents of the .git directory, it lists the directory itself. It works when I add -path ./.git -prune -o -print -a

find . -path ./.git -prune -o -print -a \( -type f -o -type l -o -type d \) | grep '.git'  

Why is this necessary. I thought that both commands should have same output. The second syntax is quite ugly.

Removing a directory from PATH

Posted: 21 Feb 2022 02:25 AM PST

I'm trying to compile wxWidgets using MingW, and I have cygwin in my path, which seems to conflict. So I would like to remove /d/Programme/cygwin/bin from the PATH variable and I wonder if there is some elegant way to do this.

The naive approach would be to echo it to a file, remove it manually and source it, but I bet there is better approach to this.

No comments:

Post a Comment