Thursday, September 9, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to make the libvirt VM installed under the regular user boot during the system bootup?

Posted: 09 Sep 2021 09:30 AM PDT

I installed a virtual machine under a regular user(in other words, not under root user) with virt-install and configured this VM to boot automatically:

$ virsh dominfo vm  Id:             1  Name:           vm  UUID:           eef95dd6-5efe-4059-8dcc-3e35db12f55d  OS Type:        hvm  State:          running  CPU(s):         4  CPU time:       253.7s  Max memory:     4194304 KiB  Used memory:    4194304 KiB  Persistent:     yes  Autostart:      enable  Managed save:   no  Security model: none  Security DOI:   0    $ ls -l /home/user/.config/libvirt/qemu/autostart/  total 0  lrwxrwxrwx 1 user user 47 Apr 30 16:59 vm.xml -> /home/user/.config/libvirt/qemu/vm.xml  $  

The vm indeed starts, but only when the regular user has logged in. How to make the vm boot already during the system bootup when the regular user has not yet logged in? I also made a symlink under /etc/libvirt/qemu/autostart/, but this did not help.

What's the most appropriate directory where to place development software shared between users?

Posted: 09 Sep 2021 09:25 AM PDT

About share data (files and directories) among users within the same machine, has sense use the /srv directory it according with:

I am assuming it is still valid or recommendable - correct me if that changed

But - What should be the directory to be shared for user/groups but for software oriented for development? i.e: Java, Maven, Gradle (all available from a .tar.gz file). It because has no sense have repeated the same unpacked directory for each user.

How to get socket statistics without ss

Posted: 09 Sep 2021 09:24 AM PDT

The question may sound silly but I'm trying to make a tool that uses ss data. Sadly I'm having some troubles regarding output format parsing (too much randomness depending on version and system).

So, I think I might just get the data without using ss.

Basically I need to list TCP and UDP connections.

Columns I'm using are protocol, state, local and peer address/port and users. After some research I'm not sure where can I get this informations.

Any idea ?

Openbox problems after removing Monero GUI Client

Posted: 09 Sep 2021 09:12 AM PDT

I have a problem with openbox menu, after i removed monero gui client and monero, the entry in openbox menu didn't remove and it shows me that file is missing. I use obmenu-generator and i'm on artix gnu/linux.

How to get only stdout_lines with Ansible using mail module

Posted: 09 Sep 2021 08:26 AM PDT

I'm using ansible to scan hosts with clam antivirus and I'm receiving reports via email. Reports contain everything and I want only to receive stdout lines. Is there any way to accomplish this? I wrote email template according to https://gist.github.com/halberom/0aea275632d2b47af0536e5def01d4d2 although only thing that is not the same is that I've piped to nice json:

The {{ host }} says {{ hostvars[host]['result']['stdout'] | to_nice_json }}  

The error I get is:

Unable to convert data using to_nice_json, falling back to to_json: 'dict object' has no attribute 'stdout'. the task includes an option with an undefined variable the error was ansible no_log:false

If I remove ['stdout'] then email report looks like this:

ClamAV scan was performed on host_server  {      "changed": true,      "msg": "All items completed",      "results": [          {              "ansible_loop_var": "item",              "changed": true,              "cmd": [                  "clamscan",                  "-r",                  "-i",                  "/usr/bin"              ],              "delta": "0:00:37.293719",              "end": "2021-09-09 18:47:55.626094",              "failed": false,              "invocation": {                  "module_args": {                      "_raw_params": "clamscan -r -i /usr/bin",                      "_uses_shell": false,                      "argv": null,                      "chdir": null,                      "creates": null,                      "executable": null,                      "removes": null,                      "stdin": null,                      "stdin_add_newline": true,                      "strip_empty_ends": true,                      "warn": true                  }              },              "item": "/usr/bin",              "rc": 0,              "start": "2021-09-09 18:47:18.332375",              "stderr": "",              "stderr_lines": [],              "stdout": "\n----------- SCAN SUMMARY -----------\nKnown viruses: 8563204\nEngine version: 0.103.2\nScanned directories: 1\nScanned files: 701\nInfected files: 0\nData scanned: 110.08 MB\nData read: 109.50 MB (ratio 1.01:1)\nTime: 37.113 sec (0 m 37 s)\nStart Date: 2021:09:09 18:47:18\nEnd Date:   2021:09:09 18:47:55",              "stdout_lines": [                  "",                  "----------- SCAN SUMMARY -----------",                  "Known viruses: 8563204",                  "Engine version: 0.103.2",                  "Scanned directories: 1",                  "Scanned files: 701",                  "Infected files: 0",                  "Data scanned: 110.08 MB",                  "Data read: 109.50 MB (ratio 1.01:1)",                  "Time: 37.113 sec (0 m 37 s)",                  "Start Date: 2021:09:09 18:47:18",                  "End Date: 2021:09:09 18:47:55 "              ]          }      ]  }  

Is there a way to accomplish getting only stdout_lines in my report? I tried with grep in the shell command but failed

How can I use awk, grep, and other tools to replace a single character in a file?

Posted: 09 Sep 2021 07:54 AM PDT

I am trying to replace a single a single IP in a string, the current shell script i am using to find this data is

DATA

WIREGUARD_CONFIG="# 10.0.0.0/8 fd00:00:00::0/8 0.0.0.0:51820 <RANDOM_DATA> 10.0.0.1,fd00:00:00::1 1280 25 0.0.0.0/0,::/0"  

Script

grep "/32" ${WIREGUARD_CONFIG} | tail -n1 | awk '{print $3}' | cut -d "/" -f 1 | cut -d "." -f 4  

This will give us 0 but i want to change this to a different number. and save this data to a file.

How in the world would i do that effetely?

The things i have tried, the problem with this code is that after 10.0.1.255 it will just loop to 10.0.1.1

THIRD_IP_IN_RANGE=$(head -n1 ${WIREGUARD_CONFIG} | awk '{print $2}' | cut -d "/" -f 1 | cut -d "." -f 3)  NEXT_IP_RANGE=$((THIRD_IP_IN_RANGE + 1))  sed -i "1s/${THIRD_IP_IN_RANGE}/${NEXT_IP_RANGE}/3" ${WIREGUARD_CONFIG}  

After reboot modem is not detected anymore. "unable to enumerate USB device"

Posted: 09 Sep 2021 07:37 AM PDT

I have a 5G modem attached to a m.2 port. When powering up the device it detects the modem just fine attached the the USB bus. After reboot, the modem is not detected anymore by the kernel or lspci.

Removing the USB hub from the PCI bus and triggering a rescan produces these kernel messages: https://hastebin.com/uvebubegey

...  [14038.634515] hub 2-0:1.0: 4 ports detected  [14044.190074] xhci_hcd 0000:00:15.0: Timeout while waiting for setup device command  [14049.566047] xhci_hcd 0000:00:15.0: Timeout while waiting for setup device command  [14049.778034] usb 2-4: device not accepting address 2, error -62  [14055.198044] xhci_hcd 0000:00:15.0: Timeout while waiting for setup device command  [14060.574025] xhci_hcd 0000:00:15.0: Timeout while waiting for setup device command  [14060.785998] usb 2-4: device not accepting address 3, error -62  [14060.818048] usb usb2-port4: attempt power cycle  [14066.973999] xhci_hcd 0000:00:15.0: Timeout while waiting for setup device command  [14072.349979] xhci_hcd 0000:00:15.0: Timeout while waiting for setup device command  [14072.561960] usb 2-4: device not accepting address 4, error -62  [14077.981971] xhci_hcd 0000:00:15.0: Timeout while waiting for setup device command  [14083.357937] xhci_hcd 0000:00:15.0: Timeout while waiting for setup device command  [14083.569924] usb 2-4: device not accepting address 5, error -62  [14083.601954] usb usb2-port4: unable to enumerate USB device  

Same thing happens when I try to power cycle the USB port by sending 0 and 1 to /sys/bus/usb/devices/usb2/authorized.

And the same thing happens with kernel 4.19 and 5.10.

How could I force this modem to get detected without removing the power from this device?

How to say from a Linux block device if it is trimmable or not?

Posted: 09 Sep 2021 07:58 AM PDT

Everything is in the title.

fstrim requires it to be mounted, and it is not very verbose. blkdiscard could say, but also that would require a write operation.

Can I somehow say from a block device if trimming/discarding is supported on it, without actually trying to trim/discard something on it?

How to get a list of the deepest unique directory paths excluding any base / parent paths

Posted: 09 Sep 2021 08:11 AM PDT

I would like a solution that works on Linux and is portable across shells i.e. not just bash and filesystems i.e drvfs or btrfs NB: directory names can contain spaces

With find I can produce a list of all paths rooted within a folder like this:

find -type d  .  ./a dir  ./a dir/20210101  ./a dir/20210101/bin  ./a dir/20210101/etc  ./a dir/20210101/var  ./a dir/20210101/var/log  ./a dir/20211201  ./b dir  ./b dir/20210212  ./b dir/20210212/bin  ./b dir/20210212/etc  ./c dir  ./d dir  

I would however like to exclude "base" or "parent" paths that are already included in the the deepest unique path. Please also help with the correct terms to use to describe this as I feel I am not using the optimal description.

I can do it with a basic script but assume there is a more elegant way using one of the following:

  • find
  • ls

Here is my script:

save_ifs=$IFS;  IFS=$'\n';  prev_path="";  for path in $(find -depth -type d); do        if [ ! ${#path} -lt ${#prev_path} ]; then          echo $path;      fi            prev_path=$path;    done  

and its output - which is the desired output

./a dir/20210101/bin  ./a dir/20210101/etc  ./a dir/20210101/var/log  ./a dir/20211201  ./b dir/20210212/bin  ./b dir/20210212/etc  ./c dir  ./d dir/20210711  

pid for child of child processes

Posted: 09 Sep 2021 07:49 AM PDT

i'm running a script that calls a child script that in turn calls other child scripts and processes.

some of the child processes use a lot of disk io and cpu, and overheats the cpu, causing a crash or errors. i guess i can thank intel for that. this isn't a request for information to fix my cpu.

i want to pause the script for 2mins every 5mins, to allow the cpu to cool down.

this is in my parent script:

for dir in * ; do          if [ -d "$d" ]; then                  printf "$dir."                  ./subscript.sh "${dir}" &                           echo "$!" > ./"${dir}.pid" &                           ./pauser.sh "${dir}"                  #rm ./"{d}.pid"          touch "{d}.pid.ended"          fi  done  

and this is my pauser.sh script:

#!/bin/bash  pauser() {          printf "@" &&                   sleep "${2}m" &&                   check_running "${1}" &&                   kill -STOP "$(cat ${1}.pid)" &&                   sleep "${3}m" &&                   printf "." &&                   check_running "${1}" &&                   kill -CONT "$(cat ${1}.pid)"  }  check_running() {          if [ -f "${1}.pid.ended" ]; then                  rm "${1}.pid.ended"                  exit 0          fi  }  while true  do          if [ -f "${1}.pid.ended" ]; then                  rm "${1}.pid.ended"                  exit 0          else                  pauser "${1}" "5" "2"          fi  done  

this pauser script doesn't pause the child of child processes, i think because the child of child scripts/processes have different pid's.

i've read that child of child processes can be grouped, if so, how do i pause and resume the entire group of child processes from the parent script?

Missing console output after grub

Posted: 09 Sep 2021 06:34 AM PDT

I'm trying to boot CentOs already installed on an appliance. This appliance has only two input connectors:

  • 1 USB port, where I plugged in a USB hub, to which I connected a keyboard
  • 1 Male 9 Pin Serial port / RS232

It also has 2 Gigabit Ethernet ports, one of which is used for remote administration with Intel BMC and Intel SOL (Serial-Over-LAN)

I'm connected to the server via the Intel SOL.

Now the problem: when I boot the server, I successfully reach the Grub loader and I can select the entries, but after that, the output shows the character, and nothing more happens, whichever the entry I select.

I tried to boot from a live Centos image (using a USB Pendrive connected to the USB hub) but also, in this case, I can see the Grub loader, I can select the desired entry, but then it stuck with character.

I also tried to:

  • disable the quiet mode from the kernel flags
  • add init=/bin/bash to the kernel lines
  • add console=tty0 console=ttyS0 console=tty1 console=ttyS1 to the kernel lines
  • in Grub Rescue mode, chain load and boot the grubx64.efi from the OS already installed and from the USB Pendrive

I'm honestly out of options now, any suggestion would be greatly appreciated.

Delete lines matching pattern in file1 and save these deleted lines to file2

Posted: 09 Sep 2021 08:39 AM PDT

I have file1, and I need to delete lines matching a pattern. But I would like to save these deleted lines in another file2.

sed    '/zz/!d' file1 > file2  sed -i '/zz/d' file1  

Is there a way to combine these commands into one ?

Or is there a more elegant way to do it?

How to solve the issue that a remote Terminal screen is messed up when using `expect`? (usually after a resizing)

Posted: 09 Sep 2021 08:50 AM PDT

Using expect and password auto-login to remote with ssh, when resizing the window, stty size report old size. Cause commands like vim and less mess up.

sum values in a file if keys match another file and based on conditional

Posted: 09 Sep 2021 09:38 AM PDT

I have two files.

file1

NC_000001.11_NM_001005484.2 69270   234 69037  NC_000001.11_NM_001005484.2 69511   475 69037  NC_000001.11_NM_001005484.2 69761   725 69037  NC_000001.11_NM_001385640.1 942155  20  942136    

file2

NC_000001.11_NM_001005484.2 65565   9  NC_000001.11_NM_001005484.2 69037   969  NC_000001.11_NM_001385640.1 924432  517  NC_000001.11_NM_001385640.1 925922  92  NC_000001.11_NM_001385640.1 930155  182  NC_000001.11_NM_001385640.1 931039  51  NC_000001.11_NM_001385640.1 935772  125  NC_000001.11_NM_001385640.1 939040  90  NC_000001.11_NM_001385640.1 939272  141  NC_000001.11_NM_001385640.1 941144  163  NC_000001.11_NM_001385640.1 942136  116  NC_000001.11_NM_001385640.1 942410  79  NC_000001.11_NM_001385640.1 942559  500  NC_000001.11_NM_001385640.1 943253  125  NC_000001.11_NM_001385640.1 943698  111  NC_000001.11_NM_001385640.1 943908  243  

If column 1 in file 1 matches column 1 in file 2 AND the value in column 2 of file 2 is less than the value of column 4 in file 1, I would like to sum column 3 of file 2 over the matching keys. Then I would like to print each line from file1 with its corresponding sum from file2.

Expected output

NC_000001.11_NM_001005484.2 69270   234 69037  9  NC_000001.11_NM_001005484.2 69511   475 69037  9  NC_000001.11_NM_001005484.2 69761   725 69037  9  NC_000001.11_NM_001385640.1 942155  20  942136 1361  

I'm not experienced enough with awk or python to get this right but have tinkered around for a couple of days now. I would appreciate any help with this.

For each line in a file, print fields from specific column to NF if those values are less than value in another field

Posted: 09 Sep 2021 07:11 AM PDT

I have a file with the following format where the number of fields per row is variable:

NC_000001.11_NM_001005484.2 69270   234 69037   65565   69037  NC_000001.11_NM_001005484.2 69511   475 69037   65565   69037  NC_000001.11_NM_001005484.2 69761   725 69037   65565   69037  NC_000001.11_NM_001385640.1 942155  20  942136  924432  925922  930155  931039  935772 939040   939272  941144  942136  942410  942559  943253  943698  943908    

For each line, I would like to print the first four fields. For the remaining fields ($5 to NF), I want to print the field if the values in those fields is less than the value in $4.

Example output:

NC_000001.11_NM_001005484.2 69270   234 69037   65565     NC_000001.11_NM_001005484.2 69511   475 69037   65565     NC_000001.11_NM_001005484.2 69761   725 69037   65565     NC_000001.11_NM_001385640.1 942155  20  942136  924432  925922  930155  931039  935772 939040   939272  941144    

I've tried to wrap my head around a number of different awk options and have failed miserably. New to awk and would appreciate any help with this.

Write AWK command's result into new CSV file

Posted: 09 Sep 2021 09:13 AM PDT

I have full list of files which contains this below texts.

Sun Aug 22 19:00:00 2021          User-Name = "407359687"          Acct-Status-Type = Interim-Update          Acct-Output-Octets = 3263901190          Acct-Session-Id = "PPP3092201SSG0001006b0a55AABODS"          Acct-Session-Time = 1146851          Acct-Output-Gigawords = 15          Event-Timestamp = "Aug 22 2021 18:55:32 +08"          Timestamp = 1629630000  

My goal is to get the important rows and save it into new CSV file and i'm using this below AWK command to sort the values from text but I don't know to write it into CSV file.

awk '{if ($1 == "User-Name")      {start=1; wholeLine=""; wholeLine = wholeLine$3;}      if ($1$2$3 =="Acct-Status-Type=Interim-Update"||$1$2$3 =="Acct-Status-Type=Stop")      {wholeLine=wholeLine","$3;}      else if ($1$2$3 =="Acct-Status-Type=Start")      {start=0;wholeLine=""}      if (($1=="Acct-Output-Octets")&&(start==1))      {wholeLine=wholeLine","$3;}      if (($1=="Acct-Session-Id")&&(start==1))      {wholeLine=wholeLine","$3;}      if (($1=="Acct-Session-Time")&&(start==1))      {wholeLine=wholeLine","$3;}      if (($1=="Acct-Output-Gigawords")&&(start==1))       {wholeLine=wholeLine","$3;}       if (($1=="Event-Timestamp")&&(start==1))      {timeStamp="";timeStamp=$3" "$4" "$5" "$6" "$7;wholeLine=wholeLine","timeStamp}      if (($1=="Timestamp")&&(start==1))      {wholeLine=wholeLine","$3;}      if (($1=="")&&(start==1))      {start=0;print wholeLine}}' /home/file/detail-20210822  

My expected CVS result should be look like this.

"405947674",Interim-Update,1079493624,"PPP3082110SSG000100be4a72AAAk5Y",25440,0,"Aug 22 2021 19:00:43 +08",1629630315  

No output: busybox find . -exec sh -c ' readlink -f "$1" | tail -n +2 ' sh {} \;

Posted: 09 Sep 2021 07:01 AM PDT

I got access to only Busybox 1.31.1

I originally wanted to remove the current working directory of my output (the single dot).

Example:

/prueba$ ls  uno dos tres  

When I:

$ busybox find .  .  ./uno  ./dos  ./tres  

That's easily done with either:

busybox find . -not -path .  busybox find . -maxdepth 1  

Now, what I tried before is:

busybox find . -exec sh -c ' readlink -f "$1" | tail -n +2 ' sh {} \;  

Which prints nothing. If verbose output is activated:

==> standard input <==  ==> standard input <==  ==> standard input <==  ==> standard input <==  ==> standard input <==  

Completely different output if the line address is one:

busybox find . -exec sh -c ' readlink -f "$1" | tail -n +1 ' sh {} \;  
==> standard input <==  /tmp/prueba  ==> standard input <==  /tmp/prueba/tres  ==> standard input <==  /tmp/prueba/dos  ==> standard input <==  /tmp/prueba/uno  

What's going on?

Use Docker on a systemd disabled VM

Posted: 09 Sep 2021 07:10 AM PDT

I am provided by a VM running Ubuntu 18.04.5 LTS which has systemd disabled.

I have root access on it.

I am trying to run docker on it which is installed but I get error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I cannot run systemctl as I get error System has not been booted with systemd as init system (PID 1). Can't operate.

I ran the command sudo service --status-all and amongst the listed services Docker's service was not found.

The OS is using sys-v as init.

Is there a way I can user docker here?

PS: I asked the same question on ask ubuntu and a guy in comments told me to ask here.

Edit: As suggested in comments I tried to start docker daemon manually by using dockerd but it gave error

failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.6.1: can't initialize iptables table `nat': Permission denied (you must be root).

I am root, my terminal prompt is root@05a4a97d8391:~# still I am executing dockerd using sudo and I did do sudo -i and sudo su - and my prompt remains same.

Spawn a terminal and redirect its stdout to original process

Posted: 09 Sep 2021 06:51 AM PDT

I'm trying to spawn a new terminal, execute a few commands and pipe their output to stdin of the original process. A mwe of what I'm trying to do is the following bash one-liner:

$ xterm -e sh -c "echo -e 'foo\nbar' > /proc/$$/fd/1" | grep foo  

where I spawn a new xterm window, print foo\nbar and try to redirect it to stdin of the shell I'm executing this command from. To see if it works I then pipe it into grep.

The code above prints both foo and bar to stdout instead of just foo, but I'm not sure why. How can I fix this?

EDIT: the real case implementation of this is a file picker that uses fzf:

#!/usr/bin/env bash    function open() {    # takes a bunch of file names (either passed as arguments or from stdin) and    # opens them    true  }    # This is what I have now  alacritty \     -e sh -c 'fzf -m --prompt="Open> " --border=horizontal --print0 \                | (nohup xargs -0 bash -c '\''open "$@"'\'' _ &>/dev/null &)'    # This is what I'm trying to do  # alacritty \  #  -e sh -c "fzf -m --prompt='Open> ' --border=horizontal > /proc/$$/fd/1" \  #  | open  

What do the Block Device Capability flags mean?

Posted: 09 Sep 2021 07:08 AM PDT

Linux block devices in sysfs have a capability file, partly documented here. Well, one is documented.

Looking in genhd.h as it suggests, there are others. Is there any documentation on them, or does anyone know what they mean?

Listed here for convenience:

  • GENHD_FL_REMOVABLE
  • GENHD_FL_CD
  • GENHD_FL_UP
  • GENHD_FL_SUPPRESS_PARTITION_INFO
  • GENHD_FL_EXT_DEVT
  • GENHD_FL_NATIVE_CAPACITY
  • GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE
  • GENHD_FL_NO_PART_SCAN
  • GENHD_FL_HIDDEN

More specifically,

Removable? Like removable USB drives? Relation to /sys/block/*/removable? Redundant?

Whats extended devt?

suppress partitions?

no part scan? Different from suppressing partitions?

UP?

CD? Like "this is a CD drive"? Why? Means something else?

Native capacity?

Allow UFW rules in specific IP range

Posted: 09 Sep 2021 08:04 AM PDT

I need to setup some firewall rules but I do not want to open them to public since I am running an nginx server, how can I allow the follow rules only locally from IP address 192.168.178.0 to .64?

sudo ufw allow 80/tcp

sudo ufw allow 53/tcp

sudo ufw allow 53/udp

sudo ufw allow 67/tcp

sudo ufw allow 67/udp

Splitting long commands in shell scripts

Posted: 09 Sep 2021 09:38 AM PDT

I have been writing Unix shell scripts, but I'm inexperienced in proper formatting. There were many instances where I had to write long lines to be executed as a single command.

Question is: Is there a way that I can split a single long line of a shell command into multiple lines, yet make it execute as a single command?

reset failed login count / unlock aix/UNIX account

Posted: 09 Sep 2021 07:38 AM PDT

As system administrator it is necessary to lock / unlock users or to reset failed login count.

let's look how we can perform lock / unlock users or to reset on UNIX/AIX

Shared folder does not appear in guest CentOS (Windows host), using VMWare

Posted: 09 Sep 2021 09:18 AM PDT

I've been trying to share a folder between my guest, Cent OS, and host, Windows 10, using VMWare Workstation 14 Player. The easiest way, drag&dropping files from host to guest, does not work properly, as one or more files always ends up being of a smaller file size and thus corrupted, even though there is enough storage space in the virtual machine.

Then I have done the steps below to enable folder sharing from the host to the guest OS:

HOST WINDOWS 10

  • Shared the folder with everyone (to assure that there is no permit limitations with my files)

GUEST CENT OS

  • VM -> Settings -> Options -> Shared Folders. And added my folder.
  • As per the suggestion of several posts on here, I've run vmware-config-tools.pl multiple times, e.g.:

    sudo vmware-config-tools.pl -d --clobber-kernel-modules=vmhgfs

..but the /mnt/hgfs folder, where my shared folder was meant to appear, remains empty!

I have gone through the VMware manual, and I am sure that I have followed their requirements. I am still not sure the VMware tools are installed completely, since typing vmware-hgsclient in the guest OS terminal returns the error "command not found".

Any suggestions?

Unable to install VirtualBox. `complaining that the kernel module is not loaded`

Posted: 09 Sep 2021 09:01 AM PDT

VirtualBox was working on my computer until a few of days ago when I modified GRUB while attempting to customize it's Theme. Something I did started causing GRUB to load to a blank dark purple screen. Unless I choose Advanced Options from the GRUB menu and selected 4.10.0-37-generic Kernel. In which case it would load normally.

Optionally I have 4.10.0-16-generic as an option as well. But selecting that boots to a blank screen.

I thought everything was fine, but discovered that I could no longer execute vagrant up, which automatically starts a VirtualBox instance I have on my machine. It complained with the error below:

The provider 'virtualbox' that was requested to back the machine default is reporting that it isn't usable on this system. The reason is shown below:    VirtualBox is complaining that the kernel module is not loaded. Please run VBoxManage --version or open the VirtualBox GUI to see the error message which should contain instructions on how to fix this error.  

Upon executing VBoxManage --version in Terminal I get:

 WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (4.10.0-37-generic) or it failed to load. Please recompile the kernel module and install it by     sudo /sbin/vboxconfig     You will not be able to start VMs until this problem is fixed. 5.1.30r1183891  

Upon executing sudo /sbin/vboxconfig I get:

 Created symlink /etc/systemd/system/multi-user.target.wants/vboxdrv.service → /lib/systemd/system/vboxdrv.service.   Created symlink /etc/systemd/system/multi-user.target.wants/vboxballoonctrl-service.service → /lib/systemd/system/vboxballoonctrl-service.service.   Created symlink /etc/systemd/system/multi-user.target.wants/vboxautostart-service.service → /lib/systemd/system/vboxautostart-service.service.   Created symlink /etc/systemd/system/multi-user.target.wants/vboxweb-service.service → /lib/systemd/system/vboxweb-service.service.   vboxdrv.sh: Stopping VirtualBox services.   vboxdrv.sh: Building VirtualBox kernel modules.   This system is not currently set up to build kernel modules (system extensions).     Running the following commands should set the system up correctly:     apt-get install linux-headers-4.10.0-37-generic   (The last command may fail if your system is not fully updated.)   apt-get install linux-headers-generic   vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong.   This system is not currently set up to build kernel modules (system extensions).   There were problems setting up VirtualBox.  To re-start the set-up process, run /sbin/vboxconfig as root.  

So then I execute sudo apt-get install linux-headers-4.10.0-37-generic and I get:

Reading package lists... Done  Building dependency tree         Reading state information... Done  Package linux-headers-4.10.0-37-generic is not available, but is referred to by another package.  This may mean that the package is missing, has been obsoleted, or is only available from another source    E: Package 'linux-headers-4.10.0-37-generic' has no installation candidate  

So I searched Google for that package and basically nothing comes back. So re-reading the error above I thought that I should update. So I executed `` and I get this error, which believe to be the root of the previous error:

Hit:12 http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu artful InRelease            Ign:13 http://download.virtualbox.org/virtualbox/debian artful InRelease   Hit:14 http://download.virtualbox.org/virtualbox/debian zesty InRelease  Err:15 http://download.virtualbox.org/virtualbox/debian artful Release  404  Not Found [IP: 23.215.104.186 80]  Reading package lists... Done  E: The repository 'http://download.virtualbox.org/virtualbox/debian artful Release' does not have a Release file.  N: Updating from such a repository can't be done securely, and is therefore disabled by default.  N: See apt-secure(8) manpage for repository creation and user configuration details.  

Then I executed sudo apt-get install virtualbox-ext-pack and below is the output, but what stood out to me was this Module build for kernel 4.10.0-37-generic was skipped since the kernel headers for this kernel does not seem to be installed.

https://gist.github.com/s3w47m88/0e02e95cdfc2adab89951682d9c6a897

I have two issues

  1. I need to overcome that initial error.
  2. I don't understand how the official VirtualBox server / URL is failing like that. It's what is specified in their official docs. I don't know where to go from here.

Linux local directory permissions as question-marks for non-root

Posted: 09 Sep 2021 07:35 AM PDT

I've seen cases like that with faulty storage devices, with faults in remote storage (SAN, NAS), I think I've even seen something similar caused by mount permissions. But it's the first time I see this happening on the same filesystem as my home directory.

What kind of permissions are kicking in here? Definitely not mounts (I'm on the same ext4 filesystem), not SELinux, not ACLs. Then what?

I do not recall how this directory was created. It's likely it got created by some kind of software.

For me the weirdest part is that the directory is not even allowed to see its or its parent's info (last command).

I'm using Linux Mint Sarah.

user01@MyPC ~/somedirectory $ ls -l ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:  ls: negaliu pasiekti './deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:/workspace': Permission denied  viso 0  d????????? ? ? ? ?            ? workspace  
user01@MyPC ~/somedirectory $ ls -ld ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:  drw-r--r-- 3 user01 user01 4096 Rgs 27  2016 ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:  
user01@MyPC ~/somedirectory $ sudo file ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:  ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:: directory  
user01@MyPC ~/somedirectory $ sudo ls -l ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:  viso 4  drwxr-xr-x 3 user01 user01 4096 Rgs 27  2016 workspace  
user01@MyPC ~/somedirectory $ sudo stat ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:    File: './deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:'    Size: 4096        Blocks: 8          IO Block: 4096   aplankas  Device: 807h/2055d  Inode: 3937216     Links: 3  Access: (0644/drw-r--r--)  Uid: ( 1000/ user01)   Gid: ( 1000/ user01)  Access: 2017-09-21 12:57:33.990819052 +0300  Modify: 2016-09-27 11:18:38.309775066 +0300  Change: 2017-03-13 14:56:40.960468954 +0200   Birth: -  
user01@MyPC ~/somedirectory $ sudo getfacl ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:  # file: deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:  # owner: user01  # group: user01  user::rw-  group::r--  other::r--  
user01@MyPC ~/somedirectory $ stat ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:    File: './deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:'    Size: 4096        Blocks: 8          IO Block: 4096   aplankas  Device: 807h/2055d  Inode: 3937216     Links: 3  Access: (0644/drw-r--r--)  Uid: ( 1000/ user01)   Gid: ( 1000/ user01)  Access: 2017-09-21 12:57:33.990819052 +0300  Modify: 2016-09-27 11:18:38.309775066 +0300  Change: 2017-03-13 14:56:40.960468954 +0200   Birth: -  
user01@MyPC ~/somedirectory $ stat ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:/workspace  stat: nepavyksta patikrinti './deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:/workspace': Permission denied  
user01@MyPC ~/somedirectory $ sudo stat ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:/workspace    File: './deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:/workspace'    Size: 4096        Blocks: 8          IO Block: 4096   aplankas  Device: 807h/2055d  Inode: 3937217     Links: 3  Access: (0755/drwxr-xr-x)  Uid: ( 1000/ user01)   Gid: ( 1000/ user01)  Access: 2017-09-21 12:58:46.845727190 +0300  Modify: 2016-09-27 11:18:38.309775066 +0300  Change: 2016-12-02 13:56:08.298109826 +0200   Birth: -  
user01@MyPC ~/somedirectory $ stat .    File: '.'    Size: 4096        Blocks: 8          IO Block: 4096   aplankas  Device: 807h/2055d  Inode: 3278479     Links: 23  Access: (0755/drwxr-xr-x)  Uid: ( 1000/ user01)   Gid: ( 1000/ user01)  Access: 2017-09-21 09:46:22.102269130 +0300  Modify: 2017-09-20 17:33:04.564009275 +0300  Change: 2017-09-20 17:33:04.564009275 +0300   Birth: -  
user01@MyPC ~/somedirectory $ ll ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:/  ls: negaliu pasiekti './deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:/workspace': Permission denied  ls: negaliu pasiekti './deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:/.': Permission denied  ls: negaliu pasiekti './deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:/..': Permission denied  viso 0  d????????? ? ? ? ?            ? ./  d????????? ? ? ? ?            ? ../  d????????? ? ? ? ?            ? workspace/  

Attributes:

user01@MyPC ~/somedirectory $ sudo lsattr ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:/  -------------e-- ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:/workspace  user01@MyPC ~/somedirectory $ sudo lsattr ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D\:/workspace  -------------e-- ./deploy_dir/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/D:/workspace/directory2  

Join two files each with two columns, including non-matching lines

Posted: 09 Sep 2021 07:44 AM PDT

I'm trying to match and merge two sets of sorted data, one set per file. Each file contains two columns: the key field and the associated value. The resulting output should contain three columns: the key field, the value (if any) from the first file, and the value (if any) from the second file. I need to include lines of data that are not matched.

First file "john"

apple,green  cherry,red  orange,orange  

Second file "jane"

apple,red  banana,yellow  cherry,yellow  kiwi,green  

Desired result

apple,green,red  banana,,yellow  cherry,red,yellow  kiwi,,green  orange,orange,  

I thought initially that this was a trivial job for join

LC_ALL=C join -j1 -a1 -a2 -t',' john jane  

But the result of the -a1 -a2 puts the unmatched value always in the second column:

apple,green,red  banana,yellow  cherry,red,yellow  kiwi,green  orange,orange  

I need to be able to see from which source file the unmatched value originates, ideally by having those values in the appropriate second or third column of the result file, but I cannot work out a simple way of achieving this without descending into awk ... getline() type constructs.

Any suggestions, please?

How to sync bookmarks (favourites) between Google Chrome and Chromium

Posted: 09 Sep 2021 07:01 AM PDT

I'm new to the world of Raspberry 2 and Linux and I have install Chromium on the Raspberry. I did this because I thought it would be a good way to access my Google Chrome Bookmarks (Favourites). However, I'm having problems. When I log into Chromium in order to sync, I get the message:

The sync server is busy, please try again later.

I've tried a few hours later, next day, etc. I suspect the sync server being busy is not the problem.

Can anyone tell me how to fix this problem and help me sync my bookmarks?

The version of Chromium is:22.0.1229.94. I vaguely understand it's possible to get a later version. I'm new to Linux and would have to be told the explicit steps to do so. The Linux I'm running came with the Raspberry 2 and is some flavor of Debian (I'd report the version number if I knew where to look!).

Finally, I'm not wedded to Chromium. I just want a browser where I can see my Chrome bookmarks and (ideally) have them synced every time I add a bookmark to Chrome or the browser on Raspberry.

Using sed to add a URL to the start of every line

Posted: 09 Sep 2021 08:42 AM PDT

I have the URL (see below) of a certain web page that lists many different versions of a software package.

URL=http://ftp.gnu.org/gnu/wget/  

The following one-liner gets me the latest version tar ball and its signature file out of the HTML.

wget -qO- http://ftp.gnu.org/gnu/wget/ | grep tar | cut -d\" -f6 | tail -n4 | grep gz  

Probably not the shortest most efficient one liner, but hey, I'm learning and I'm open for feedback. The result of the above is this:

wget-1.15.tar.gz  wget-1.15.tar.gz.sig  

Now, the next logical step (to me at least), is to pipe the output above into sed and append the $URL to the front of each line so that the output looks like:

http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz  http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz.sig  

And then I want to pipe that right back into wget to download the files.

The question is this: How do I append the value of the bash variable $URL to the front of each line of output using sed? I tried the following:

sed "s/^/$URL/"  

But that only gives me the error:

sed: -e expression #1, char 11: unknown option to `s'  

I also know that the basic concept is good, because when I use the following, I get good results...

VAR="Gorauskas, "  echo "Jonas" | sed "s/^/$VAR/"  

So, my guess is that I need to somehow escape all of the / character in the $URL variable... Am I on the right track?

How to apply updates on OpenBSD, NetBSD, and FreeBSD?

Posted: 09 Sep 2021 07:49 AM PDT

I'm using OpenBSD for quite a while now. All I do, however is go from one release to the next, always just doing an update. I configured the system so it works as my router and firewall, and it works quite well like that. But I never update packages. All I do is just move on to the next release.

Coming from the Linux world, I'm used to applying updates a few times a week; but how do I do that on *BSD? - Or is this not part of the *BSD philosophy?

No comments:

Post a Comment