Tag Archives: linux

[Solved] sed -i error: sed: -e expression #1, char 44: invalid reference \1 on `s’ command’s RHS

How to Solve sed -i error:

sed -i.bak '/.*CMDLINE_LINUX.*/s#(.*)"#\1 net.ifnames=0"#' /etc/default/grub

always report the error: sed: -e expression #1, char 44: invalid reference \1 on `s’ command’s RHS

sed -i -r '/.*CMDLINE_LINUX.*/s#(.*)"#\1 net.ifnames=0"#' /etc/default/grub

Later we know that you need to add -r, because there is a backward reference – \1, and -i and -r should be written separately

[Solved] error processing package libapache2-mod-php7.2

Error in installing libpciaccess:


Setting up php7.2-cli (7.2.24-0ubuntu0.18.04.11) ...
dpkg: error processing package php7.2-cli (--configure):
 installed php7.2-cli package post-installation script subprocess returned error exit status 10
No apport report written because MaxReports is reached already
                                                              Setting up python-libxml2 (2.9.4+dfsg1-6.1ubuntu1.5) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
dpkg: dependency problems prevent configuration of libapache2-mod-php7.2:
 libapache2-mod-php7.2 depends on php7.2-cli; however:
  Package php7.2-cli is not configured yet.

dpkg: error processing package libapache2-mod-php7.2 (--configure):
 dependency problems - leaving unconfigured
Setting up libsqlite0 (2.8.17-14fakesync1) ...
No apport report written because MaxReports is reached already
                                                              Setting up librpm8 (4.14.1+dfsg1-2) ...

... ...

Errors were encountered while processing:
 ufw
 nfs-common
 openssh-server
 php7.2-cli
 libapache2-mod-php7.2
E: Sub-process /usr/bin/dpkg returned an error code (1)

To view installation information:

 apt list | grep libapache2-mod-php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libapache2-mod-php/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
libapache2-mod-php5filter/trusty 5.5.9+dfsg-1ubuntu4 amd64
libapache2-mod-php7.2/bionic-security,bionic-updates,now 7.2.24-0ubuntu0.18.04.11 amd64 [installed]

Just remove the contents reported as errors:

apt-get remove --purge libapache2-mod-php7.2
apt-get remove --purge nfs-common
apt-get remove --purge php7.2-cli
apt-get remove --purge ufw
apt-get remove --purge openssh-server
... ...

Upgrade list:

apt-get update

Review the installed information again and confirm remove:

apt list | grep libapache2-mod-php*

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libapache2-mod-php/bionic,bionic 1:7.2+60ubuntu1 all
libapache2-mod-php5filter/trusty 5.5.9+dfsg-1ubuntu4 amd64
libapache2-mod-php7.2/bionic-security,bionic-updates,now 7.2.24-0ubuntu0.18.04.11 amd64 [residual-config]

Reinstall, done!:

apt install libpciaccess
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libpciaccess
[email protected]:~/wk/bak_load/win2030/buildroot/dl$ sd apt-get install libpciaccess-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libpciaccess-dev is already the newest version (0.14-1).
The following packages were automatically installed and are no longer required:
  keyutils libnfsidmap2 libtirpc1 ncurses-term openssh-sftp-server php7.2-common php7.2-json php7.2-opcache php7.2-readline rpcbind ssh-import-id
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.

[Solved] Error 1044: Access denied for user ‘syz-remote‘@‘%‘ to database ‘webapp‘

Error 1044: Access denied for user ‘syz-remote’@‘%’ to database ‘webapp’

Cause: I was testing the code of golang connecting to the database. I finally reinstalled MySQL and set up remote login, but this problem still occurred.

My SYZ-remote account is specially created for remote login. Therefore, unlike the root user, it does not have the due permission. We need to set its permissions in MySQL .

View MySQL account permissions through this code

mysql> SELECT host,user,password_expired,Grant_priv,Super_priv FROM mysql.user;
+-----------+------------------+------------------+------------+------------+
| host      | user             | password_expired | Grant_priv | Super_priv |
+-----------+------------------+------------------+------------+------------+
| localhost | root             | N                | Y          | Y          |
| localhost | mysql.session    | N                | N          | Y          |
| localhost | mysql.sys        | N                | N          | N          |
| localhost | debian-sys-maint | N                | Y          | Y          |
| %         | syz-remote       | N                | N          | N          |
+-----------+------------------+------------------+------------+------------+
5 rows in set (0.00 sec)

You can see that the permission of Grant_priv and Super_priv in syz-remote is N

We gave him authority

update mysql.user set grant_priv = 'Y', Super_priv='Y' where user = 'syz-remote';

Refresh it again

flush privilegs;

[Solved] standard_init_linux.go:190: exec user process caused “exec format error“

Scene

In the process of packaging the golang application into a docker image, execute the following command

docker run -it -P --name docker_client -m 1024m --net host docker_client:1.0

After execution, the server reported this error

standard_init_linux.go:190: exec user process caused "exec format error"

It’s useless to follow the online method. I can run normally on the virtual machine. I’ll look at my dockerfile carefully later

FROM golang:alpine

ENV GO111MODULE=on \
    GOPROXY=https://goproxy.cn,direct \
    CGO_ENABLED=0 \
    GOOS=linux \
    GOARCH=amd64

# Create an apps directory in the container root directory
WORKDIR /build

# Copy the go_docker_demo1 executable from the current directory
COPY . .

# Compile our code into a binary executable app
RUN go build -o app .

# Move to the /dist directory where the generated binaries are stored
WORKDIR /dist

# Copy the binaries from the /build directory to here
RUN cp /build/app .

# Expose the port
EXPOSE 8080

# The command to run the golang program
CMD ["/dist/app"]

It is found that the goarch parameter is AMD64. Check the relevant version of the server later

 docker version
 #check the version of the docker

A problem was found in the output information. One line of parameters is arm64

 OS/Arch:           linux/arm64

So I modified the dockerfile file

FROM golang:alpine

ENV GO111MODULE=on \
    GOPROXY=https://goproxy.cn,direct \
    CGO_ENABLED=0 \
    GOOS=linux \
    GOARCH=arm64

# Create an apps directory in the container root directory
WORKDIR /build

# Copy the go_docker_demo1 executable from the current directory
COPY . .

# Compile our code into a binary executable app
RUN go build -o app .

# Move to the /dist directory where the generated binaries are stored
WORKDIR /dist

# Copy the binaries from the /build directory to here
RUN cp /build/app .

# Expose the port
EXPOSE 8080

# The command to run the golang program
CMD ["/dist/app"]

After rebuilding the dockerfile image, it will run normally.

[Solved] shell Error: Syntax error: “(“ unexpected (expecting “}“)

The hard disk is damaged and the system is reinstalled. An error is reported when executing the previous script

Syntax error: “(” unexpected (expecting “}”)

Troubleshooting:

ls -l /bin/sh

The default link is dash

Knowledge supplement

Bash: Unix shell written for GNU Project

SH: equivalent to /bin/bash –posix. It is bash that opens POSIX standard

Dash: it has faster execution speed than bash, but supports fewer statement leaves

Solution:

Here, I have no requirements for the speed of script execution, only that it can be used, so I can change it to bash

cd /bin/; ln -sf bash /bin/sh

l

Problem-solving.

[Solved] IDA Start Error: Unexcepted fatal error while intitailizing Python runtime…

When I opened IDA today, It suddenly appeared:

it startled me. What’s going on? Calm down and analyze it. I’m going to open it in the same directory as IDA. See what error reports:

the result can’t be opened, and then I directly open idat64.exe,

there should be a problem with the python path. Open the environment variable and add the following to the user environment variable:

PYTHONHOME  #EVI PATH
C:/Program File/python  #PATH

Then save and open IDA to use

[Solved] headless pyrender offscreen render Error: OpenGL.error.GLError: GLError(err = 12296,

Error description

When running vibe, the CentOS server without display is used. When using pyrender for off screen rendering, errors are reported OpenGL.error.GLError: GLError(err = 12296), as follows:

Traceback (most recent call last):
  File "demo.py", line 416, in <module>
    main(args)
  File "demo.py", line 278, in main
    renderer = Renderer(resolution=(orig_width, orig_height), orig_img=True, wireframe=args.wireframe)
  File "***/VIBE/lib/utils/renderer.py", line 60, in __init__
    point_size=1.0
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
    self._create()
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 134, in _create
    self._platform.init_context()
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/platforms/egl.py", line 177, in init_context
    assert eglInitialize(self._egl_display, major, minor)
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 409, in __call__
    return self( *args, **named )
  File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/OpenGL/error.py", line 232, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
        err = 12296,
        baseOperation = eglInitialize,
        cArguments = (
                <OpenGL._opaque.EGLDisplay_pointer object at 0x7f883a03a170>,
                c_long(0),
                c_long(0),
        ),
        result = 0
)

Solution

Ubuntu: https://pyrender.readthedocs.io/en/latest/install/index.html#installmesa Use OSMesa to offscreen render.

It is more convenient to use · CONDA · to install osmesa as follows:

conda install osmesa

Note: after installing osmesa, reinstall pyopengl, otherwise an error will still be reported, as follows:

pip uninstall pyopengl
git clone https://github.com/mmatl/pyopengl.git
pip install ./pyopengl

Specify PYOPENGL_PLATFORM before running the scriptis osmesa , as follows:

# demp.py
import os
# os.environ['PYOPENGL_PLATFORM'] = 'egl'
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'

Note: os.environ[‘PYOPENGL_PLATFORM’] = ‘osmesa’ should ideally follow import os to ensure that PYOPENGL_PLATFORM is changed to osmesa before using render, or you can explicitly specify os.environ before using render specifically [‘PYOPENGL_PLATFORM’] = ‘osmesa’.

[Solved] vs Error: VS_error MSB4044, the required parameter ‘RemoteTarget’ of the task ‘ValidateValidArchitecture’ was not assigned a value

vs Error: VS_error MSB4044, the required parameter ‘RemoteTarget’ of the task ‘ValidateValidArchitecture’ was not assigned a value

 

Solution: configure the item properties to ensure that the remote generation computer has only one IP address. Just don’t have anything else. Delete the redundant

[Solved] Jenkins build error: esbuild install failed

When building the front-end package of the company’s test environment, an error was suddenly reported and the construction failed. After checking the log, an error was reported and the esbuild installation failed. I have not installed this esbuild on Jenkins server, and the code proposed by the development is no problem.
solution:
first look for the esbuild directory in the front-end package. I found that there are two esbuild directories in my front-end package, and then I went in and found that there are install JS file, NPM – V check your own NPM version. If it is greater than 7, execute
node node_modules/esbuild/install.js
after manual installation, build from Jenkins again, and there will be no error

[Solved] kali Execute history -c Error: fc: event not found: – C

Error content: “FC: event not found: – C”

Error reason: Kali’s default shell environment has been changed from bash to Zsh, and history – C needs to run in Bash environment

Method 1: Clear history command

rm -rf /root/.zsh_history
exit

Method 2: Clear history command

cat /dev/null > .zsh_history 
rm .zsh_history
exit

Note: after execution, you need to log in again to take effect