Saturday, April 24, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to count identical 1kb blocks( in C)?

Posted: 24 Apr 2021 10:08 AM PDT

I am trying to count all 1kb blocks of 2 files and all identical (1 kb) blocks of these 2 files. At the end the program doesn't print the right answers. This is what I have written so far:

#include <stdio.h>  #include <string.h>  #include<stdlib.h>      void compare(FILE *fp1, FILE *fp2)  {  char block1[1024];  char block2[1024];  int count_b_file1=0;  int count_b_file2=0;  int count_id=0;  for (;;)  {  size_t read_file=fread(block1,1,sizeof(block1),fp1);  if (read_file == 0){ break;}  count_b_file1=count_b_file1+1;  }  for (;;)  {    size_t read_file2=fread(block2,1,sizeof(block2),fp2);  if (read_file2 == 0){ break;}  count_b_file2=count_b_file2+1;  }  fseek(fp1,0,SEEK_SET);  fseek(fp2,0,SEEK_SET);  char compare_block[1024];  for (;;)  {  size_t read_file1=fread(block2,1,sizeof(block1),fp1);  if (read_file1==0){break;}  size_t read_file2=fread(block2,1,sizeof(block2),fp2);  if (read_file2==0){break;}  if ( memcmp (block1,block2,sizeof(block1))==0)  {  count_id=count_id+1;  }  }    printf("%d \n",count_b_file1);  printf("%d \n",count_b_file2);  printf("%d \n",count_id);      }    int main()  {  FILE *file1=fopen("file1","r");  FILE *file2=fopen("file3","r");      compare(file1,file2);   fclose(file1);   fclose(file2);  return 0;  }  

Get content of files with same name in subfolders to obtain a JSON array

Posted: 24 Apr 2021 09:40 AM PDT

I have the files in folders that begin with 28-.

They are one wire bus sensors to measure the temperature. The Raspberry recognize them via its SPI interface; every probe has its ID (something beginning with 28-), and RB creates a tree for every sensor named as the probe's ID, like

ls /sys/bus/w1/devices/w1_bus_master1 -1  28-00000cbece94/  28-00000cbeeca3/  28-00000cbeedf6/  28-00000cbf87ba/  ...  

Inside the folder there are two files (among many others) which are temperature and name.

name is the probe ID which is also the folder name; temperature is ( ... surprise) the temperature.

Where the ID is both the folder name and the content of the file:

cat /sys/bus/w1/devices/w1_bus_master1/28-00000cc002fa/name   28-00000cc002fa  

and the temp is

cat /sys/bus/w1/devices/w1_bus_master1/28-00000cc002fa/temperature   21812  

I would like to write a script or compose a sequence of bash commands that ends in yielding an array of JSON objects, like: [ {"ID": "28-00000cbece94", "temp": 24.712}, {"ID": "28-00000cbeeca3", "temp": 24.735}, <so on> ] I think awk should be involved but maybe find -exec, but a simple grep+cat but even tree, but...

Any help?

Thanks in advance

Am I making invalid assumptions with regard to my kernel module's shared memory?

Posted: 24 Apr 2021 08:14 AM PDT

I have written a "device driver" (see source code here: https://bitbucket.org/wothke/websid/src/master/raspi/websid_module/ ) that runs fine for most of the time (see https://www.youtube.com/watch?v=bE6nSTT_038 ) but which still seems to have the potential to randomly crash the device occasionally.

The "device driver" starts a kthread that performs a simple but timing critical playback loop in which it controls some connected audio chip via multiple GPIO pins. This kthread is run (using kthread_bind) on an "isolated" CPU core which should be largely excempted from regular kernel use (see details on kernel configuration below). The kthread is given high prio via sched_set_fifo. The kthread makes no subroutine calls and does not require any memory that has not already been previously allocated in the kernel. (The thread also temporarily disables anything that might interfer with its timing, using get_cpu, local_irq_save & local_bh_disable. However these do not seem to be the root cause of the sporadic crashes since crashes could be reproduced even when that disabling was not used.)

I have compiled a regular "Raspberry OS" "Desktop" kernel but I specifically activated NO_HZ_FULL (i.e. "Full dynaticks system (tickless)"). Also I am specifically isolating core #3 via cmdline.txt with: isolcpus=3 rcu_nocbs=3 rcu_nocb_poll=3 nohz_full=3 (which seems to keep most IRQs off cpu core #3 - as intended, so that my above kthread should be pretty alone on that core #3)

The susual suspect might be the "shared kernel memory" buffer that is used for all communication between the above "playback" kthread and the producer of the data which lives in "userland". I already took all the precautions that I could think of to avoid potential race-conditions but maybe there is some kind of CPU cache effect, or something else that I am overlooking.. The "shared buffer" contains 4 page aligned areas that are setup/used in a way that should ensure safe communication/synchronization.

  1. the 1st page only contains one 32-bit flag that is accessed as an u32 or uint32_t (this should be naturally atomar). The kthread only updates this flag when it is 0 and it only sets it to something non-0. The userland code only resets this flag to 0 and only if it had some non-0 value - thereby acknowledging that it received the non-0 value set by the kthread.

  2. the 2nd page contains a similar flag like 1) but for the opposite direction, i.e. here it is the kthread that will receive something non-0 from "userland".

  3. the 3rd(+following) page(s) then contain the 1st buffer that is used for a simple double buffering scheme. This buffer is exclusively written to by the "userland" producer and exclusively read by the kthread. The "ping/pong" protocol implemented via the 2 flags is meant to ensure that the buffer is *never" used concurrently: The kthread initiates a sequence by signalling that one of the buffers can be filled and later the "userland" signals back after it has completed filling the respective buffer, i.e. the kthead only starts reading from a buffer after it has seen the signal from the producer that it is now safe to do so (before the "userland" producer gives that signal it uses msync(start_page, len, MS_INVALIDATE) to report which parts of the shared memory area it has updated.).

  4. the n-th(+following) pages(s) then contain the 2nd buffer (everything said in 3) applies here as well)

But even if something went wrong in the above, that might then block the kthread or the respective userland process.. but I don't see why that should crash the whole system.

The most plausible explanation for me would be if the "shared buffer" got randomly relocated (thus leading to random memory corruption), but I would think that this should not happen to a buffer allocated via:

_raw_buffer = kmalloc(AREA_SIZE + 2*PAGE_SIZE,                   GFP_KERNEL & ~__GFP_RECLAIM & ~__GFP_MOVABLE);  

Or if there was some kernal function that specifically went into some blocking wait for something from core #3 (which might not be happening due to my kthread starving everything else on that CPU..).. however I'd be surprised why such a problem would then only be striking storadically instead of crashing the machine all the time..

Any ideas?

Recommendation for tools or suite that can pull error logs from servers/enclosures

Posted: 24 Apr 2021 08:11 AM PDT

As the title suggests, I am looking for a community recommendation on the best way to pull logs from remote devices, and then quickly scan those logs for key strings, and/or specifically list hardware errors. The solution does not have to be one product or process either, but preferably Linux based, open source, and/or possibly a single commercial product.

The logs in question I am concerned about are for errors or failures, as follows: Hardware Failure logs (usually found through IPMI commands), Vmware logs, HP/storage enclosure error logs, Fans Failures, Power Supply failures, SATA Hard Drive Errors, and Memory Errors. I'd like a suggestion on a solution or solution suite that can grab those logs from the remote devices, and then searches can be done on the local side to search for the strings necessary.

Note, there is one somewhat unusual caveat: The equipment across different sites my company utilizes is not always connected to the network. There are certain times when the networks are brought up and/or connected and then at that time the devices/servers can be reached. Thus any solution(s) would have to account for the fact that the network is only brought up for connection only once every few days or even a week. Assuming the case that the day to day collection is done by equipment on site and then aggregated when we get an upload, the use case should probably take this into account if possible.

As far as my own researches, I have been toying with the idea of something like Greylog in tandem with maybe IPMI. I would also like maybe to utilize Anisble to possibly even run the processes which do this work on demand, and/or pull everything relevant to its control node from the entire site while connected.

Not the most convenient set of conditions I know, but I was hoping the community might have some suggestions to point me in the correct direction. Any help is appreciated, thanks in advance!

ERROR: xfce4-settings-4.16.1-r0: trying to overwrite [path] owned by exo-0.12.11-r0

Posted: 24 Apr 2021 07:16 AM PDT

i am on alpine-linux xfce

:~$ uname -a  Linux me176c 5.4.107-asus-me176c #1 SMP PREEMPT Sun Mar 21 20:28:04 UTC 2021 x86_64 Linux  

and I have problems upgrading as per

# apk upgrade  1 error; 2000 MiB in 668 packages  

the package that is problematic is xfce4-settings

unfortunately, apk can't fix it because of some permission issues:

# apk fix xfce4-settings  (1/1) Reinstalling xfce4-settings (4.16.1-r0)  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite etc/xdg/xfce4/helpers.rc owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/aterm.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/balsa.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/brave.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/caja.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/chromium.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/debian-sensible-browser.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/debian-x-terminal-emulator.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/dillo.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/encompass.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/epiphany.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/eterm.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/evolution.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/firefox.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/galeon.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/geary.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/gnome-terminal.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/google-chrome.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/icecat.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/icedove.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/iceweasel.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/jumanji.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/kmail.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/konqueror.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/links.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/lynx.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/midori.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/mozilla-browser.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/mozilla-mailer.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/mutt.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/nautilus.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/netscape-navigator.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/nxterm.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/opera-browser.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/pcmanfm-qt.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/pcmanfm.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/qterminal.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/qtfm.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/qupzilla.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/rodent.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/rox-filer.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/sakura.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/surf.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/sylpheed-claws.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/sylpheed.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/terminator.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/thunderbird.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/urxvt.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/vimprobable2.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/w3m.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/xfce4-terminal.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/xfe.desktop owned by exo-0.12.11-r0.  ERROR: xfce4-settings-4.16.1-r0: trying to overwrite usr/share/xfce4/helpers/xterm.desktop owned by exo-0.12.11-r0.  Executing busybox-1.33.0-r7.trigger  Executing gtk-update-icon-cache-2.24.33-r0.trigger  Executing desktop-file-utils-0.26-r0.trigger  Executing postmarketos-base-10-r0.trigger  1 error; 2000 MiB in 668 packages  

how do I fix this issue about usr/share/xfce4/helpers/*** owned by exo-0.12.11-r0.

so far, the following didn't solve the issue

# chown $USER:$USER /usr/share/xfce4/helpers  / -r  

Create/decompress Zip file with LZMA compression?

Posted: 24 Apr 2021 08:10 AM PDT

According to PKWARE's Zip Appnote, it is possible to compress individual files in Zip files using LZMA (see section 5.8 LZMA - Method 14). Support for LZMA seems to have been added around 2013.

Is there a Linux Zip tool that can create and decompress Zip files that use LZMA compression?

Why does exec print its output after the program exits?

Posted: 24 Apr 2021 07:52 AM PDT

I'm writing a program to pipe one command to another. Inputs will be from the command line

me@ubuntu:~$ ./a.out ls '|' wc  c2 PID 6804  c1 PID 6803  PARENT PID 6802  me@ubuntu:~$       2       2      17  

why does the output print after the prompt returns. is there any way to prevent that? This is the code i've written.

#include <stdio.h>  #include <string.h>  #include <sys/types.h>  #include <sys/wait.h>  #include <unistd.h>    int main(int argc, char * argv[])  {      if(argc <= 1 )      {          printf("ERROR: No arguments passed\n");          printf("USAGE: ./pipe <command 1> | <command 2>\n");          return 1;      }        char * cmd1[50];      char * cmd2[50];      int cmd1_arg = 0;      int cmd2_arg = 0;      int pipe_num = 0;            for(int cla = 1; cla<argc; cla++)      {          if( !strcmp(argv[cla],"|") )                      pipe_num++;          else if(pipe_num == 0)                      cmd1[cmd1_arg++] = argv[cla];          else if(pipe_num == 1)              cmd2[cmd2_arg++] = argv[cla];      }        cmd1[cmd1_arg] = (char *)NULL;      cmd2[cmd2_arg] = (char *)NULL;            if(pipe_num != 1)      {          printf("ERROR: Insufficient arguments passed\n");          printf("USAGE: ./pipe <command 1> | <command 2>\n");          return 1;      }        int pipe_fd[2];      pipe(pipe_fd);           pid_t pid = fork();      if(pid == -1)      {          perror("FORK FAILED");          return 1;      }            if(pid != 0)      {                    pid_t cmd_pid = fork();          if(cmd_pid == -1)          {              perror("FORK FAILED");              return 1;          }            if(cmd_pid != 0)          {                 waitpid(pid,NULL,0);                                   waitpid(cmd_pid,NULL,WNOHANG);                          printf("PARENT PID %d\n",getpid());                      }            if(cmd_pid == 0)          {              printf("c2 PID %d\n",getpid());              close(pipe_fd[1]);              int stdin_fd = dup(0);              close(0);              dup(pipe_fd[0]);                          if(execvp(cmd2[0],cmd2) == -1 ) perror("CMD2 FAIL");               close(0);              dup(stdin_fd);          }              }        if(pid == 0)      {          printf("c1 PID %d\n",getpid());                  close(pipe_fd[0]);                  int stdout_fd = dup(1);                  close(1);                          int test = dup(pipe_fd[1]);          if( execvp(cmd1[0],cmd1) == -1 ) perror("CMD1 FAIL");          close(1);                  dup(stdout_fd);      }        return 0;  }  

Built In Speakers do not work, headphones do, USB speakers do

Posted: 24 Apr 2021 07:38 AM PDT

I have an HP All-in-one, (HP Pavilion All-in-One 24-xa0xxx), and everything has appeared to work on linux, except the built in speakers. The headphone jack works fine. I am running Arch Linux, but this isn't because of Arch, because it has not worked on Ubuntu. I have tried editing the file in /usr/share/pulseaudio/alsa-mixer/paths/analog-output-speaker.conf but that did almost nothing. On pavucontrol, it just says Speakers (Unavailable). I have also tried editing /etc/modprobe.d/alsa-base.conf, but to no avail also. Right now I have some USB speakers, they work fine, but they are a hassle because they take up an extra USB slot and have worse sound.Any help would be greatly appreciated. None of the tutorials or forum posts ever helped, and wildly ranged in answers.

% lspci               00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 07)  00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Desktop)  00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model  00:12.0 Signal processing controller: Intel Corporation Cannon Lake PCH Thermal Controller (rev 10)  00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10)  00:14.2 RAM memory: Intel Corporation Cannon Lake PCH Shared SRAM (rev 10)  00:14.5 SD Host controller: Intel Corporation Device a375 (rev 10)  00:16.0 Communication controller: Intel Corporation Cannon Lake PCH HECI Controller (rev 10)  00:17.0 RAID bus controller: Intel Corporation SATA Controller [RAID mode] (rev 10)  00:1c.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #5 (rev f0)  00:1c.5 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #6 (rev f0)  00:1f.0 ISA bridge: Intel Corporation H370 Chipset LPC/eSPI Controller (rev 10)  00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)  00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)  00:1f.5 Serial bus controller [0c80]: Intel Corporation Cannon Lake PCH SPI Controller (rev 10)  01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)  02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8822BE 802.11a/b/g/n/ac WiFi adapter  
% pacmd list-sinks  2 sink(s) available.    * index: 0      name: <alsa_output.usb-CD002_CD002_CD002-01.analog-stereo>      driver: <module-alsa-card.c>      flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL LATENCY DYNAMIC_LATENCY      state: IDLE      suspend cause: (none)      priority: 9049      volume: front-left: 34182 /  52%,   front-right: 32897 /  50%              balance -0.04      base volume: 65536 / 100%      volume steps: 256      muted: no      current latency: 1566.65 ms      max request: 375 KiB      max rewind: 375 KiB      monitor source: 0      sample spec: s16le 2ch 48000Hz      channel map: front-left,front-right                   Stereo      used by: 0      linked by: 0      configured latency: 2000.00 ms; range is 0.50 .. 2000.00 ms      card: 0 <alsa_card.usb-CD002_CD002_CD002-01>      module: 6      properties:          alsa.resolution_bits = "16"          device.api = "alsa"          device.class = "sound"          alsa.class = "generic"          alsa.subclass = "generic-mix"          alsa.name = "USB Audio"          alsa.id = "USB Audio"          alsa.subdevice = "0"          alsa.subdevice_name = "subdevice #0"          alsa.device = "0"          alsa.card = "1"          alsa.card_name = "CD002"          alsa.long_card_name = "CD002 CD002 at usb-0000:00:14.0-2, full speed"          alsa.driver_name = "snd_usb_audio"          device.bus_path = "pci-0000:00:14.0-usb-0:2:1.1"          sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/sound/card1"          udev.id = "usb-CD002_CD002_CD002-01"          device.bus = "usb"          device.vendor.id = "e2b7"          device.vendor.name = "Jie Li"          device.product.id = "0811"          device.product.name = "CD002"          device.serial = "CD002_CD002_CD002"          device.string = "front:1"          device.buffering.buffer_size = "384000"          device.buffering.fragment_size = "192000"          device.access_mode = "mmap+timer"          device.profile.name = "analog-stereo"          device.profile.description = "Analog Stereo"          device.description = "CD002 Analog Stereo"          module-udev-detect.discovered = "1"          device.icon_name = "audio-card-usb"      ports:          analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)              properties:                        active port: <analog-output>      index: 1      name: <alsa_output.pci-0000_00_1f.3.analog-stereo>      driver: <module-alsa-card.c>      flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY      state: RUNNING      suspend cause: (none)      priority: 9039      volume: front-left: 62899 /  96% / -1.07 dB,   front-right: 62899 /  96% / -1.07 dB              balance 0.00      base volume: 65536 / 100% / 0.00 dB      volume steps: 65537      muted: no      current latency: 58.88 ms      max request: 11 KiB      max rewind: 11 KiB      monitor source: 2      sample spec: s16le 2ch 48000Hz      channel map: front-left,front-right                   Stereo      used by: 1      linked by: 1      configured latency: 60.00 ms; range is 0.50 .. 2000.00 ms      card: 2 <alsa_card.pci-0000_00_1f.3>      module: 8      properties:          alsa.resolution_bits = "16"          device.api = "alsa"          device.class = "sound"          alsa.class = "generic"          alsa.subclass = "generic-mix"          alsa.name = "ALC225 Analog"          alsa.id = "ALC225 Analog"          alsa.subdevice = "0"          alsa.subdevice_name = "subdevice #0"          alsa.device = "0"          alsa.card = "0"          alsa.card_name = "HDA Intel PCH"          alsa.long_card_name = "HDA Intel PCH at 0xa1398000 irq 129"          alsa.driver_name = "snd_hda_intel"          device.bus_path = "pci-0000:00:1f.3"          sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"          device.bus = "pci"          device.vendor.id = "8086"          device.vendor.name = "Intel Corporation"          device.product.id = "a348"          device.product.name = "Cannon Lake PCH cAVS"          device.form_factor = "internal"          device.string = "front:0"          device.buffering.buffer_size = "384000"          device.buffering.fragment_size = "192000"          device.access_mode = "mmap+timer"          device.profile.name = "analog-stereo"          device.profile.description = "Analog Stereo"          device.description = "Built-in Audio Analog Stereo"          module-udev-detect.discovered = "1"          device.icon_name = "audio-card-pci"      ports:          analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: no)              properties:                  device.icon_name = "audio-speakers"          analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: yes)              properties:                  device.icon_name = "audio-headphones"      active port: <analog-output-headphones>  

How to download Windows Files on Debian 10 Linux? (.Exe)

Posted: 24 Apr 2021 08:12 AM PDT

I want to download a game launcher called "DDtank New Era Launcher" on my chromebook but there's no Linux download available.

apt --fix-broken install not working on raspberry pi

Posted: 24 Apr 2021 09:40 AM PDT

i have a little problem with my raspberry pi. Every time I wanna install a package this happens:

pi@raspberrypi:~ $ sudo apt install openjdk-8-jre  Reading package lists... Done  Building dependency tree         Reading state information... Done  You might want to run 'apt --fix-broken install' to correct these.  The following packages have unmet dependencies:   chromium-browser : Depends: chromium-codecs-ffmpeg-extra (= 86.0.4240.197-rpt1) but 88.0.4324.187-rpt1 is to be installed or                               chromium-codecs-ffmpeg (= 86.0.4240.197-rpt1) but it is not going to be installed   chromium-browser-l10n : Depends: chromium-browser (>= 88.0.4324.187-rpt1) but 86.0.4240.197-rpt1 is to be installed   libpython3.7-dev : Depends: libpython3.7-stdlib (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is to be installed                      Depends: libpython3.7 (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is to be installed   openjdk-8-jre : Depends: openjdk-8-jre-headless (= 8u212-b01-1+rpi1) but it is not going to be installed                   Depends: libatk-wrapper-java-jni (>= 0.33.3-9~) but it is not going to be installed                   Recommends: fonts-dejavu-extra but it is not going to be installed   python3.7-dev : Depends: libpython3.7-dev (= 3.7.3-2+deb10u3) but 3.7.3-2+deb10u2 is to be installed  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).  

And when I then run apt --fix-broken install this happens:

pi@raspberrypi:~ $ sudo apt --fix-broken install  Reading package lists... Done  Building dependency tree         Reading state information... Done  Correcting dependencies... Done  The following additional packages will be installed:    chromium-browser libpython3.7-dev  Suggested packages:    webaccounts-chromium-extension unity-chromium-extension adobe-flashplugin  The following packages will be upgraded:    chromium-browser libpython3.7-dev  2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.  2 not fully installed or removed.  Need to get 0 B/151 MB of archives.  After this operation, 5,602 kB of additional disk space will be used.  Do you want to continue? [Y/n] y  dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt  dpkg-deb: error: <decompress> subprocess returned error exit status 2  dpkg-deb (subprocess): cannot copy archive member from '/var/cache/apt/archives/chromium-browser_88.0.4324.187-rpt1_armhf.deb' to decompressor pipe: failed to write (Broken pipe)  dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt  dpkg-deb: error: <decompress> subprocess returned error exit status 2  dpkg-deb (subprocess): cannot copy archive member from '/var/cache/apt/archives/libpython3.7-dev_3.7.3-2+deb10u3_armhf.deb' to decompressor pipe: failed to write (Broken pipe)  Reading changelogs... Done  (Reading database ... 98611 files and directories currently installed.)  Preparing to unpack .../chromium-browser_88.0.4324.187-rpt1_armhf.deb ...  Unpacking chromium-browser (88.0.4324.187-rpt1) over (86.0.4240.197-rpt1) ...  dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt  dpkg-deb: error: <decompress> subprocess returned error exit status 2  dpkg: error processing archive /var/cache/apt/archives/chromium-browser_88.0.4324.187-rpt1_armhf.deb (--unpack):   cannot copy extracted data for './usr/lib/chromium-browser/chromium-browser-v7' to '/usr/lib/chromium-browser/chromium-browser-v7.dpkg-new': unexpected end of file or stream  Preparing to unpack .../libpython3.7-dev_3.7.3-2+deb10u3_armhf.deb ...  Unpacking libpython3.7-dev:armhf (3.7.3-2+deb10u3) over (3.7.3-2+deb10u2) ...  dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt  dpkg-deb: error: <decompress> subprocess returned error exit status 2  dpkg: error processing archive /var/cache/apt/archives/libpython3.7-dev_3.7.3-2+deb10u3_armhf.deb (--unpack):   cannot copy extracted data for './usr/lib/python3.7/config-3.7m-arm-linux-gnueabihf/libpython3.7m-pic.a' to '/usr/lib/python3.7/config-3.7m-arm-linux-gnueabihf/libpython3.7m-pic.a.dpkg-new': unexpected end of file or stream  Errors were encountered while processing:   /var/cache/apt/archives/chromium-browser_88.0.4324.187-rpt1_armhf.deb   /var/cache/apt/archives/libpython3.7-dev_3.7.3-2+deb10u3_armhf.deb  E: Sub-process /usr/bin/dpkg returned an error code (1)  

How do I fix this?

Thanks!

PartMan does not change partitions labels

Posted: 24 Apr 2021 07:14 AM PDT

So, I edited the partman-auto udeb in debian-installer to make some partitions.

partman-auto/text/multi_scheme ::    1 1 1 free      $iflabel{ gpt }      $reusemethod{ }      method{ biosgrub } .    128 512 256 ext2      $defaultignore{ }      method{ format }      format{ }      use_filesystem{ }      filesystem{ ext2 }      mountpoint{ /boot } .    300 800 51200 $default_filesystem      $lvmok{ }      method{ format }      format{ }      use_filesystem{ }      $default_filesystem{ }      label{ root }      mountpoint{ / } .    300 1500 30720 $default_filesystem      $lvmok{ }      method{ format }      format{ }      use_filesystem{ }      $default_filesystem{ }      label{ var }      mountpoint{ /var } .    96 512 1024 linux-swap      $lvmok{ }      $reusemethod{ }      method{ swap }      label{ swap }      format{ } .    20 300 500 $default_filesystem      $lvmok{ }      method{ format }      format{ }      use_filesystem{ }      $default_filesystem{ }      label{ secours }      mountpoint{ /mnt/secours } .    300 3000 -1 $default_filesystem      $lvmok{ }      method{ format }      format{ }      use_filesystem{ }      $default_filesystem{ }      label{ home }      mountpoint{ /home } .    

The installer only sets the labels for secours and home, and I don't understand why.
How do I make it work?

slub_min_objects : How comes 0 can stand as a valid / default value?

Posted: 24 Apr 2021 08:28 AM PDT

In the comments of the source code (mm/slub.c) of my linux_5.4 kernel, I can read :

In order to reach satisfactory performance we must ensure that a minimum  number of objects is in one slab. Otherwise we may generate too much  activity on the partial lists which requires taking the list_lock. This is  less a concern for large slabs though which are rarely used.  

My understanding of "a minimum number of objects" is whatever > 0

From some benchmarks achieved under some linux-4, I had even understood that the optimal value had been found to be 2 * Number of CPUs.

In the documentation (Documentation/vm/slub.rst) I can read :

.. slub_min_objects=x (default 4)

Having 2 cores I feel happy with that default value. However, my bootlog tells :

SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1  

Of course I can set slub_min_objects=4 as part of my boot command line and successfully get MinObjects=4. However, I would like to understand how comes the default value went down to 0 ?

Have things changed elsewhere in linux kernel justifying that 0 is actually the best possible value ? or that we should in fact no longer care about this as a condition for better performance ?

How can i repair grub after installing Windows 10?

Posted: 24 Apr 2021 07:24 AM PDT

I have installed debian-buster after that I install Windows 10 on the same hard disk. When I tried to reboot ,i can enter into Windows 10 by default.In order to enter into debian,i press del key when rebooting to enter into bios setting,here i can find a menu PO ST1000VX000(my hard disk),select it and reboot again,it boot into grub rescue prompt,my debian was installed on gpt6 partition.

grub rescue> set root=(hd0,gpt6)  grub rescue> set prefix=(hd0,gpt6)/boot/grub  grub rescue> insmod normal  grub rescue> normal  

Now i can see the previous debian boot menu,enter into debian,show all partitions on my hard disk.

sudo fdisk -l  /dev/sda  Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors  Disk model: ST1000VX000       Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 4096 bytes  I/O size (minimum/optimal): 4096 bytes / 4096 bytes  Disklabel type: gpt  Disk identifier: BF20422A-7E3A-4CA2-B249-61BB4A5D42B7    Device         Start        End    Sectors   Size Type  /dev/sda1       2048     923647     921600   450M Windows recovery environment  /dev/sda2     923648    1128447     204800   100M EFI System  /dev/sda3    1128448    1161215      32768    16M Microsoft reserved  /dev/sda4    1161216  315119615  313958400 149.7G Microsoft basic data  /dev/sda5  315119616  346370047   31250432  14.9G Linux swap  /dev/sda6  346370048 1953523711 1607153664 766.4G Linux filesystem  

I want to repair the grub.

sudo grub-install  /dev/sda  Installing for i386-pc platform.  grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.  grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..  grub-install: error: will not proceed with blocklists.  

How can i fix the grub setting to boot both debian and win10?
Almost the same error info for commands:

sudo grub-install  /dev/sda6  sudo grub-install  /dev/sda  

enter image description here

Have a try :

debian@debian:~$ sudo mount /dev/sda6  /mnt  debian@debian:~$ sudo grub-install  --root-directory=/mnt   /dev/sda6  Installing for i386-pc platform.  grub-install: warning: File system `ext2' doesn't support embedding.  grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..  grub-install: error: will not proceed with blocklists.  

Following the webpage: can-i-install-in-uefi-mode-with-the-alternate-installer

For my system: root (/) partition is sda6,EFI partition is sda2.

sudo mount /dev/sda6  /mnt   sudo mkdir -p /mnt/boot/efi  sudo mount /dev/sda2  /mnt/boot/efi  sudo mount --bind /dev /mnt/dev  sudo mount --bind /proc /mnt/proc  sudo mount --bind /sys /mnt/sys  sudo chroot /mnt    apt-get install grub-efi-amd64    grub-install --force   

Now to reboot,the grub menu show on my screen,but no window startup option to select,i enter into debian,type

sudo grub-install /dev/sda  sudo grub-install /dev/sda --force  

Both of them can't write window10 into the grub menu.

sudo grub-install  /dev/sda  Installing for i386-pc platform.  grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.  grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..  sudo grub-install  /dev/sda --force  Installing for i386-pc platform.  grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.  grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..  Installation finished. No error reported.  

During the above procedure ,i got a little progress:The grub menu pop up ,previously it can't be shown! I go on to have a try adding windows startup in the grub menu.

sudo ls -al  /boot/grub/grub.cfg  -r--r--r-- 1 root root 6271 Apr 24 21:07 /boot/grub/grub.cfg  sudo chmod  777  /boot/grub/grub.cfg  vim  /boot/grub/grub.cfg  #add the following lines  ## BEGIN /etc/grub.d/30_os-prober ###  menuentry 'Windows Boot Manager (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-efi-4A44-FBE5' {      insmod part_gpt      insmod fat      set root='hd0,gpt2'      if [ x$feature_platform_search_hint = xy ]; then        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  4A44-FBE5      else        search --no-floppy --fs-uuid --set=root 4A44-FBE5      fi      chainloader /EFI/Microsoft/Boot/bootmgfw.efi  }  ### END /etc/grub.d/30_os-prober ###  sudo chmod 444  /boot/grub/grub.cfg  

The windows startup added into grub menu,select the windows boot manager(on /dev/sda2) and click enter ,an error occurs:

error:invalid signature  press any key to continue  

Do as Hermann suggest:

debian@debian:~$ sudo rm /boot/grub/grub.cfg  debian@debian:~$ sudo mount /dev/sda6  /mnt   debian@debian:~$ sudo mkdir -p /mnt/boot/efi  debian@debian:~$ sudo mount /dev/sda2  /mnt/boot/efi  debian@debian:~$ sudo mount --bind /dev /mnt/dev  debian@debian:~$ sudo mount --bind /proc /mnt/proc  debian@debian:~$ sudo mount --bind /sys /mnt/sys  debian@debian:~$ sudo chroot /mnt    root@debian:/# grub-install --target=x86_64-efi  Installing for x86_64-efi platform.  grub-install: warning: EFI variables are not supported on this system..  Installation finished. No error reported.  root@debian:/#   

Reboot pc, no windows boot manager in grub menu,win10 lost!I can enter win10 this way:

reboot and press `del` key into bios setting  select windows boot manager  enter  

How can add win10 startup in my grub menu and boot it successfully?

Is there any guide how to write bash scripts compatible with both CentOS and Ubuntu

Posted: 24 Apr 2021 07:55 AM PDT

I am simplifying my scenario here.

I've built a series of bash scripts and tested them under Ubuntu.

I want to make sure my scripts (bash syntax) work the same under CentOs.

Is there any guide how to write bash scripts compatible with both CentOS and Ubuntu ?

Or even better: is there any guide explains how create cross-linux-platform bash scripts?

Update and Clarification

In reference to @C.M. comment, I am not asking how bash works. I am asking if the bash interpreter code base is different among Linux distributions?

For example, Most of the Python 3's code base is the same among many many platform and behaves the same. To my experience Python code is very potable. The same apply to node.js code many other interpreters.

However, I am not sure if Bash benefits from the same portability. I might be wrong, but to me it seems that Bash is internally integrated inside Linux distributions. Am I correct? Do most linux distributions use the same source code repository to compile and distribute Bash?

Smoother resizing in tiling WMs

Posted: 24 Apr 2021 09:14 AM PDT

Is there a way to make the resizing of windows in tiling WMs smoother, if so , then how? Having those artifacts in the window every time close a window really ruins the experience.

How to control screens on several Windows computers placed around a room?

Posted: 24 Apr 2021 08:45 AM PDT

I want to setup read-only screens around a room that displays different messages at different times. A single laptop would run a BASH script that checks the times, and decides which messages to send to which display, and when. This could either be text only (maybe a console, but with a huge font) or pictures, whichever is possible will be fine. A very basic script might look something like this:

#!/bin/bash  echo "Good morning!" > /dev/screen1  echo "Please stack the blocks as high as you can!" > /dev/screen2  

My workplace has many unused Lenovo Yogas, so I could fold back the keyboard and mount seven or eight of the them around the room with just the screens showing. I don't think the workplace would allow me to remove Windows 10 from these devices.

  • Text or pictures, either is fine.
  • The Yogas do have HDMI ports.
  • People in the room won't interact with the screens, they display information only.

The question is, how do I get text (or optionally pictures) from a BASH script on a laptop running Linux to display on these different messages or pictures on the Windows screens scattered around the room?

Migrate shells Solaris ksh to Red Hat

Posted: 24 Apr 2021 09:54 AM PDT

We have hundreds of shell scripts running on a Solaris 11.3 server. System shell is ksh93

$ ls -l /bin/sh  lrwxrwxrwx   1 root     root          13 Apr 12  2018 /bin/sh -> sparcv9/ksh93  

All the scripts have the she-bang #!/bin/ksh at the top.

The server is being migrated to Red Hat Enterprise Linux running on x86/64, and I understand the system shell is bash and ksh93 is not configured on RHEL by default.

I am assuming it is possible to install and configure ksh93 on RHEL to help with this?

Some of the scripts use ksh specific syntax.

Does anyone have any experience with this process?

How does linux know to mount / without /etc/fstab

Posted: 24 Apr 2021 09:31 AM PDT

When /etc/fstab gets deleted/name is changed booting into the machine still works, in addition the root file system (/) is still mounted and on the correct storage device, how does it know to mount / on that device without /etc/fstab.

Use desktop icons in Debian 10

Posted: 24 Apr 2021 08:02 AM PDT

Debian 10 (Buster) uses GNOME 3.30, which again can use icons on the desktop. To achieve this, I understand that one needs to make a setting that GNOME uses Nautilus to manage the desktop.

I searched in dconf-editor, Optimierungen and Einstellungen (no idea what they're called in English), bus was unable to find such a setting.

Where can I find this?

Missing desktop files or folders on Debian 10, but I can see them on file manager

Posted: 24 Apr 2021 07:56 AM PDT

I installed Debian 10 from the minimal installer I downloaded from this link, and I choose the GNOME Desktop Environment. Everything seemed to be fine during the installation.

Now, I found out my desktop has no icons and there is no way to put any kind of file, folder or link in the desktop, but navigating to the desktop trough the file manager correctly shows files and folders.

This is all I have when I right click on the desktop. What could I do to get my desktop icons back?

I already tried to search into gnome-tweaks and into the settings for some setting hiding the icons, but I didn't find anything.

I tried solutions posted on this question but it did not work.

Command gnome-shell --version outputs GNOME Shell 3.30.2

Command uname -a outputs Linux debian 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) x86_64 GNU/Linux

Systemd under Ubuntu 18.04.1 fails with "Failed to create /user.slice/......service/init.scope control group: Permission denied"

Posted: 24 Apr 2021 07:30 AM PDT

On my Ubuntu 18.04.1 system the User Manager of systemd fails to start. I suppose this to be the root cause of other problems that I currently encounter. Any ideas how to get rid of this?

systemd version

$ systemd --version  systemd 237  +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid  

Ubuntu 18.04.1 LTS Version

$ uname -a  Linux example.com 4.15.0 #1 SMP Wed Jul 25 19:09:31 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux  

systemctl unit status

 $ sudo systemctl status user@1001.service  ● user@1001.service - User Manager for UID 1001     Loaded: loaded (/lib/systemd/system/user@.service; static; vendor preset: enabled)    Drop-In: /lib/systemd/system/user@.service.d             └─timeout.conf     Active: failed (Result: protocol) since Tue 2019-01-08 10:33:08 CET; 1min 42s ago    Process: 315 ExecStart=/lib/systemd/systemd --user (code=exited, status=1/FAILURE)   Main PID: 315 (code=exited, status=1/FAILURE)    Jan 08 10:33:08 example.com systemd[1]: Starting User Manager for UID 1001...  Jan 08 10:33:08 example.com systemd[315]: pam_unix(systemd-user:session): session opened for user mischa by (uid=0)  Jan 08 10:33:08 example.com systemd[1]: user@1001.service: Failed with result 'protocol'.  Jan 08 10:33:08 example.com systemd[1]: Failed to start User Manager for UID 1001.  

The syslog says

Jan  8 10:33:08 example.com systemd[1]: Starting User Manager for UID 1001...  Jan  8 10:33:08 example.com systemd[315]: Failed to create /user.slice/user-1001.slice/user@1001.service/init.scope control group: Permission denied  Jan  8 10:33:08 example.com systemd[315]: Failed to allocate manager object: Permission denied  Jan  8 10:33:08 example.com systemd[1]: user@1001.service: Failed with result 'protocol'.  Jan  8 10:33:08 example.com systemd[1]: Failed to start User Manager for UID 1001.  

My user service unit file

$ cat /lib/systemd/system/user@.service  #  SPDX-License-Identifier: LGPL-2.1+  #  #  This file is part of systemd.  #  #  systemd is free software; you can redistribute it and/or modify it  #  under the terms of the GNU Lesser General Public License as published by  #  the Free Software Foundation; either version 2.1 of the License, or  #  (at your option) any later version.    [Unit]  Description=User Manager for UID %i  After=systemd-user-sessions.service    [Service]  User=%i  PAMName=systemd-user  Type=notify  ExecStart=-/lib/systemd/systemd --user  Slice=user-%i.slice  KillMode=mixed  Delegate=pids cpu  TasksMax=infinity  TimeoutStopSec=120s  

Desktop icons gone with nautilus file-manager in Debian 9

Posted: 24 Apr 2021 08:18 AM PDT

How can I make the desktop show icons again under 64bit Debian 9.0 Cinnamon?

I switched from the nemo file-manager to the nautilus one and now my desktop doesn't show any icons/folders and I can't right-click it either.

I already tried the gnome-tweak-tool which only has an option "Desktop"->"Icons on desktop" which I set to "On" and which didn't help. I also ran gsettings set org.gnome.desktop.background show-desktop-icons true and tried replacing "nemo" with "nautilus" in /usr/share/applications/x-cinnamon-mimeapps.list.

Also I'd like to know why desktop icons are apparently hidden by default when switching file-manager? Isn't that severely counterintuitive. Who wants the desktop to only display the wallpaper but no files on it? And is that just the case with nautilus?

Edit: I now switched from Cinnamon to KDE and from Nautilus to Dolphin: both are way better!

Mint 17.2 Synaptic Package Manager

Posted: 24 Apr 2021 08:07 AM PDT

I recently installed Mint 17.2 (Rafalea) on a HP-255 G1 laptop. It was one of the smoothest installs I have ever done. However I have found a major issue with the Synaptic Package Manager. Whilst it lets me install new packages I cannot select other options. The most frustrating of these is that, I am unable to upgrade packages that are out of date. Re-install and Remove are also unselectable. Whist I could go to the command line I am reluctant to do so as it has lead me to dependency hell - obviously would be happy to use it to fix the problem.

Receiving "Unable to correct problems, you have held broken packages." after trying to install python -setuptools and python-pip

Posted: 24 Apr 2021 10:02 AM PDT

I ran "sudo apt-get install python-setuptools python-pip" but I received:

Reading package lists... Done  Building dependency tree         Reading state information... Done  Some packages could not be installed. This may mean that you have  requested an impossible situation or if you are using the unstable  distribution that some required packages have not yet been created  or been moved out of Incoming.  The following information may help to resolve the situation:    The following packages have unmet dependencies:   python-pip : Depends: python-pip-whl (= 1.5.4-1ubuntu3) but it is not going to be installed  E: Unable to correct problems, you have held broken packages.  

i normally only run sudo apt-get install python-pip and it works, i dont know why i decided to try setuptools. i tried going on Synaptic Package Manager, click on "Edit" in the menu bar, and click on "Fix broken packages" and the command line sudo dpkg --configure -a and sudo apt-get -f install but i am still unable to install python-pip.

i am on linux mint 17 xfce 3.13.0-37-generic, using Python 2.7.6.

any help is greatly appreciated. i saw alot of commands online regarding dpkg but im not familiar enough with packages and i do not want to break anything else.

updates:

"sudo apt-cache policy python-pip"

python-pip:    Installed: (none)    Candidate: 1.5.4-1ubuntu3    Version table:       1.5.4-1ubuntu3 0          500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages       1.5.4-1 0          500 http://archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages  

"sudo apt-get install python-pip-whl"

Reading package lists... Done  Building dependency tree         Reading state information... Done  Some packages could not be installed. This may mean that you have  requested an impossible situation or if you are using the unstable  distribution that some required packages have not yet been created  or been moved out of Incoming.  The following information may help to resolve the situation:    The following packages have unmet dependencies:   python-pip-whl : Depends: python-requests-whl but it is not installable                    Depends: python-setuptools-whl but it is not installable                    Depends: python-six-whl but it is not installable                    Depends: python-urllib3-whl but it is not going to be installed  E: Unable to correct problems, you have held broken packages.  

update #2

$ sudo apt-cache policy python-pip-whl python-requests-whl python-setuptools-whl python-six-whl python-urllib3-whl

python-pip-whl:    Installed: (none)    Candidate: 1.5.4-1ubuntu1    Version table:       1.5.4-1ubuntu1 0          500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages  python-requests-whl:    Installed: (none)    Candidate: (none)    Version table:  python-setuptools-whl:    Installed: (none)    Candidate: (none)    Version table:  python-six-whl:    Installed: (none)    Candidate: (none)    Version table:  python-urllib3-whl:    Installed: (none)    Candidate: 1.7.1-1ubuntu3    Version table:       1.7.1-1ubuntu3 0          500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages  

$ for pkg in python-requests-whl python-setuptools-whl python-six-whl python-urllib3-whl; do sudo apt-get install $pkg; done

Reading package lists... Done  Building dependency tree         Reading state information... Done  Package python-requests-whl 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 'python-requests-whl' has no installation candidate  Reading package lists... Done  Building dependency tree         Reading state information... Done  Package python-setuptools-whl 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 'python-setuptools-whl' has no installation candidate  Reading package lists... Done  Building dependency tree         Reading state information... Done  Package python-six-whl 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 'python-six-whl' has no installation candidate  Reading package lists... Done  Building dependency tree         Reading state information... Done  Some packages could not be installed. This may mean that you have  requested an impossible situation or if you are using the unstable  distribution that some required packages have not yet been created  or been moved out of Incoming.  The following information may help to resolve the situation:    The following packages have unmet dependencies:   python-urllib3-whl : Depends: python-six-whl but it is not installable  E: Unable to correct problems, you have held broken packages.  

update #3

$ /etc/apt/sources.list

#deb cdrom:[Linux Mint 17.1 _Rebecca_ - Release amd64 20150107]/ trusty contrib main non-free

update #4

$ /etc/apt/sources.list.d $ ll

total 16  drwxr-xr-x 2 root root 4096 Jun 21 01:00 .  drwxr-xr-x 6 root root 4096 Jun 24 00:52 ..  -rw-r--r-- 1 root root   59 Jan  7 12:29 getdeb.list  -rw-r--r-- 1 root root  530 Jan  7 12:29 official-package-repositories.list  

$ cat getdeb.list

# deb http://archive.getdeb.net/ubuntu trusty-getdeb apps   

$ cat official-package-repositories.list

# Do not edit this file manually, use Software Sources instead.    deb http://packages.linuxmint.com rebecca main upstream import  #id:linuxmint_main  deb http://extra.linuxmint.com rebecca main #id:linuxmint_extra    deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse  deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse    deb http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse  deb http://archive.canonical.com/ubuntu/ trusty partner  

update #5

/etc/apt/apt.conf.d $ ll

total 52  drwxr-xr-x 2 root root 4096 Jun 24 01:06 .  drwxr-xr-x 6 root root 4096 Jun 24 00:52 ..  -rw-r--r-- 1 root root   49 Jun 21 00:59 00aptitude  -rw-r--r-- 1 root root   41 Jan  7 11:58 00cdrom  -rw-r--r-- 1 root root   73 Jan  7 11:58 00recommends  -rw-r--r-- 1 root root   40 Jun 21 00:58 00trustcdrom  -rw-r--r-- 1 root root  643 Apr 10  2014 01autoremove  -rw-r--r-- 1 root root  992 Jan  7 12:23 01autoremove-kernels  -rw-r--r-- 1 root root  123 Apr 10  2014 20changelog  -rw-r--r-- 1 root root  243 Mar 11  2013 20dbus  -rw-r--r-- 1 root root 2331 Apr  2  2014 50unattended-upgrades  -rw-r--r-- 1 root root  182 Feb 23  2014 70debconf  -rw-r--r-- 1 root root   33 Jun 24 01:06 99synaptic  

/etc/apt/preferences.d $ ll

total 16  drwxr-xr-x 2 root root 4096 Jun 21 01:16 .  drwxr-xr-x 6 root root 4096 Jun 24 00:52 ..  -rw-r--r-- 1 root root  216 Feb  3 07:15 official-extra-repositories.pref  -rw-r--r-- 1 root root  171 Jan  7 12:29 official-package-repositories.pref  

How to restore to permissions to sudoers file with no password?

Posted: 24 Apr 2021 07:39 AM PDT

The complete story:

I launched an Amazon EC2 "Tier" (VPS) running RHEL 7.1 and created a key for ssh.

EC2 automaticly crates a user called ec2-user for new Rhel VPSs, and it have the permissions (in sudoers file):

ec2-user    ALL = NOPASSWD: ALL  

I crated a new user (with password) called "e" and tried to add him to the sudoers file.

When i tried to edit the /etc/sudoers file with VI, it said the file is read-only, so i changed it's permissions to 600, and now every time i try to do somthing with "sudo" command, i get an error:

sudo: /etc/sudoers is world writable  sudo: no valid sudoers sources found, quitting  sudo: unable to initialize policy plugin  

and i can't change it back to 440, becuse i need to be root to do it and i can't do "sudo".

I read somewhere the solution is to run

pkexec chmod 0440 /etc/sudoers  

but it asks for password for ec2-user who don't have any password:

==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===  Authentication is needed to run `/usr/bin/chmod' as the super user  Authenticating as: Cloud User (ec2-user)  Password:     polkit-agent-helper-1: pam_authenticate failed: Authentication failure  ==== AUTHENTICATION FAILED ===  Error executing command as another user: Not authorized    This incident has been reported.  

What now? anyone have any idea how to proceed in order to make sudoers file 440 agin?

Create many files with random content

Posted: 24 Apr 2021 09:08 AM PDT

I am looking for a command to create multiple (thousands of) files containing at least 1KB of random data.

For example,

Name            size  file1.01        2K  file2.02        3K  file3.03        5K  etc.  

How can I create many files like this?

Why are post-up commands in /etc/network/interfaces ran multiple times at boot?

Posted: 24 Apr 2021 08:33 AM PDT

Here is the content of /etc/network/interfaces:

auto lo  iface lo inet loopback    auto eth0  iface eth0 inet dhcp    post-up /etc/network/if-up.d/sshstart  

And sshstart is a script with the following in it:

curl something something darkside send a file over ftps in the background &  /usr/bin/autossh -M 0 -f -N -o ServerAliveInterval=15 -o ServerAliveCountMax=3 -R 127.0.0.1:2005:127.0.0.1:22 -R 192.168.1.10:2006:192.168.2.110:1912 -L 127.0.0.1:5249:192.168.1.212:5249 username@17.16.15.2 -p 8080  

When the machine reboots, the curl command is executed multiple times, the file ends up 2 or 3 times on the ftp server and when I look at the processes it seems like there are multiple instances of autossh running... Not sure if this is how autossh does things or not, but for sure curl shouldn't upload the file multiple times.

My hunch is that the whole sshstart script is ran multiple times but I don't understand why.

I tried searching for details on the network setup process at boot but all I could find was syntax information for the interfaces file.

Can someone help please?

Thank you.

---Edit---

As suggested bellow I have modified my interfaces file as follow (removed the empty lines above post-up):

auto lo  iface lo inet loopback    auto eth0  iface eth0 inet dhcp  post-up /etc/network/if-up.d/sshstart  

And added the following line to sshstart:

echo $(date)>>/run/shm/sshstart.log  

Here is the content of /run/shm/sshstart.log after a reboot:

Wed Oct 29 08:07:00 EDT 2014  Wed Oct 29 08:07:07 EDT 2014  Wed Oct 29 08:07:07 EDT 2014  Wed Oct 29 08:07:07 EDT 2014  

So its been ran 4 times :( what's going on?

Emacs slow loading time with AUCTeX on TeX files

Posted: 24 Apr 2021 09:52 AM PDT

I installed the auctex and emacs packages on two Xubuntu 14.04 computers, both of which have been working fine. Emacs itself works fine on both, but now with the auctex package installed, when I load a TeX file (even just an empty one) I have a six second loading time for auctex, which I have to go through every time I load a TeX file.

Is this normal?

If not, what can I do to reduce this time?

I've searched the internet and nothing has turned up, only the fact that file parsing might take a long time, but it doesn't as I've enabled the feature to save and load parse files.

I am using Emacs 24 with AUCTeX 11.87

EDIT: The output of the *messages* buffer looks like this for a newly opened TeX file:

("emacs" "hi.tex")  Loading 00debian-vars...done  Loading /etc/emacs/site-start.d/50auctex.el (source)...  Loading /usr/share/emacs/site-lisp/auctex.el (source)...done  Loading /usr/share/emacs/site-lisp/preview-latex.el (source)...done  Loading /etc/emacs/site-start.d/50auctex.el (source)...done  Loading /etc/emacs/site-start.d/50autoconf.el (source)...done  Loading /etc/emacs/site-start.d/50cmake-data.el (source)...done  Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...  Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...  Error while loading 50dictionaries-common: Symbol's value as variable is void: debian-aspell-only-dictionary-alist  Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...  Loading cjk-enc...done  Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...done  Loading /etc/emacs/site-start.d/50latex-cjk-thai.el (source)...done  For information about GNU Emacs and the GNU system, type C-h C-a.  (New file)  Applying style hooks... done  exchange-point-and-mark: No mark set in this buffer [6 times]  exchange-point-and-mark: No mark set in this buffer  

phpmyadmin doesn't work after installing php5-mysqlnd

Posted: 24 Apr 2021 09:06 AM PDT

I am currently running into some problems with phpMyAdmin. I set everything up correctly and made sure everything worked. Then later after some developing on some pages I noticed I couldn't execute mysqli_result::fetch_all().

So I did my research and found out I only had to install the package php5-mysqlnd. So I did (apt-get install php5-mysqlnd). The installation did not fail and my PHP script could execute the mysqli_result::fetch_all() method.

However, phpmyadmin doesn't work anymore. It simply can't connect to the MySQL server anymore (all logins fail).

NOTE: every other script still has no problem connecting and logging in into the MySQL server. I also did not change any passwords. Login over the console is also possible.

I couldn't get it to work with the package installed. Then I reinstalled php5-mysql (which uninstalled php5-mysqlnd) and phpmyadmin worked again!

Not having the mysqli_result::fetch_all() method is not a major issue but if it is possible I would like to use it anyways. Simply because it is so convenient for debugging!

I am running a Nginx server and Debian 7.5 3.10.23 system.

To env or not to env

Posted: 24 Apr 2021 07:21 AM PDT

What is the difference between the command

$ env FOO=bar baz  

and

$ FOO=bar baz  

What effect does env have?

No comments:

Post a Comment