Monday, February 21, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Calendar Highlight in UNIX

Posted: 21 Feb 2022 11:03 PM PST

I have tried several but could not highlight multiple dates in year calendar

Cal -y 2022

   January               February                 March         

Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 2 3 4 5 1 2 3 4 5
2 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 12
9 10 11 12 13 14 15 13 14 15 16 17 18 19 13 14 15 16 17 18 19
16 17 18 19 20 21 22 20 21 22 23 24 25 26 20 21 22 23 24 25 26
23 24 25 26 27 28 29 27 28 27 28 29 30 31
30 31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 1 2 3 4 5 6 7 1 2 3 4
3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11
10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18
17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25
24 25 26 27 28 29 30 29 30 31 26 27 28 29 30

    July                  August                September       

Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 1 2 3 4 5 6 1 2 3
3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10
10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17
17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24
24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30
31
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 2 3 4 5 1 2 3
2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24
23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31
30 31

I want to highlight multiple dates in the year calendar ??

Is it possible in UNIX ???

I cannot use Alt-Tab to switch between windows in Arch Linux with Budgie Desktop

Posted: 21 Feb 2022 09:36 PM PST

I installed budgie desktop on Endeavour OS (based on Arch Linux) using the package manager (yay). I am unable to switch between applications using alt-tab. Also, the control panel does not open. How can I enable alt-tab?

Unable to open file after FUSE mount

Posted: 21 Feb 2022 09:13 PM PST

I'm trying out FUSE for the first time by following the official GitHub Repo's example.

I have done the following:

  1. created a mount directory called mount_dir that contains file hello.txt.
  2. update /etc/fuse.conf with user_allow_other as mentioned in various forums and posts
  3. Added bunch of printf() statements in hello_ll.c at all function entry points.
  4. Executed ./hello_ll -o allow_other -f /home/hemalkumar/mount_dir
  5. Executed ./test_stat. It calculate the number of pages in the file. Just some business logic, nothing fancy!

test_stat.c

    #define PAGE_SIZE 4096        int main() {         char* filename = "/home/hemalkumar/mount_dir/hello.txt";         int fd = open(filename, O_RDONLY);        if (fd == -1) {          printf("INVALID file:%s\n", filename);          close(fd);          return -1;      }        struct stat sb;      if (fstat(fd, &sb) == -1) {          close(fd);          return -1;      }        int pages = sb.st_size/PAGE_SIZE + (sb.st_size % PAGE_SIZE != 0);        printf("pages:%d\n", pages);        return 0;  }  

Issue: When I execute test_stat without mounting FUSE, it works fine. However, running it after step#4 shows an error INVALID file:/home/hemalkumar/mount_dir/hello.txt.

I have updated /etc/fuse.conf file to allow other user, and passing flags during startup of hello_ll. Don't know what permission issues it is having.

Any pointers will be appreciated! Thanks!

How to compare dates in bash script

Posted: 21 Feb 2022 11:15 PM PST

I am trying to write a script in bash that will determine the oldest directory in a file structure.

In this example, I have four directories with the following titles that mimic the date and time they were created. The files are 2022-02-21:20:30:23, 2022-02-21:22:30:23, 2022-02-28:22:30:23, and 2023-02-28:22:30:23. In this case, the dates are arbitrary and were just developed to test the script.

I want the script to identify the directories that exist within this directory, and based on the name of the directory, identify which one is the oldest directory.

My initial attempt at doing this is shown below, and yes, I know the strings are not properly declared as dates, but I do not know how to do this and could use some suggestions.

oldest="1899-01-01:01:01:01"  dirs=`ls -d */`  for i in $dirs ; do      if [[ oldest < $i  ]] ; then          oldest=$i      fi  done  echo $oldest  

How to connect to a second monitor without restarting X?

Posted: 21 Feb 2022 08:23 PM PST

Every time I have to connect to an external monitor, it remains "disconnected" according to xrandr and the second screen remains black.

To solve this problem, I always have to close all my GUI apps and the X server, login again and restart everything.

Tests I did : if I go to tty2 before doing this, the screen is duplicated as expected but when I go back to tty1 (which I use to startx) it disappears.

My config is Arch Linux + bspwm, my .xinitrc is simply exec bspwm

I'd really like to keep my programs open whenever I need to do a presentation.

When terminal emulator exits, why does shell also exits?

Posted: 21 Feb 2022 07:07 PM PST

When I start a terminal emulator (for example, qterminal), it starts the default shell (for example, bash). And when I quit the terminal (for example, by clicking the x button or by killing the terminal), the shell also exits. There remainds no process of the shell. I would like to know how this mechanism is implemented.

At first, I suspected that the terminal sends some signal to the shell. So I trap SIGQUIT, SIGINT, SIGTERM, SIGHUP in the shell, but no signal was trapped. I have no idea other than signal.

It may depands on the terminal and the shell, and perhaps on the OS. Please tell me any information about this situation.

SUSE on hyper-v boots to emergency mode after copying its vhdx file form old drive to new drive

Posted: 21 Feb 2022 06:47 PM PST

I am not very Linux savvy, but am trying to do my best here. Had a functioning SUSE Enterprise server SP2 VM running on Hyper-V. I decided to replace the old mechanical hard drive with a new SSD. After copying the hyper-v folder over and starting the VM, I now get the following notice: You are running in emergency mode. I can put in my admin password, but no gui. If I start SUSE in Advanced mode and select the non-default kernel restore mode, I get the same Emergency Mode notice, but it shows some other error in red: A start job is running for dev-disk-by\xZduuid-0ab076d8\x2d2d80\x2d44f9\x2d9076\x2d847266c6942c.device. It hangs here for a minute and then shows the emergency mode notice. I plugged in the original mechanical drive, recopied over the hyper-v folder thinking it was corrupt, but still get the same error. Then I decided to point the VM back to the vhdx on the original hard drive and now it gets the same error. I am getting very lost here and any suggestions would be greatly appreciated.

Wrong GPU showing up in Proxmox LXC

Posted: 21 Feb 2022 06:55 PM PST

I have a Proxmox server with a GT 1030(for the vfio driver) and a Quadro P400 which I want to use in a container for Plex transcoding. I got all the drivers installed on the host and in the container and the GT 1030 shows up in both the host and the container using the nvidia driver while the Quadro P400 only shows in the host also with the nvidia driver.

How do I disable the GT 1030(in the LXC) and pass the P400 into the container instead?

how do I change cd /home/ubuntu to use My files / Linux files

Posted: 21 Feb 2022 08:25 PM PST

im trying to install a .zip game with the linux terminal and in the tutorial im using (https://ubiq.co/tech-blog/install-zip-file-linux/) its example is cd /home/ubuntu/file mine is My files/LInux files/file  the directorys and wanted file and ive tried cd /My files/ Linux files and it says no file or directory exist how can i fix this and am i being stupid

How to bruteforce directories from a list of urls?

Posted: 21 Feb 2022 06:24 PM PST

Is there any way to bruteforce directories from a list of urls using dirb or gobuster? url contains multiple valid urls, Ive tried using a while statement but no luck, its giving me an error after successfully scanning the first url in the file.

(!) FATAL: Invalid URL format: ual/images/  (Use: "http://host/" or "https://host/" for SSL)  
#!/bin/bash  echo "starting..."  cat url | while read url;  do  dirb "$url" /usr/share/wordlists/dirb/common.txt -o output.txt  done  

Thanks.

What advantage does it have to run Linux in EL2 in arm64 machine?

Posted: 21 Feb 2022 06:25 PM PST

ARM64 architecture provides EL0~EL3. EL0 is for the user, EL1 is for OS, EL2 is for the hypervisor and EL3 is for the secure monitor. But I read somewhere running OS (linux) in EL2 (exception level 2) has some advantages and I find the Linux source provides that in the head.S file. For example, u-boot launches Linux in EL2 and the OS can remain in EL2 if the hardware supports it and if we configure the kernel to stay in EL2. (we should set CONFIG_VHE : virtualization hardware extension).

What advantages does it have to run OS in EL2? I can guess one thing - we need only one stage of address translation in that case. Is it correct? and what other advantages does it have?

Polybar Workspace Icons not updating

Posted: 21 Feb 2022 06:57 PM PST

I am using the Tiling Window Manager XMonad. In the configuration, I have set

myWorkspaces = ["\61613","\61899","\61947","\61635","\61502","\61501","\61705","\61564","\62150","\61872"]

Once I logout and log back in to see the changes take effect, the new icon is shown for a couple of seconds before it reverts back to the old one ( \61612). How do I get the icons to update?

How to get HTTPS reponse from Website using OpenBSD base tools?

Posted: 21 Feb 2022 08:37 PM PST

Using tools like curl or wget its easy to "get" the response of an HTTP GET request; but both tools aren't installed by default on OpenBSD and writing a portable shell script, it cannot be assumed that they are installed on ones another machine.

I want an "secure" way to get the server response (for example for wikipedia.org) onto my terminal using tools which are installed by default. Secure means the response should not be plaintext but encrypted with current standards like HTTP/2 and TLS 1.3/TLS 1.2 (if supported by the server, of course) on the way to my machine.

How to use OR with grep?

Posted: 21 Feb 2022 11:24 PM PST

I ran grep 'd(o|i)g' a.txt and a.txt contains dig but nothing was returned. Is this the right way to match dog or dig?

how do you use awk to count lines that are not starting with # in multiple files and list them out with filenames?

Posted: 21 Feb 2022 09:28 PM PST

I have been using grep "^[^#]" file.txt | wc -l to count the number of lines in a single file.

How do I use awk to count the number of lines not starting with # and print out with file names like below?

file1.txt 30   file2.txt 33  ....  

How to extract a few IP addresses from a YAML file

Posted: 21 Feb 2022 11:11 PM PST

I have this file, and I'd like to select all the IP addresses under the masters/hosts section if their line is not commented. I tried this sed 's/.*\ \([0-9\.]\+\).*/\1/g', but it did not work.

metal:    children:      masters:        hosts:          dev0: {ansible_host: 172.168.1.10}          # dev1: {ansible_host: 185.168.1.11}          # dev2: {ansible_host: 142.168.1.12}      workers:        hosts: {}          # dev3: {ansible_host: 172.168.1.13}    

How to react to incoming files

Posted: 21 Feb 2022 11:16 PM PST

I need to process to file added to a directory, then remove them. Files can be large (20KiB to 5 GiB) and arrive slowly (via scp or ftp). How can I monitor a path (possibly with a systemd.path unit) and only react when the new file has finished writing? I find that my services always trigger when the first bytes of the file are written, causing failures because the complete file isn't present.


Attempt 1 (DirectoryNotEmpty=)

I use a *.path with DirectoryNotEmpty=.

Pros:

  • Looks like what I want

Cons:

  • Triggers too early. Files are still transferring when I process them, thus they are incomplete (corrupt).
# /etc/systemd/system/incoming.path    [Path]  DirectoryNotEmpty=/var/incoming    # /etc/systemd/system/incoming.service    [Service]  Type=oneshot  ExecStart=/usr/local/bin/incoming    # /usr/local/bin/incoming    for i in /var/incoming/*; do    process $i    rm $i  done  

Attempt 2 (Poll)

I use a *.timer to trigger the script once per minute

Pros:

  • Simple

Cons:

  • Works about 90% of the time for small files, 0% for large files.
  • Adds up to 1 minute of delay to the pipeline
  • Journal logs cluttered with starting/stopping the incoming unit
# /etc/systemd/system/incoming.timer    [Timer]  OnCalendar=minutely    # /etc/systemd/system/incoming.service    [Service]  Type=oneshot  ExecStart=/usr/local/bin/incoming    # /usr/local/bin/incoming    for i in /var/incoming/*; do    process $i    rm $i  done  

Attempt 3 (Poll plus md5)

I continue to poll, but I also only process small *md5 files which are only sent by the clients after sending the main thing. These are smaller than 1 MTU, so I hope they can not be interrupted half-way through writing.

Pros:

  • Seems to works all of the time (but not sure if garunteed)

Cons:

  • Adds up to 1 minute of delay to the pipeline
  • Journal logs cluttered with starting/stopping the incoming unit
  • More complicated for users. User scripts need to generate md5sum and then send that file after sending the main file.
# /etc/systemd/system/incoming.timer    [Timer]  OnCalendar=minutely    # /etc/systemd/system/incoming.service    [Service]  Type=oneshot  ExecStart=/usr/local/bin/incoming    # /usr/local/bin/incoming    for i in /var/incoming/*.md5; do    file=$(basename $i .md5)    process $file    rm $file $file.md5  done  

How can I block a port being used by docker?

Posted: 21 Feb 2022 09:32 PM PST

I am running wikijs on port 8080 running reverse proxy with apache. With cloudflare argo tunnel so only specific people can login to wikijs.

So if user try to browse http://publicip:80 (port being used by apache) it will redirect to port 8080 and cloudflare main page will pop up.

However when user try to access directly http://publicip:8080 (port being used by wikijs), it still goes through. Tried ufw with port 80 not being allowed and it works. But not for port 8080

Ctrl-Alt-Del equivalent on Linux? [duplicate]

Posted: 21 Feb 2022 08:29 PM PST

I foolishly started a job that turned out to be so big and busy that it froze everything. I wish I could type a kill command or use xkill, but the system is unresponsive, apart from the audible swapping. On Windows, Ctrl-Alt-Del helps in these situations; does Linux has a way to knock through into an overloaded system?

Just saw this one and couldn't stop myself from sharing:

enter image description here

Bash AWK or IF statements

Posted: 21 Feb 2022 06:20 PM PST

I am trying to make a script that checks a variable for a number then produce an output. I.e using ping and based on the tty, check if its running Linux or Windows. I might be over complicating things but this is what I got:

#!/bin/bash  var1=$(ping $1 -c 1) | awk '{if("$var1"=="128") print "Host is LIVE Running: Windows OS"}'  

Doesn't produce any output. I have tried using IF statements without using awk it wont produce any output if I enter a IP that I know cannot be reached.

#!/bin/bash  var1=$(ping $1 -c 1)  if [[ "$var1" == *"128"* ]]; then  echo "Host is LIVE Running: Windows OS"  elif [[ "$var1" == *"64"* ]]; then  echo "Host is LIVE Running: Linux OS"  elif [[ "$var1" == *"Unreachable"* ]]; then  echo "Host appears DOWN!"  fi  

Constructive criticism welcome! Thank you.

man returns execve: No such file or directory in chroot jail

Posted: 21 Feb 2022 11:13 PM PST

I created a chroot jail and copied multiple binaries and their corresponding libraries to the relevant subdirectories. Example:

cp -v /usr/bin/edit /home/jail/usr/bin  ldd /usr/bin/edit          linux-vdso.so.1 (0x00007fff565ae000)          libm.so.6 => /lib64/libm.so.6 (0x00007f7749145000)          libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f7748f11000)          libacl.so.1 => /lib64/libacl.so.1 (0x00007f7748d08000)          libdl.so.2 => /lib64/libdl.so.2 (0x00007f7748b04000)          libperl.so => /usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE/libperl.so (0x00007f7748771000)          libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7748554000)          libc.so.6 => /lib64/libc.so.6 (0x00007f77481ad000)          libattr.so.1 => /lib64/libattr.so.1 (0x00007f7747fa8000)          /lib64/ld-linux-x86-64.so.2 (0x00007f7749446000)          libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f7747d6d000)  cp -v /lib64/{libm.so.6,libtinfo.so.5,libacl.so.1,libdl.so.2,libpthread.so.0,libc.so.6,libattr.so.1,ld-linux-x86-64.so.2,libcrypt.so.1} /home/jail/lib64/  

I did the same with the man command and copied all manual files with cp -rv /usr/share/man/ /home/jail/usr/share/, but if I execute it, it returns this error:

-bash-4.2$ man gzip  execve: No such file or directory  

What could be missing?

More details:

-bash-4.2$ ls /usr/share/man  ca  da  el  es  fr.ISO8859-1  hu  it  man0p  man1p  man3   man4  man6  man8  mann  pl  pt_BR  sk  sv  zh     zh_TW  cs  de  eo  fr  fr.UTF-8      id  ja  man1   man2   man3p  man5  man7  man9  nl    pt  ru     sr  uk  zh_CN  

Update:

-bash-4.2$ strace -f /usr/bin/mandb ls 2>ls.log  -bash-4.2$ cat ls.log  execve("/usr/bin/mandb", ["/usr/bin/mandb", "ls"], [/* 45 vars */]) = 0  brk(0)                                  = 0x138b000  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd43a9ac000  access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)  open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  open("/lib64/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  stat("/lib64/tls/x86_64", 0x7ffde87d2510) = -1 ENOENT (No such file or directory)  open("/lib64/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  stat("/lib64/tls", 0x7ffde87d2510)      = -1 ENOENT (No such file or directory)  open("/lib64/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  stat("/lib64/x86_64", 0x7ffde87d2510)   = -1 ENOENT (No such file or directory)  open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3  read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\34\2\0\0\0\0\0"..., 832) = 832  fstat(3, {st_mode=S_IFREG|0755, st_size=1974416, ...}) = 0  mmap(NULL, 3828256, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd43a3e6000  mprotect(0x7fd43a584000, 2093056, PROT_NONE) = 0  mmap(0x7fd43a783000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19d000) = 0x7fd43a783000  mmap(0x7fd43a789000, 14880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd43a789000  close(3)                                = 0  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd43a9ab000  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd43a9aa000  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd43a9a9000  arch_prctl(ARCH_SET_FS, 0x7fd43a9aa700) = 0  mprotect(0x7fd43a783000, 16384, PROT_READ) = 0  mprotect(0x601000, 4096, PROT_READ)     = 0  mprotect(0x7fd43a9ad000, 4096, PROT_READ) = 0  brk(0)                                  = 0x138b000  brk(0x13ac000)                          = 0x13ac000  open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  open("/usr/lib/locale/de_DE.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  open("/usr/lib/locale/de_DE.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  open("/usr/lib/locale/de_DE/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  open("/usr/lib/locale/de.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  open("/usr/lib/locale/de.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  open("/usr/lib/locale/de/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)  getuid()                                = 1000  geteuid()                               = 1000  getgid()                                = 100  execve("/usr/lib/man-db/mandb", ["/usr/bin/mandb", "ls"], [/* 45 vars */]) = -1 ENOENT (No such file or directory)  dup(2)                                  = 3  fcntl(3, F_GETFL)                       = 0x8001 (flags O_WRONLY|O_LARGEFILE)  close(3)                                = 0  write(2, "execve: No such file or director"..., 34execve: No such file or directory  ) = 34  exit_group(-22)                         = ?  +++ exited with 234 +++  

Update2: Ok this part was missing:

cp -rv /usr/lib/man-db/ usr/lib/  

Now I get this error:

man: error while loading shared libraries: libmandb-2.6.6.so: cannot open shared object file: No such file or directory  

Strangely it's not part of the ldd return:

# which mandb  /usr/bin/mandb  # ldd /usr/bin/mandb          linux-vdso.so.1 (0x00007fffd64d0000)          libc.so.6 => /lib64/libc.so.6 (0x00007f1885120000)          /lib64/ld-linux-x86-64.so.2 (0x00007f18854c7000)  

Finally I needed those libraries:

cp /usr/lib64/libmandb-2.6.6.so usr/lib64/libmandb-2.6.6.so  cp /usr/lib64/libgdbm.so.4 usr/lib64/libgdbm.so.4  

After that man loaded, but no text is displayed:

# man ls  Man: find all matching manual pages (set MAN_POSIXLY_CORRECT to avoid this)   * ls (1)     ls (1p)  Man: What manual page do you want?  Man: 1  

enter image description here

I compared the strace results of the jail and root user and they differ now only in this part (jail is left): enter image description here

As I added a bind mount to /var/run/nscd, the socket is available for the jail user:

-bash-4.2$ if [[ -S /var/run/nscd/socket ]]; then echo "socket is available"; fi  socket is available  

So the problem seems to be something else?!

Update3: @nobody Yes, passwd and group are present:

-bash-4.2$ ls -la /etc  total 124  drwxr-xr-x  4 root root   216 Nov 11 14:15 .  drwxr-xr-x 13 root root   183 Nov  4 08:49 ..  -rw-r--r--  1 root root   779 Nov  3 12:43 group  -rw-r--r--  1 root root 67659 Nov 11 13:55 ld.so.cache  -rw-r--r--  1 root root  2335 Nov  4 09:02 localtime  -rw-r--r--  1 root root 12061 Nov 11 13:16 manpath.config  -rw-r--r--  1 root root  1304 Nov 11 14:15 nsswitch.conf  -rw-r--r--  1 root root  3961 Nov  3 12:43 passwd  drwxr-xr-x  2 root root  4096 Nov  3 14:13 postfix  -rw-r--r--  1 root root  9168 Nov  4 09:02 profile  drwxr-xr-x  2 root root  4096 Nov  4 09:02 profile.d  -rw-r--r--  1 root root  8006 Nov  4 09:17 vimrc  

Update4:

The -Tascii flag returned more missing binaries:

-bash-4.2$ man -Tascii ls  man: can't execute tbl: No such file or directory  man: can't execute groff: No such file or directory  man: command exited with status 255: /usr/bin/zsoelim | /usr/lib/man-db/manconv -f UTF-8:ISO-8859-1 -t ANSI_X3.4-1968//IGNORE | tbl | groff -mandoc -Tascii  

So I copied tbl, groff and zsoelim and the complete dir /usr/share/groff. Now two additional binaries were missing:

-bash-4.2$ man -Tascii ls  groff: couldn't exec troff: No such file or directory  groff: couldn't exec grotty: No such file or directory  man: command exited with status 4: /usr/bin/zsoelim | /usr/lib/man-db/manconv -f UTF-8:ISO-8859-1 -t ANSI_X3.4-1968//IGNORE | tbl | groff -mandoc -Tascii  

After copying these, the manual was displayed:

enter image description here

But without the -Tascii flag its still black/empty. :|

Update5:

Default pager seems to be less

-bash-4.2$ env | grep MANPATH  MANPATH=/usr/share/man  -bash-4.2$ env | grep PAGER  PAGER=less  

Is it possible using an external hard drive to run Pop! Os with 200gb allocated, and the rest allocated to windows as a normal external drive?

Posted: 21 Feb 2022 07:01 PM PST

I've been wanting to run Pop! Os from an external hard drive, but I also want to be able to use the rest as a normal usb drive. Is this possible to do? If so, how?

How to fix Picked up _JAVA_OPTIONS: no options listed on Linux?

Posted: 21 Feb 2022 10:03 PM PST

This issues is on Manjaro Deepin 15.9 linux DE. When I run java -version in terminal it outputs this:

Picked up _JAVA_OPTIONS:      java version "11.0.2" 2019-01-15 LTS       Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)      Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)  

But if the command is run with sudo it outputs it normal without the Picked up _JAVA_OPTIONS: message !

I managed by placing unset JAVA_OPTIONS in /etc/environment , /etc/profile and ~.bashrc to remove the message from terminal. But the message still shows up in Netbeans when I run a project.

Also I run Netbeans as sudo just to check will it show then and it didn't. I tried removing some software from Linux which I didn't need or believe made it was causing the message (because I read the few posts about software being an issue), but nothing changed.

Message not showing in sudo makes me believe maybe root user doesn't have something installed that normal user has which is producing this message.

This message is visible in live preview of Manjaro Deepin on bootable usb!

Xorg broken xf86EnableIOPorts: failed to set IOPL for I/O (Operation not permitted) No devices detected

Posted: 21 Feb 2022 07:01 PM PST

I am trying to use Xorg instead of Wayland on my Arch Linux.

I have two graphics cards in my laptop. An Intel and a Nvidia graphics card.

The output of my log file is:

[    53.401] (WW) Failed to open protocol names file lib/xorg/protocol.txt  [    53.403]   X.Org X Server 1.20.0  X Protocol Version 11, Revision 0  [    53.403] Build Operating System: Linux Arch Linux  [    53.403] Current Operating System: Linux thinkpad 4.17.8-1-ARCH #1 SMP PREEMPT Wed Jul 18 09:56:24 UTC 2018 x86_64  [    53.403] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=4c4cf377-77af-4cd1-bd40-6d94fae4e2f1 rw quiet resume=UUID=4a1be855-ae3e-4add-b3e0-3b3abb817115 nvidia-drm.modeset=1  [    53.403] Build Date: 18 June 2018  03:12:37PM  [    53.403]    [    53.403] Current version of pixman: 0.34.0  [    53.404]    Before reporting problems, check http://wiki.x.org      to make sure that you have the latest version.  [    53.404] Markers: (--) probed, (**) from config file, (==) default setting,      (++) from command line, (!!) notice, (II) informational,      (WW) warning, (EE) error, (NI) not implemented, (??) unknown.  [    53.404] (==) Log file: "/home/henzler/.local/share/xorg/Xorg.1.log", Time: Fri Jul 20 17:30:51 2018  [    53.412] (==) Using config directory: "/etc/X11/xorg.conf.d"  [    53.412] (==) Using system config directory "/usr/share/X11/xorg.conf.d"  [    53.414] (==) No Layout section.  Using the first Screen section.  [    53.414] (==) No screen section available. Using defaults.  [    53.414] (**) |-->Screen "Default Screen Section" (0)  [    53.414] (**) |   |-->Monitor "<default monitor>"  [    53.415] (==) No device specified for screen "Default Screen Section".      Using the first device section listed.  [    53.415] (**) |   |-->Device "Intel Graphics"  [    53.415] (==) No monitor specified for screen "Default Screen Section".      Using a default monitor configuration.  [    53.415] (**) Option "DontZap" "false"  [    53.415] (==) Automatically adding devices  [    53.415] (==) Automatically enabling devices  [    53.415] (==) Automatically adding GPU devices  [    53.415] (==) Automatically binding GPU devices  [    53.415] (==) Max clients allowed: 256, resource mask: 0x1fffff  [    53.415] (WW) The directory "/usr/share/fonts/OTF" does not exist.  [    53.415]    Entry deleted from font path.  [    53.415] (WW) The directory "/usr/share/fonts/Type1" does not exist.  [    53.415]    Entry deleted from font path.  [    53.415] (==) FontPath set to:      /usr/share/fonts/misc,      /usr/share/fonts/TTF,      /usr/share/fonts/100dpi,      /usr/share/fonts/75dpi  [    53.415] (**) ModulePath set to "/usr/lib/xorg/modules,/usr/lib/nvidia/xorg"  [    53.415] (II) The server relies on udev to provide the list of input devices.      If no devices become available, reconfigure udev or disable AutoAddDevices.  [    53.415] (II) Module ABI versions:  [    53.415]    X.Org ANSI C Emulation: 0.4  [    53.415]    X.Org Video Driver: 24.0  [    53.415]    X.Org XInput driver : 24.1  [    53.415]    X.Org Server Extension : 10.0  [    53.416] (++) using VT number 3    [    53.420] (II) systemd-logind: took control of session /org/freedesktop/login1/session/c3  [    53.422] (II) xfree86: Adding drm device (/dev/dri/card0)  [    53.424] (II) systemd-logind: got fd for /dev/dri/card0 226:0 fd 10 paused 0  [    53.424] (II) xfree86: Adding drm device (/dev/dri/card1)  [    53.425] (II) systemd-logind: got fd for /dev/dri/card1 226:1 fd 11 paused 0  [    53.427] (**) OutputClass "nvidia" ModulePath extended to "/usr/lib/nvidia/xorg,/usr/lib/xorg/modules,/usr/lib/xorg/modules,/usr/lib/nvidia/xorg"  [    53.427] (**) OutputClass "nvidia" setting /dev/dri/card0 as PrimaryGPU  [    53.429] (--) PCI: (0@0:2:0) 8086:191b:17aa:5050 rev 6, Mem @ 0xf0000000/16777216, 0xe0000000/268435456, I/O @ 0x0000e000/64, BIOS @ 0x????????/131072  [    53.429] (--) PCI:*(2@0:0:0) 10de:134d:17aa:5050 rev 162, Mem @ 0xf1000000/16777216, 0xc0000000/268435456, 0xd0000000/33554432, I/O @ 0x0000d000/128  [    53.429] (WW) Open ACPI failed (/var/run/acpid.socket) (No such file or directory)  [    53.430] (II) LoadModule: "glx"  [    53.430] (II) Loading /usr/lib/nvidia/xorg/libglx.so  [    53.495] (II) Module glx: vendor="NVIDIA Corporation"  [    53.495]    compiled for 4.0.2, module version = 1.0.0  [    53.495]    Module class: X.Org Server Extension  [    53.496] (II) NVIDIA GLX Module  396.24  Wed Apr 25 23:17:01 PDT 2018  [    53.497] (II) LoadModule: "intel"  [    53.498] (II) Loading /usr/lib/xorg/modules/drivers/intel_drv.so  [    53.502] (II) Module intel: vendor="X.Org Foundation"  [    53.502]    compiled for 1.20.0, module version = 2.99.917  [    53.502]    Module class: X.Org Video Driver  [    53.502]    ABI class: X.Org Video Driver, version 24.0  [    53.502] (II) intel: Driver for Intel(R) Integrated Graphics Chipsets:      i810, i810-dc100, i810e, i815, i830M, 845G, 854, 852GM/855GM, 865G,      915G, E7221 (i915), 915GM, 945G, 945GM, 945GME, Pineview GM,      Pineview G, 965G, G35, 965Q, 946GZ, 965GM, 965GME/GLE, G33, Q35, Q33,      GM45, 4 Series, G45/G43, Q45/Q43, G41, B43  [    53.503] (II) intel: Driver for Intel(R) HD Graphics  [    53.503] (II) intel: Driver for Intel(R) Iris(TM) Graphics  [    53.503] (II) intel: Driver for Intel(R) Iris(TM) Pro Graphics  [    53.503] xf86EnableIOPorts: failed to set IOPL for I/O (Operation not permitted)  [    53.505] (II) intel(G0): Using Kernel Mode Setting driver: i915, version 1.6.0 20180308  [    53.505] (II) intel(G0): SNA compiled from 2.99.917-831-ge7bfc906  [    53.521] (EE) No devices detected.  [    53.521] (EE)   Fatal server error:  [    53.521] (EE) no screens found(EE)   [    53.521] (EE)   Please consult the The X.Org Foundation support        at http://wiki.x.org   for help.   [    53.521] (EE) Please also check the log file at "/home/henzler/.local/share/xorg/Xorg.1.log" for additional information.  [    53.521] (EE)   [    53.539] (EE) Server terminated with error (1). Closing log file.  

I know there are many similar questions out there but nothing has worked for me so far.

I have done following:

- installed xf68-video-intel  - removed xorg.conf  - installed cuda + nvidia drivers  

Beaglebone cannot connect to internet using ethernet cable

Posted: 21 Feb 2022 11:04 PM PST

I've been trying to get my Beaglebone Black to connect to internet using an ethernet cable plugged direct into my Netgear router. I have tried many things but nothing has worked so far.

Here are some relevant outputs.

systemctl

# Yesterday, internet not working  ● networking.service    loaded failed failed  Raise network interfaces  # Today after reflashing beaglebone, internet still not working  networking.service    loaded active exited    Raise network interfaces  

ip address

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000  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: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN group default qlen 10      link/can   3: can1: <NOARP,ECHO> mtu 16 qdisc noop state DOWN group default qlen 10      link/can   4: eth0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000      link/ether a0:f6:fd:8a:ec:7e brd ff:ff:ff:ff:ff:ff      inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0         valid_lft forever preferred_lft forever      inet 192.168.0.123/24 brd 192.168.0.255 scope global secondary eth0         valid_lft forever preferred_lft forever      inet6 2600:8806:502:b00:a2f6:fdff:fe8a:ec7e/64 scope global mngtmpaddr dynamic          valid_lft 86390sec preferred_lft 86390sec      inet6 fe80::a2f6:fdff:fe8a:ec7e/64 scope link          valid_lft forever preferred_lft forever  

ip route

default via 192.168.0.1 dev eth0   68.105.28.11 via 192.168.0.1 dev eth0   68.105.28.12 via 192.168.0.1 dev eth0   68.105.29.11 via 192.168.0.1 dev eth0   192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.10   192.168.0.1 dev eth0 scope link  192.168.6.0/30 dev usb1 proto kernel scope link src 192.168.6.2 linkdown   192.168.7.0/30 dev usb0 proto kernel scope link src 192.168.7.2 linkdown   212.227.81.55 via 192.168.0.1 dev eth0   

host google.com

;; connection timed out; no servers could be reached  

ping www.google.com

ping: www.google.com: Temporary failure in name resolution  

ping 192.168.0.1 (router)

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.  --- 192.168.0.1 ping statistics ---  9 packets transmitted, 0 received, 100% packet loss, time 8199ms  

ping 192.168.0.39 (my computer, connected to same router via ethernet)

PING 192.168.0.39 (192.168.0.39) 56(84) bytes of data.  64 bytes from 192.168.0.39: icmp_seq=1 ttl=64 time=0.432 ms  64 bytes from 192.168.0.39: icmp_seq=2 ttl=64 time=0.324 ms  64 bytes from 192.168.0.39: icmp_seq=3 ttl=64 time=0.389 ms  64 bytes from 192.168.0.39: icmp_seq=4 ttl=64 time=0.387 ms  --- 192.168.0.39 ping statistics ---  4 packets transmitted, 4 received, 0% packet loss, time 3004ms  rtt min/avg/max/mdev = 0.324/0.383/0.432/0.038 ms  

I have no idea how to fix this. It started working yesterday when I started writing this question then it started working mysteriously. I rebooted this morning and it's not working again.

Limit in saving program output to file in Linux

Posted: 21 Feb 2022 09:08 PM PST

I know I can use:

$ my_program > output.txt  

To redirect the output to a file, but the problem I have is that when the file reaches 64 Kb no more is written in the file and I lose all information that comes next...

What can I do?

How do I get xargs to show me the command lines it's generating without running them?

Posted: 21 Feb 2022 11:35 PM PST

A fair number of linux commands have a dry-run option that will show you what they're going to do without doing it. I see nothing in the xargs man page that does that and no obvious way to emulate it.

(my specific use case is troubleshooting long pipelines, though I'm sure there are others)

Am I missing something?

How to download files and folders from Onedrive using wget?

Posted: 21 Feb 2022 10:05 PM PST

How to use wget to download files from Onedrive? (and batch files and entire folders, if possible)

A layman's explanation for "Everything is a file" — what differs from Windows?

Posted: 21 Feb 2022 09:48 PM PST

I know that "Everything is a file" means that even devices have their filename and path in Unix and Unix-like systems, and that this allows for common tools to be used on a variety of resources regardless of their nature. But I can't contrast that to Windows, the only other OS I have worked with. I have read some articles about the concept, but I think they are somewhat uneasy to grasp for non-developers. A layman's explanation is what people need!

For example, when I want to copy a file to CF card that is attached to a card reader, I will use something like

zcat name_of_file > /dev/sdb  

In Windows, I think the card reader will appear as a driver, and we will do something similar, I think. So, how does the "Everything is a file" philosophy make a difference here?

Apache + mod_fcgid + chroot with mod_security. CentOS/RHEL 6

Posted: 21 Feb 2022 08:06 PM PST

I am trying to setup a web server running Apache + mod_fcgid + mod_security chroot enabled and having a real hard time to get this working. Apache was installed from official CentOS repo and mod_fcgid and mod_security were installed from EPEL repo.

At first, I even was unable to start Apache while chroot is enabled but I've fixed lots of stuff but there's still some I need to sort out.

First problem, when I try to start Apache while it's stopped, it does start with no problems, however, when I try to restart it while running this is what I get;

$ service httpd restart  Stopping httpd:                                            [FAILED]  Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80  (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80  no listening sockets available, shutting down  Unable to open logs                                                             [FAILED]  

Apache Error Log;

[Mon Jun 17 07:47:51 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)  [Mon Jun 17 07:47:52 2013] [notice] ModSecurity: chroot checkpoint #1 (pid=954 ppid=953)  [Mon Jun 17 07:47:52 2013] [notice] ModSecurity for Apache/2.7.3 (http://www.modsecurity.org/) configured.  [Mon Jun 17 07:47:52 2013] [notice] ModSecurity: APR compiled version="1.3.9"; loaded version="1.3.9"  [Mon Jun 17 07:47:52 2013] [notice] ModSecurity: PCRE compiled version="7.8 "; loaded version="7.8 2008-09-05"  [Mon Jun 17 07:47:52 2013] [notice] ModSecurity: LUA compiled version="Lua 5.1"  [Mon Jun 17 07:47:52 2013] [notice] ModSecurity: LIBXML compiled version="2.7.6"  [Mon Jun 17 07:47:52 2013] [notice] Digest: generating secret for digest authentication ...  [Mon Jun 17 07:47:52 2013] [notice] Digest: done  [Mon Jun 17 07:47:53 2013] [notice] ModSecurity: chroot checkpoint #2 (pid=955 ppid=1)  [Mon Jun 17 07:47:53 2013] [notice] ModSecurity: chroot successful, path=/var/www  [Mon Jun 17 07:47:53 2013] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.7 configured -- resuming normal operations  

The second problem is that regular HTML files are being served with no problems but PHP pages are not.

mod_security logs;

--98586c48-A--  [17/Jun/2013:08:01:37 --0400] Ub76oUJVtI0AAAPEDiYAAAAG CLIENT_IP_GOES_HERE 51722 SERVER_IP_GOES_HERE 80  --98586c48-B--  GET /testphp.php HTTP/1.1  Host: hostname  User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8  Accept-Language: en-gb,en;q=0.5  Accept-Encoding: gzip, deflate  Cookie: PHPSESSID=5a9jqak7dt30l2vvrs9c74lo81  Connection: keep-alive  Cache-Control: max-age=0    --98586c48-F--  HTTP/1.1 500 Internal Server Error  Content-Length: 543  Connection: close  Content-Type: text/html; charset=iso-8859-1    --98586c48-E--    --98586c48-H--  Apache-Error: [file "fcgid_proc_unix.c"] [line 637] [level 4] [status 104] mod_fcgid: error reading data from FastCGI server  Apache-Error: [file "/builddir/build/BUILD/httpd-2.2.15/server/util_script.c"] [line 435] [level 19] Premature end of script headers: testphp.php  Apache-Handler: fcgid-script  Stopwatch: 1371470497629709 2809 (- - -)  Stopwatch2: 1371470497629709 2809; combined=25, p1=3, p2=10, p3=1, p4=1, p5=9, sr=0, sw=1, l=0, gc=0  Response-Body-Transformed: Dechunked  Producer: ModSecurity for Apache/2.7.3 (http://www.modsecurity.org/).  Server: Apache  Engine-Mode: "ENABLED"    --98586c48-Z--  

Where I'm wrong at? What I'm missing?

No comments:

Post a Comment