Saturday, June 19, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Need Help Running Process at Bootup

Posted: 19 Jun 2021 09:07 AM PDT

Tried guide from here. Edited this file with nano: /etc/systemd/system/myservice.service.

.service file is:

[Unit]  Description=DOESN'T WORK.    [Service]  Type=oneshot  RemainAfterExit=yes  ExecStart=wine /home/otsmanager/NOSTWINDOWS2/theforgottenserver.exe    [Install]  WantedBy=multi-user.target  

I get this output in the console:

otsmanager@167-114-137-36:~/NOSTWINDOWS2$ sudo systemctl status myservice  ● myservice.service - DOESN'T WORK.       Loaded: loaded (/etc/systemd/system/myservice.service; enabled; vendor preset: enabled)       Active: active (exited) since Sat 2021-06-19 16:02:56 CEST; 1h 31min ago      Process: 9394 ExecStart=/usr/bin/wine /home/otsmanager/NOSTWINDOWS2/theforgottenserver.exe (code=exited, status=0/SUCCESS)     Main PID: 9394 (code=exited, status=0/SUCCESS)        Tasks: 0 (limit: 4915)       Memory: 2.6M       CGroup: /system.slice/myservice.service    Jun 19 16:02:56 167-114-137-36 wine[9394]: Compiled on Jun 17 2021 14:44:03 for platform x64  Jun 19 16:02:56 167-114-137-36 wine[9394]:  Jun 19 16:02:56 167-114-137-36 wine[9394]: A server developed by Alejandro Mujica  Jun 19 16:02:56 167-114-137-36 wine[9394]: Visit our forum for updates, support, and resources: http://otland.net/.  Jun 19 16:02:56 167-114-137-36 wine[9394]:  Jun 19 16:02:56 167-114-137-36 wine[9394]: >> Loading config  Jun 19 16:02:56 167-114-137-36 wine[9394]: [Error - ConfigManager::load] cannot open config.lua: No such file or directory  Jun 19 16:02:56 167-114-137-36 wine[9394]: > ERROR: Unable to load config.lua!  Jun 19 16:02:56 167-114-137-36 wine[9394]: >> No services running. The server is NOT online.  Jun 19 16:02:56 167-114-137-36 systemd[1]: Finished DOESN'T WORK..  

Simple script to add directories

Posted: 19 Jun 2021 09:32 AM PDT

I was trying to create a script that monitors the /media/user directory. When a new USB is plugged in the script would run and add the new directory to a program that now uses the new USB drive.

For example:

for D in ls -l /media/user  do      directory add -d D  done  

currently that script just literally adds /media/user/D as many times as there are directories in /media/user not the specific directory names in /media/user/D

The command directory add -d adds the directory and I want it to add /media/user/drive1, /media/user/drive2 etc

Thanks I'm obviously new!

How does tcpdump choose the default NIC to listen on?

Posted: 19 Jun 2021 08:39 AM PDT

From TCPDUMP(1)

   -i interface     --interface=interface            Listen on interface.  If unspecified, tcpdump searches the system interface            list for the lowest numbered, configured up interface (excluding loopback)  

In ip addr output the physical enp0s3 precedes the virtual ifb0, both configured and "up". However tcpdump picks ifb0 by default:

# tcpdump -nn "port 53"  listening on ifb0, link-type EN10MB (Ethernet), capture size 262144 bytes    # ip addr  2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000      link/ether 08:00:27:00:d1:69 brd ff:ff:ff:ff:ff:ff      inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3         valid_lft 86105sec preferred_lft 86105sec      inet6 fe80::c7b0:9bbc:90cd:2bae/64 scope link noprefixroute         valid_lft forever preferred_lft forever  3: ifb0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc netem state UNKNOWN group default qlen 32      link/ether 3a:d6:ac:0d:23:31 brd ff:ff:ff:ff:ff:ff      inet6 fe80::38d6:acff:fe0d:2331/64 scope link         valid_lft forever preferred_lft forever  

I can't automatically connect to bluetooth device from the command line in Lubuntu

Posted: 19 Jun 2021 08:18 AM PDT

I recently changed OS on an old laptop from Ubuntu to Lubuntu for better performance. On Ubuntu, I had a script that ran on startup to automatically connect to my electric drumkit for bluetooth audio.

rfkill unblock bluetooth    sleep 15    bluetoothctl connect E0:B8:36:20:AA:35    

This was my script. However, it doesn't work on Lubuntu.

Lubuntu has bluetooth disabled on startup, and the Bluetooth Device Wizard shows this like so:

Default status of Bluetooth Device Wizard at startup

When I run rfkill unblock bluetooth , the Bluetooth Device Wizard changes to this:

Bluetooth Device Wizard after running rfkill unblock bluetooth

As you can see, I have this new barrier that I didn't have with Ubuntu. I can't use bluetoothctl at this point to connect to the device like I did in Ubuntu, and if I try, I get Failed to connect: org.bluez.Error.NotReady.

So far, I can't find a command which does the same as clicking the 'make pairable' button.

If I click 'enable bluetooth' or 'make pairable' from the Bluetooth Device Wizard, I am able to connect ok using the command line, so the problem isn't with anything to do with bluetoothctl or the device not being trusted or paired correctly.

I am able to connect with the GUI, but the point is, I need it to connect automatically on startup without the GUI.

Does anyone know how I can properly enable bluetooth from the command line in Lubuntu? How can I 'make pairable' from the command line?

And help would be greatly appreciated. There isn't a lot of info online about Lubuntu unfortunately.

How to set a system-level proxy independent of the desktop?

Posted: 19 Jun 2021 08:11 AM PDT

Using shell env. vars like http_proxy we can force a proxy on the programs run from that shell instance. An alternative method is setting them in /etc/environment but this needs a re-login to make the new proxy settings get used.

Is there a way to force a proxy on all apps on the system with these requirements?

  • Ability to freely toggle custom http, https and ftp proxies on and off
  • There should be no need for re-login
  • The method should be independent of the DE (so it should work on i3wm, GNOME, etc)

I'm using Xubuntu 18.04 (with i3wm) but I'm looking for a method as general as possible.

What happens if I close terminal running go-mtpfs without unmounting?

Posted: 19 Jun 2021 07:47 AM PDT

In order to solve several related problems (How to access/mount Android drive in Kubuntu 20.04 with other file manager than Dolphin? - Mount Android media folder in Kubuntu (open file directly instead of copying to cache in Dolphin) I have found the simple solution of using go-mtpfs as said here.

The idea would be to run go-mtpfs /media/MyAndroid and mount the drive to that location. As I don't have that folder, I have created it with root access in Dolphin.

But

~$ go-mtpfs /media/MyAndroid  2021/06/19 16:32:29 OpenSession failed: LIBUSB_ERROR_IO; attempting reset  /usr/bin/fusermount: user has no write access to mountpoint /media/MyAndroid  2021/06/19 16:32:31 mount failed: fusermount exited with code 256  

Instead of bothering with permissions, I have tried to mount in a "normal" folder inside user directory.

Creating a folder called MyAndroid in home, go-mtfs MyAndroid worked fine. But then, instead of unmounting with fusermount -u MyAndroid, I have simply closed the terminal.

The effect was that MyAndroid folder dissapeared but couldn't be recreated (in the same location with the same name). mkdir says it already exists.

What does that mean? How severe are the underlying errors?

I have noticed that running fusermount -u MyAndroid makes the folder visible (and all is back to normal).

But how come it gets invisible at first?

Permission denied to create files on Samba shared folder mounted using CIFS

Posted: 19 Jun 2021 07:43 AM PDT

I have two ubuntu (lubuntu 20.10) machines. On one of the machines, I created a folder and shared it using samba.

My entry in /etc/samba/smb.conf looks like this

[MyShare]    comment = NO COMMENTS    path = /home/user1/Documents/Shared    read only = no    guest ok = yes    writeable = yes  

For the folder /home/user1/Documents/Shared I have set permissions to 777.

From the second machine, I mounted the shared folder using cifs, using the below command

sudo mount -t cifs -o rw,guest,vers=2.0 //user1-pc.local/myshare /media/share  

(user1-pc is the hostname of the first machine.)

Now, I am able to cd into /media/share, view contents of files using cat command. However, I am unable to create new files using touch command.

The command I used was, touch first.txt The error was, touch: cannot touch 'first.txt': Permission denied

I am new to working with permissions in linux. Kindly help me with overcoming the issue.

Extract multiple files at once in the terminal

Posted: 19 Jun 2021 07:56 AM PDT

I have a directory containing hundreds of zip files. I want to be able to select about fifty files and extract them all at once using unzip (or 7z) in the terminal. The files have completely different names, so I cannot use a regular expression to match them all.

As a simplified example, I have the following three files:

41a02d81b1c7b6225b11908c38b820cc.zip  d581697699c4321c32b733a9678.zip  ffb7077a319b2d168d5415b0f59a9e2ba3a.zip  

and I want to extract only two of them without entering the file names manually.

I could print the file names using ls and then copy and paste them into the terminal one-by-one, but obviously this is not optimal. Is there instead a way to use a GUI to select multiple files and then export the list to bash to be processed by a command?

'find -empty -delete' deletes non-empty directories

Posted: 19 Jun 2021 06:29 AM PDT

If I create the following directory structure:

mkdir -p dir1/dir2/dir3/dir4  

then I run find dir1, it returns:

dir1  dir1/dir2  dir1/dir2/dir3  dir1/dir2/dir3/dir4  

If I run find dir1 -empty, it returns only:

dir1/dir2/dir3/dir4  

showing that only dir4 is empty.

However, if I run find dir1 -empty -delete, all four directories get deleted immediately.

I would expect only dir4 to be deleted, then the next time I ran the command, only dir3 would be deleted, and so on. Why does this happen, and how can I delete only dir4 using find?

How to check if more than an instance of file exists and remove it

Posted: 19 Jun 2021 06:33 AM PDT

I have written a very simple script to make backup of my files and databases daily. This is my script:

mongodump --db DB  name=$( date +%F_%H_%M_%S )  tar zvcf /backup/$name-DB-db.tar.gz dump/  rm -rf dump  name=$( date +%F_%H_%M_%S )  tar zvcf /backup/$name-FILES-files.tar.gz /home/NAME/  

It makes two tar.gz files each day, and after a week there will be 14 tar.gz files.

What I want is, suppose the below output of ls -lh:

2021-06-19_16_02_00-FILES-db.tar.gz  2021-06-19_17_02_00-FILES-db.tar.gz  2021-06-19_16_02_00-FILES-files.tar.gz  2021-06-19_17_02_00-FILES-files.tar.gz  2021-06-19_16_02_05-DB-db.tar.gz  2021-06-19_17_02_05-DB-db.tar.gz  2021-06-19_16_02_08-DB-files.tar.gz  2021-06-19_17_02_08-DB-files.tar.gz  

What I want is:

Check if more than file {*FILES-db.tar.gz} exists, then remove the old ones and keep the last one. Else, skip.  Check if more than file {*DB-db.tar.gz} exists, then remove the old ones and keep the last one. Else, skip.  

And the result of ls -lh after that should be something like this:

2021-06-19_17_02_00-FILES-db.tar.gz  2021-06-19_17_02_00-FILES-files.tar.gz  2021-06-19_17_02_05-DB-db.tar.gz  2021-06-19_17_02_08-DB-files.tar.gz  

What function or commands should I use in my bash script?

I think it's better to use this function at the end of my bash script after making backup is done, but if there are better approaches and solutions, I'm eager to hear.

Why do you have to downgrade foreign packages before upgrading Linux Mint?

Posted: 19 Jun 2021 06:00 AM PDT

Just curious, when upgrading from Linux Mint 19 to 20, why is it necessary to downgrade foreign packages? Why can't the upgrade utility simply ignore them? (note: this may be applicable to many Linux disttos, but I only have Mint so that's the only one I can speak to).

How to install motif package on a remote server account

Posted: 19 Jun 2021 06:07 AM PDT

I want to use a software on a remote server account, I need to install the motif package (e.g.libmotif4_2.3.4-1_amd64.deb) first. I do not have access to the root. How can I install the motif manually in my account on the server.

PS: I use PUTTY to join the server account.

How to install flash player for firefox on Ubuntu 20.10

Posted: 19 Jun 2021 06:28 AM PDT

I have tried to follow the steps recommended in https://linuxconfig.org/enable-adobe-flash-for-firefox-on-ubuntu-20-04-focal-fossa-linux

But when I enter sudo apt install flashplugin-installer into my shell, it tells me the package flushplugin-installer could not be found.

REMARK: I know flash is an old software virtually no one uses anymore, but I need it in order to view content embedded in newspaper articles that were published ten years ago.

lspci LnkCap speed is system speed or device speed?

Posted: 19 Jun 2021 07:25 AM PDT

When using lspci:

LnkCap: Port #0, Speed 8GT/s, Width x8, ASPM not supported, Exit Latency L0s unlimited, L1 unlimited  

The Speed 8GT/s is device's max speed? or system's max speed? or it is a negotiated max speed between system and device?

When a gen4 device plug in to a gen3 system, what will be the speed in LnkCap?

Who is responsible for providing `set -o pipefail`

Posted: 19 Jun 2021 09:13 AM PDT

I want strict mode in my scripts. I would also appreciate portability.

set -o pipefail seems compulsory. Yet shellcheck(a static linter) is unhappy that "In POSIX sh, set option pipefail is undefined".

Is it correct? If so, is this a bash solely feature or is it rather prolific?

`stat` output format: truncate a time field

Posted: 19 Jun 2021 06:38 AM PDT

Ref:`stat` output format: truncate a date field

The way they have extracted date from stat command by using:

stat -c '%.10y' file  

My final command looks something like this:

stat -c "%y %i %A %n" *  

I want to modify '%y' such that I only get the time. Instead of '.11' I want to define a range from 12 to 20. Is there a way to do it, and what is this type of formatting called ?

by default the time is:

2021-06-19 13:46:30.201999800 +0530  

but I want:

13:46:30  

Final output:

13:46:29 11540474045615128 -rw-r--r-- __temp__  13:49:03 14918173767136212 -rw-r--r-- __TEM__.txt  13:46:29 9007199255101576 -rw-r--r-- bla.txt  13:49:58 1125899908323122 -rwxr-xr-x f.sh  13:46:30 1125899908323121 -rwxr-xr-x Q1 2.sh  

Which software can I use to develop the GUI (Graphical User Interfaces) on UNIX / Linux?

Posted: 19 Jun 2021 09:46 AM PDT

Many years ago, I used to work for about 10 years with UIMX to develop the GUI (Graphical User Interfaces) for applications running on UNIX.

Nowadays, it seems that UIMX software no longer exists. The wiki page for UIMX is here : https://en.wikipedia.org/wiki/UIMX . But, on that page, all the links to UIMX websites and references seem to be broken as I can't access those links.

Does anyone knows if UIMX still exists today ? If yes, how can we access their website ?

(Also, can anyone recommend other softwares that can be used to create the GUI on UNIX and Linux ?)

How to reset screen

Posted: 19 Jun 2021 09:26 AM PDT

I have an issue with suspend: when I resume my laptop (sometimes) the screen stays off.

Question is: how can I reset the screen?

Because the system works itself i.e. I can switch TTY and reboot the system; I hope there is a way to "reset" just the screen/video due to avoid a reboot losing not-saved work.

PS: as suggested here, the kernel already has CONFIG_DRM_FBDEV_EMULATION=y compiled with


EDIT: lspci output,

00:00.0 Host bridge: Intel Corporation Broadwell-U Host Bridge -OPI (rev 09)  00:02.0 VGA compatible controller: Intel Corporation HD Graphics 5500 (rev 09)  00:03.0 Audio device: Intel Corporation Broadwell-U Audio Controller (rev 09)  00:04.0 Signal processing controller: Intel Corporation Broadwell-U Processor Thermal Subsystem (rev 09)  00:14.0 USB controller: Intel Corporation Wildcat Point-LP USB xHCI Controller (rev 03)  00:16.0 Communication controller: Intel Corporation Wildcat Point-LP MEI Controller #1 (rev 03)  00:1b.0 Audio device: Intel Corporation Wildcat Point-LP High Definition Audio Controller (rev 03)  00:1c.0 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #1 (rev e3)  00:1c.3 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #4 (rev e3)  00:1d.0 USB controller: Intel Corporation Wildcat Point-LP USB EHCI Controller (rev 03)  00:1f.0 ISA bridge: Intel Corporation Wildcat Point-LP LPC Controller (rev 03)  00:1f.2 SATA controller: Intel Corporation Wildcat Point-LP SATA Controller [AHCI Mode] (rev 03)  00:1f.3 SMBus: Intel Corporation Wildcat Point-LP SMBus Controller (rev 03)  00:1f.6 Signal processing controller: Intel Corporation Wildcat Point-LP Thermal Management Controller (rev 03)  01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5249 PCI Express Card Reader (rev 01)  02:00.0 Network controller: Broadcom Inc. and subsidiaries BCM4352 802.11ac Wireless Network Adapter (rev 03)  

Systemd automount with custom command

Posted: 19 Jun 2021 07:59 AM PDT

I use tomb to store some files. I want to use a systemd .automount unit so that whenever I try to access these files, the tomb is automatically mounted. However, tombs are not mounted with mount, they are tomb open does its own specialized setup (of which mounting is only one part).

Is there any way to specify a custom command for systemd .mount/.automount units? Failing that, is it possible to use other units for the same purpose?

How to make multiple parallel calls to function which makes post request in unix?

Posted: 19 Jun 2021 07:29 AM PDT

I am having a function A, which takes an argument fileName and then makes a curl post call with that file to employment Server.The function pseudocode will look as :

function A(filename)  {  // read file from local   // send it to deployment server and via curl/any rest client  // read response code  // store data of filename and response code   }    for all files f in folder :   A(f)  

// See all response code and print data, which all files passed and which all failed

Now if i want to run in parallel I will use :

A(f) & inside for loop  

I have concerns in highlighted part, how can I gather details of filename,response code,since there is no hashmap/dictionary type of support in unix easily available. Also if I print the data in A, then if I keep two lines one to print filename and one to print response code then two lines may not be sequential because of parallel nature. Although I can print both in one line,but I will like to capture results to do some processing later.Is there a easy way around?

How to stop autocomplete on remote ssh server

Posted: 19 Jun 2021 09:48 AM PDT

When I ssh into a remote server (macOS) from a Linux (Mint) laptop, the remote autocomplete engages and completes upon each keystroke. This started fairly recently, but I can't pinpoint exactly when. Once I'm successfully logged in, when I attempt to list the contents of the current directory, once I press 'l', 'ls' appears on the screen. When I type 's' to complete the list command, it now appears as 'lss' (but still executes as 'ls'). Longer commands get very weird, very fast. Typing 'exit' appears as 'exitxititt'. Again, the command still executes, but the command line is a mess.

I have no idea what's happening here--I don't even know how to ask a concise or coherent question about it. It only happens when I log into macOS from a Linux client; Linux-Linux connections are fine (all using same basic shell config; zsh using Oh-My-Zsh). Any idea what's going on? Better yet, how do I make it stop?

4.19 kernel does not enter suspend/sleep and freezes system, but 4.9 works fine

Posted: 19 Jun 2021 07:08 AM PDT

The 4.9 kernel will be EOL in just a few years and Debian 9 (stretch) just next year. So, I'd like to move on.

Everything works perfectly on the 4.9 kernel, including sleep/suspend.

However, each time I try the 4.19 kernel, the one used by Debian 10 by default, it never suspends correctly. When I close the lid, the screen goes black/blank, but it doesn't suspend. What's more, I cannot do anything from this "resumed" empty screen; even ALT-CTL-F1 does not work. Only the power button is an option to reboot/restart the system. (I'm not sure how I'd do the ALT-PrtScr-REISUB on the macbook.)

Whereas my macbook consistently has this problem, I also occasionally (randomly) experience this same problem on my Dell laptop.

On my macbook, I looked in /var/log/syslog and I do not see it even attempting to suspend upon lid close. Perhaps one of the triggers in /proc/acpi/wakeup is not pushing it into suspend state?

I'm running 1.4.1 of pm-utils.

I have not tried the 5.x series of kernels, but I can only assume that they would have the same problem as 4.19.

I'd be willing to run 4.9 indefinitely, even after EOL, with all possible security holes and all, just to keep the suspend functionality, but I'd prefer not to.

Regardless, my question is: how can I get my laptops to suspend and resume using the 4.19 kernel?

Update: it turns out that running pm-suspend (or, more precisely, pm-suspend-hybrid) directly works consistently well on my Dell laptop running 4.19; i.e., just closing the lid and letting /etc/systemd/logind.conf handle it does not work consistently and leaves it in a frozen/hanging state which requires the power button. This makes me suspect that there is some interaction issue with systemd.

bruteforcing keepassxc with bash

Posted: 19 Jun 2021 09:16 AM PDT

I have forgotten part of my password to Keepassxc database (.kdbx with keyfile). The password consists of 20 symbols, 17 of which are known. I have generated the list of all possible combinations using the characters I believe to be used in the unknown part of the password (they are put into charlist.txt) and following small one-liner:

for i in $(cat charlist.txt); do    for j in $(cat charlist.txt); do      for k in $(cat charlist); do        echo $a$i$j$k      done    done  done > output.txt  

Keepassxc allows me to read a password from stdin (either with keepassxc --pw-stdin or with keepassxc-cli; the first one opens the GUI with the stdin input and the second one asks for input in the usual form "enter the password"). However, I cannot wrap my head around the way to do it iteratively. There are 5832 lines in output.txt, which makes manual bruteforcing unfeasible.

How can I pass either the contents of the output.txt or the one-liner output to the keepassxc?

Why does trap not get triggered when sourcing a file that does not exist?

Posted: 19 Jun 2021 05:45 AM PDT

#!/bin/bash    set -eEuo pipefail  set -x    function deploy_cleanup(){      echo "---Cleaning up---"      echo "hello"  }    trap deploy_cleanup ERR    whoami  source euaueoaue  

Outputs:

+ trap deploy_cleanup ERR  + whoami  chris  + source euaueoaue  ./xx.sh: line 14: euaueoaue: No such file or directory    

Is source somehow a special case? The exit code is 1 in any case.


If I remove the set -e then it seems to work correctly:

+ trap deploy_cleanup ERR  + whoami  chris  + source euaueoaue  ./xx.sh: line 14: euaueoaue: No such file or directory  ++ deploy_cleanup  ++ echo '---Cleaning up---'  ---Cleaning up---  ++ echo hello  hello  

What causes Make to delete intermediate files?

Posted: 19 Jun 2021 09:16 AM PDT

I wrote a Makefile and found out that when executing make command, an unexpected rm was executed, after all command in Mmakefile were done. But I didn't write the rm command in the Makefile.

run-%: d/%.out      $<    d/%.out: d/%.c      gcc -o $(subst .c,.out,$<) $<  

Output of running make run-a:

gcc -o d/a.out d/a.c  d/a.out  rm d/a.out  

Notice the trailing rm d/a.out, which I didn't write.

Under what circumstance will the automatic rm command be added?

Have to restart network service after reboot (centos 7)

Posted: 19 Jun 2021 07:06 AM PDT

I am setting up a server which has a 4 ports (em1 to em4) QLogic network interface. It is connected though em3 and the IP address is automatically given by DHCP based on the mac address. I do not have access to the network after booting.So, I have to use systemctl restart network after each boot.

After booting, systemctl status network sometimes gives me this :

network.service - LSB: Bring up/down networking     Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)     Active: failed (Result: exit-code) since ven. 2019-03-15 09:20:18 CET; 2min 21s ago       Docs: man:systemd-sysv-generator(8)    Process: 1365 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)    mars 15 09:19:32 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking...  mars 15 09:19:32 localhost.localdomain network[1365]: Activation de l'interface loopback :  [  OK  ]  mars 15 09:20:18 localhost.localdomain network[1365]: Activation de l'interface em3 :  Erreur : l'activation de la connexion a échoué : La configuration IP n'a pas pu être réservée (aucun adresse disponible, délai d'expiration, etc. )  mars 15 09:20:18 localhost.localdomain network[1365]: [ÉCHOUÉ]  mars 15 09:20:18 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1  mars 15 09:20:18 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.  mars 15 09:20:18 localhost.localdomain systemd[1]: Unit network.service entered failed state.  mars 15 09:20:18 localhost.localdomain systemd[1]: network.service failed.  

Clearly, the network is not activated. But sometimes (apparently randomly), I can also have after a boot:

network.service - LSB: Bring up/down networking     Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)     Active: active (exited) since ven. 2019-03-08 15:05:10 CET; 48s ago       Docs: man:systemd-sysv-generator(8)    Process: 2781 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)    Process: 3019 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)    mars 08 15:05:09 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking...  mars 08 15:05:09 localhost.localdomain network[3019]: Activation de l'interface loopback :  [  OK  ]  mars 08 15:05:09 localhost.localdomain network[3019]: Activation de l'interface em3 :  Connexion activée (chemin D-Bus actif : /org/freedesktop/NetworkManager/ActiveConnection/5)  mars 08 15:05:09 localhost.localdomain network[3019]: [  OK  ]  mars 08 15:05:10 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.  

but although the connection seems activated I have to restart to access the network.

Let me add that /etc/sysconfig/network-scripts/ifcfg-em3 contains :

TYPE=Ethernet  PROXY_METHOD=none  BROWSER_ONLY=no  BOOTPROTO=dhcp  DEFROUTE=yes  IPV4_FAILURE_FATAL=no  IPV6INIT=yes  IPV6_AUTOCONF=yes  IPV6_DEFROUTE=yes  IPV6_FAILURE_FATAL=no  IPV6_ADDR_GEN_MODE=stable-privacy  NAME=em3  UUID=442f***************************  ONBOOT=yes  IPV6_PRIVACY=no  

As ONBOOT is set to yes, I do not know how to fix this issue.

PS : when looking in /var/log/message (only the lines including networkManager), I have on booting time :

 Mar 15 09:10:59 localhost NetworkManager[1148]: <info>  [1552637459.9299] ifcfg-rh: new connection /etc/sysconfig/network-scripts/ifcfg-em3 (442f*****************,"em3")  Mar 15 09:11:01 localhost NetworkManager[1148]: <info>  [1552637461.9915] manager: (em3): new Ethernet device (/org/freedesktop/NetworkManager/Devices/4)  Mar 15 09:11:01 localhost NetworkManager[1148]: <info>  [1552637461.9924] device (em3): state change: unmanaged -> unavailable (reason 'managed') [10 20 2]  Mar 15 09:11:01 localhost kernel: IPv6: ADDRCONF(NETDEV_UP): em3: link is not ready  Mar 15 09:11:02 localhost kernel: bnx2x 0000:01:00.2 em3: using MSI-X  IRQs: sp 85  fp[0] 87 ... fp[7] 94  Mar 15 09:11:02 localhost kernel: bnx2x 0000:01:00.2 em3: NIC Link is Up, 1000 Mbps full duplex, Flow control: none  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.2490] device (em3): link connected  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5636] device (em3): state change: unavailable -> disconnected (reason 'none') [20 30 0]  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5657] policy: auto-activating connection 'em3'  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5668] policy: auto-activating connection 'em3'  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5682] device (em3): Activation: starting connection 'em3' (442f********************)  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5683] device (em3): disconnecting connection 'em3' for new activation request  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5683] device (em3): state change: disconnected -> deactivating (reason 'new-activation') [30 110 60]  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5691] device (em4): Activation: starting connection 'em3' (442f************************)  Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5702] device (em3): state change: deactivating -> disconnected (reason 'new-activation') [110 30 60]  Mar 15 09:11:02 localhost nm-dispatcher: req:2 'down' [em3]: new request (4 scripts)  Mar 15 09:11:02 localhost nm-dispatcher: req:2 'down' [em3]: start running ordered scripts...  Mar 15 09:11:30 localhost NetworkManager[1148]: <info>  [1552637490.3692] device (em4): disconnecting connection 'em3' for new activation request  Mar 15 09:11:30 localhost NetworkManager[1148]: <info>  [1552637490.3704] audit: op="connection-activate" uuid="442f*********************" name="em3" pid=1484 uid=0 result="success"  Mar 15 09:11:30 localhost NetworkManager[1148]: <info>  [1552637490.3909] device (em4): Activation: starting connection 'em3' (442f*******************)  Mar 15 09:11:55 localhost network: Activation de l'interface em3 :  Connexion activée (chemin D-Bus actif : /org/freedesktop/NetworkManager/ActiveConnection/3)  

First, there seems to have interactions between em3 and em4 and at no point I have thing such as the following that happened when systemctl restart network :

localhost NetworkManager[14060]: <info>  [1552637774.4521] device (em3): Activation: starting connection 'em3' (442f**********************)  localhost nm-dispatcher: req:2 'down' [em3]: new request (4 scripts)  localhost nm-dispatcher: req:2 'down' [em3]: start running ordered scripts...  localhost NetworkManager[14060]: <info>  [1552637774.4535] device (em3): state change: disconnected -> prepare (reason 'none') [30 40 0]  localhost NetworkManager[14060]: <info>  [1552637774.4543] device (em3): state change: prepare -> config (reason 'none') [40 50 0]  localhost NetworkManager[14060]: <info>  [1552637774.4779] device (em3): state change: config -> ip-config (reason 'none') [50 70 0]  localhost NetworkManager[14060]: <info>  [1552637774.4787] dhcp4 (em3): activation: beginning transaction (timeout in 45 seconds)  localhost NetworkManager[14060]: <info>  [1552637774.4823] dhcp4 (em3): dhclient started with pid 14582  

How to read iw allowed interface lists?

Posted: 19 Jun 2021 08:06 AM PDT

I wanted to set up promiscuous Wi-Fi monitoring into Wireshark. Tried to do it like I used to with iwconfig, but this system sets me back to managed as soon as I bring the interface back up. I see online posts saying iw can add a monitor interface alongside the managed connection, so you can keep your internet alive while monitoring. Would be great, but:

[loren@Gazp9 ~]$ iw dev wlp3s0 interface add mon0 type monitor  command failed: Operation not permitted (-1)  [loren@Gazp9 ~]$ iw phy wlp3s0 interface add mon0 type monitor  command failed: No such file or directory (-2)  [loren@Gazp9 ~]$ iw phy  Wiphy phy0  [loren@Gazp9 ~]$ iw phy phy0 interface add mon0 type monitor  command failed: Operation not permitted (-1)  

(That's Antergos 4.19.8-arch1-1-ARCH, if it matters.)

So I dug deeper, including Deciphering the output of iw list valid interface combinations here. But I'm still not sure if this means there is no hope of adding the monitor interface. Here are excerpts from my "iw phy" command response:

phy0    Supported interface modes:               * IBSS               * managed               * AP               * AP/VLAN               * monitor               * P2P-client               * P2P-GO               * P2P-device        Supported commands:               * new_interface      (nothing about add interface)        software interface modes (can always be added):               * AP/VLAN               * monitor      valid interface combinations:               * #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1,                 total <= 3, #channels <= 2  

Looks like I can have one monitor for sure. [And after the suggestion here to add sudo to my interface add command, I actually added the monitor interface successfully alongside my managed interface.]

But I'm still curious about:

Why isn't "add interface" listed as a supported command? I've seen it work...

What is the "software interface" monitor that can "always" be added? Isn't my "interface add" connection just software?

Maybe those two questions answer each other? If so, what is a "non-software interface"? Can I magically add actual hardware to my system by typing commands?

Why doesn't "valid interface combinations" list "monitor" at all? I have it working combined with "managed".

Maybe the response to "iw phy" is created by the people who made my Chinese hardware?

And, why in the wiki at https://wireless.wiki.kernel.org/en/users/documentation/iw do only

sudo iw dev wlan1 station get

and

sudo iw dev wlan0 set power_save on

show the use of sudo? None of the "add" commands show it:

iw dev wlan0 interface add fish0 type monitor flags none

But this is intellectual curiosity. I'm happy to have a working monitor and get on with the real project.

How to set up an encrypted directory to be mounted only during samba access?

Posted: 19 Jun 2021 09:06 AM PDT

(This is not about restricting client access, for which ext3 permissions do the trick)

I'd like to encrypt the data on my NAS drive (Buffalo LinkStation Pro with SSH access enabled, if that matters) in a user-friendly way. Currently, a truecrypt container has to be manually mounted via SSH and also unmounted again (unless you solve my timeout question). Using a passwordless (but EFS encrypted) SSH key this is reduced to two PuTTY desktop shortcuts and entering the truecrypt password (until simplified further) for mounting.

However, the ideal solution would be transparent. I first thought about trying to somehow have the share allow for EFS encryption, but that would probably involve more work and EFS for multiple users without an Active Directory server seems to be troublesome.

But now my idea is an automated mount of e.g. an EncFS encrypted directory triggered automatically by a samba access from authorized users (using Windows clients). How can that be achieved? (Bonus points for displaying a honeypot share for unauthorized users...)

No comments:

Post a Comment