Tag Archives: linux

Linux novice: unable to locate package error solution

The original address: http://www.cppblog.com/colorful/archive/2012/04/29/173122.html

Unable to locate package: Unable to locate package: Unable to locate package: Unable to locate package: Unable to locate package: Unable to locate package

    letuknowit@ubuntu:~$sudo apt-get install mysql-server mysql-client [sudo] password for letuknowit: Reading package lists…

      letuknowit@ubuntu:~$sudo apt-get install mysql-client [sudo] password for letuknowit: Reading package lists… Done Building Dependency Tree Reading State Information… Done E: Unable to locate package mysql-server E: Unable to locate package mysql-client letuknowit@ubuntu:~$

    I found the problem was that I changed the source of the software before executing sudo apt-get install, but I forgot to update it, so I executed the following command:

      sudo apt-get update

    Sudo apt-get install sudo apt-get install sudo apt-get install Unable to locate packet Unable to locate packet

    Attached is another article:
    The original address: http://blog.chinaunix.net/uid-22002627-id-3475650.html
    Encounter this problem after find this thread is turned around When use apt – get update package often appear error Unable to locate the package update, especially in the ubuntu server, the solution is: to update the apt – get # sudo apt – get the update after the execution, problem solved. #sudo apt-get install mysql-client
    #sudo apt-get install mysql-client
    #sudo apt-get install mysql-client

Problems and solutions in using Linux

Kali change terminal interface and font Settings at https://jingyan.baidu.com/article/046a7b3ef79d51f9c27fa99a.html
Kali the introduction of various tools
https://www.cnblogs.com/lsdb/p/6682545.html
Ubuntu set up Chinese system font:
https://jingyan.baidu.com/article/ab0b563049696cc15afa7d19.html
The metasploitable virtual machine’s user name and password are default to msfadmin
The user name of the virtual machine image file that can be run directly is root, and the password is generally toor by default
Ubuntu ifconfig card set tip can’t find the solution to command:
https://blog.csdn.net/qq_41741971/article/details/82960104
Ubuntu five open a terminal way:
https://jingyan.baidu.com/article/48206aea84b183216ad6b3ec.html
The minimum install centos cannot pass the ifconfig query the IP address of the solution:
https://www.cnblogs.com/jackforever/articles/9228638.html
The installation and use the putty tutorial:
https://www.jb51.net/softjc/573674.html

Linux common problems and Solutions

>Linux FAQs and solutions, continuous updates…
> bbb>/ font>>>>>>>

./mnist_caffe: error while loading shared libraries: libarmnn.so: cannot open shared object file: No such file ordirectory

libarmnn.socode>./mnist_caffecode>libarmnn.so . actually libarmnn. So is already compiled file, the directory is /home/lg/armnnSDK armnn .
home /lg/armnnSDK/armnn
<>ode>sudo />/ ldconfig
<>de>/home/lg/armnnSDK/armnn sudo /sbin/ldconfig However, this is generally not done for self-compiled files, and self-compiled libraries generally use method two configuration path. export LD_LIBRARY_PATH=/home/lg/armnnSDK/armnn:$LD_LIBRARY_PATH LD_LIBRARY_PATH=/home/lg/armnnSDK/armnn:$LD_LIBRARY_PATH if this only takes effect at the current terminal.
2. Check the static library which contained in o file
ar - TV libXXX. A
3. View the static library or o what functions contained in
objdump - tT libXXX. A or objdump - tT libXXX. O
4. How to survive the static library
ar - RCS libXXX. A A.o B.o
with A.o and B.o with the following method to generate, specify the GCC -c is generated by the o file:
GCC - c - O3 A.c - i./, GCC - c - O3 biggest - i./
5. Statistical number of files and folders
in the current directory file number: the ls -l | grep "^ -" | wc -l
in the current directory. O number at the end of the file: ls -l *. O | grep "^ -" | wc -l
the current number of directories and subdirectories file: ls - lR | grep "^ -" | wc -l
in the current directory folder contains the number of folders: ls -l | grep "^ d | wc -l
number of the current folder and subfolders contained in the folder ls - lR | grep" ^ d | wc -l
6. Linux system (Linux server and Linux device, IPC, etc.) mount Windows directory
cifs mount
for embedded development tend to the source code on Windows, Compile on Linux, if you mount the Windows directory under Linux will greatly improve the development efficiency.
for IPC, serial logins IPC, into the root directory of the IPC /, in the mount point choices /MNT or /TMP , may also be other directory.
mount -t the IP address of the cifs// Windows/on Windows to the Shared folder name/MNT/hardpoints name -o username = XXX, password = XXX
for example, set up a folder in Windows' D set the win - MNT , and then set up a Shared, assuming that the IP address of the Windows is 10.182.13.58 , Mount way is:
mount -t cifs// 10.182.13.58/win - MNT/MNT -o username = garylau, password = mypasswd
for Linux system other equipment is also similar, creating good to mount the directory under Linux (mount point), Windows directory can be mounted to the Linux hardpoints.
delete mount: umount,/MNT
sometimes need to hardpoints under Linux has the authority to read not only must have the write permissions, this instruction need to add the dir_mode = 7, 77, file_mode = 0777 , namely:
mount -t the IP address of the cifs// Windows/on Windows to the Shared folder name/MNT/hardpoints name -o username = XXX, password = XXX, dir_mode = 0777, file_mode = 0777
if the mount times the following error, is due to the NFS (Network File System, a Network File System server) has multiple versions, V2, V3, V4, and all versions run at the same time, so you need to specify the version number when mounting. mount -t cifs //Windows IP address /Windows to share folder name/MNT/mount point name -o username=XXX, password=XXX, vers=2.1

mount error(121): Remote I/O error
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

> Download nfs1219.exe, use this software to share the directory to Linux under Windows as NFS format, and then use the instruction unt -t nfs-o nolock windowsIP:/ Windows/under disk/path MNT / t>unt. D :\win-mnt \ nfs-o nolock 10.182.13.58:/ D /win-mnt / \>-o nolock 10.182.13.58:/ D /win-mnt /
7. Find the current in all the files in the directory containing a string
find./| xargs grep - ri "VGGNetBody"
if you want to list only the file name is combined with the -l
find./| xargs grep - ri "VGGNetBody - l"
8. #include < include < #include < #include < math.h> While the function in the add the header files, but will still be submitted to the at compile time undefined reference to SQRT mistake, at this point in the compilation instructions add - lm, reference here.
br> >
ery Linux system has three options to clear the cache without interrupting any processes or services.
PageCache
code> s>; echo 1 >/proc/sys/vm/drop_caches
remove directory entry and inode
sync; echo 2 >/proc/sys/vm/drop_caches
page caching, directory entries and inode
sync; echo 3 > /proc/sys/vm/drop_caches
10. View Linux system bits

a. getconf LONG_BIT
b. uname -a
c. uname -r
d. cat /proc/version

>
/ font>>
>>>
a. indicate the search path, such as VPATH = SRC include or VPATH %. The CPP SRC , VPATH %. H include , etc.
b. Indicates the final target, such as l: run;>
c. j = main.o factorial.o hello.o;>
d. Generate intermediate target, such as o: %.
e. ear c> :; clean :> Rm *.o run, etc.
filenames
kefile filenames can be represented by wildcards. The wildcards available are: *?> ,[...] . However, these wildcards are not used anywhere in a makefile. Wildcards can be used in one of two ways: a. This can be used in the target, dependency of a rule. Make automatically matches makefiles when it reads them (wildcard expansion). B. Can appear in the command of the rule. Wildcard processing is done when this command is executed in the shell.
You cannot use wildcards directly in any context other than these two cases. wildcard

Common problems and solutions under Linux

Common problems and solutions under Linux

. What are tar,.tar.gz,.bz2,.tar.bz2,.bz,.gz files and how do I unlock them?
They are both file (compressed) packages. Tar.gz: package and compress: tar CVF *.tar dirName: tar XVF *.tar
.tar.gz: package and compress: tar CZVF *.tar.gz
2: unpack: bzip2-d *.bz2
.b>unpack: bzip2-d *.bz
.bz: unpack: bzip2-d *.bz
.gz: unpac> Gzip-d *.gz


rh8 There is a graphical interface under the software File-roller to do this. Also can use unzip *. Zip unzip file, unrar *. Rar solution
open RAR file, but the general system does not come with unrar, to download the Internet.

br>

>
a. Create a directory like mkdir a
. Mount the iso file: mount -o loop XXXX.

Delete all files in the directory including subdirectories
-rf directory names

cat /proc/ cpuinfo-CPU (i.e. vendor, Mhz, flags like MMX)
t /proc/interrupts – interrupt
c> proc/ioports – device IO port
cat/p>/ meminfo-memory (i.e. mem used, free, i.e. mem used, free, Swap the size)
the cat/proc/partitions – all equipment all partitions
the cat/proc/pci – pci devices information
the cat/proc/swaps – all the swap partition information
the cat/proc/version – Linux version number Equivalent to the uname -r
uname -a – see system information such as the kernel

RPM -qpl aaa. RPM
RPM -qpl aaa
Gz
tar XVFZ example.tar.gz
tar XVFZ example.tgz
t>vf example.tar
unzip e>le.zip

> Gaim 0.58:

www.linuxsir.org/gaim/gaim-0.58-2.i386.rpm download QQ plug-in for gcc2.9 version

www.linuxsir.org/gaim/libqq-0.0.3-ft-0.58-gcc296.so.gz will download file into the/temp directory, then delete the existing Gaim system, namely, type the command in a terminal emulator: RPM -e Gaim.
Start the installation
en the terminal emulator and continue to install Gaim version 0.58, that is:
c>temp (go to the temp directory)
RPM -iv>im -0.58-2.i386. RPM (install software)
When the inst>tion is successful, you can create the Gaim icon on the GNome or KDE desktop.
To continue installing the QQ plugin, type the command:
nzip libq-0.0.3-ft-0.58 -gcc296.so.gz (unzip the file)
c>bq-0.0.3-ft-0.58 -gcc296.so /usr/lib/gaim (copy the plugin to the gaim library directory)
Softwar>ttings
Login screen> will appear when you first start Gaim version 0.85. Select “Plugins” first, and click “Load” in the “Plugins” dialog box. Load
libmsn.so and libq-0.0.3-FT-0.58-gcc296.so files respectively, and close them after confirmation. Then choose “all accounts”, in the presence of
account in the editor to click “add”, when the modify account page, we can enter your QQ or MSN number,
the login name fill in QQ number or MSN email, password to fill in the corresponding QQ or MSN password, Alias to fill in their nicknames, protocol selection
corresponding QQ or MSN, other Settings by default. When all Settings are completed, you can log in and use.
http://wangzhihng.blog.163.com/blog/static/350999420061030105134290/

Howto Install and Configure VTK on Ubuntu

Howto Install and Configure VTK on Ubuntu

    Download vtk-5.10.1.tar.gz fromhttp://vtk.org/VTK/resources/software.html#latestand extract; $cd/home/chen/Downloads/VTK5.10.1/ $mkdir VTKBin $cd VTKBin $cmake .. $ccmake .. configure as follows:
    press c to configure, and press g togenerate and exit;
    $make copy the include files andlibraries to system directories: $sudo make install copy the plugin to qt:

      $cd /usr/lib/qt4 sudo mkdir plugins cd plugins sudo mkdir designer sudo cp~/Downloads/VTK5.10.1/VTKBin/bin/libQVTKWidgetPlugin. so/usr/lib/qt4/plugins/designer open qtcreator (can be installedfrom Ubuntu Software Center) create one Gui application and open the ui by qtdesigner tocheck QVTKWidget.

To use VTK in your own project, addfollowing to the CMakeLists.txt in your project:
########################################################
#VTK
#set(VTK_DIR”~/Downloads/vtk/VTK5.10.1/build”)
set(VTK_DIR “/usr/local/lib/vtk-5.10”)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
########################################################

add target link libraries to yourproject: ${VTK_LIBRARIES} QVTK

A complete example of using VTKtogether with Qt in a CMake project can be found at:
http://blog.csdn.net/owldestiny/article/details/8806128.

Herewe give a complete CMake project using both Qt and VTK, the completeprogram can be download athttp://download.csdn.net/detail/owldestiny/5262489:
Theproject structure is:
└──QtVtkTest
├──bin
│  └── QtVtkTest
├──build
├──CMakeLists.txt
├──include
│  └── QtVtkTest.h
├──qrc
├──src
│  ├── main.cpp
│  └── QtVtkTest.cpp
└──ui
└── QtVtkTest.ui

Inthis project we do not use qrc.
TheCMakeLists.txt is:
======================================================================
cmake_minimum_required(VERSION2.8)
project(QtVtkPCLTest)

set(CMAKE_BUILD_TYPEdebug)
########################################################
#Qt
find_package(Qt4REQUIRED)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
########################################################

########################################################
#VTK
#set(VTK_DIR”~/Downloads/vtk/VTK5.10.1/build”)
set(VTK_DIR”/usr/local/lib/vtk-5.10″)
find_package(VTKREQUIRED)
include(${VTK_USE_FILE})
#MESSAGE(STATUS${VTK_LIBRARIES})
########################################################

########################################################
#PCL
find_package(PCL1.3 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
########################################################

########################################################
#Projectsettings
#set(PROJECT_SOURCESmain.cpp)#all sources files
set(LIBRARY_OUTPUT_PATH${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH${PROJECT_SOURCE_DIR}/bin)
include_directories(${PROJECT_SOURCE_DIR}/include${CMAKE_CURRENT_BINARY_DIR})#to include ui_*.h generated byQT4_WRAP_UI, you should include ${CMAKE_CURRENT_BINARY_DIR}
aux_source_directory(${PROJECT_SOURCE_DIR}/src/PROJECT_SOURCES)
########################################################

########################################################
#GenerateQt files
set(PROJECT_HEADERS${PROJECT_SOURCE_DIR}/include/QtVtkPCLTest.h)#only headers includeQ_OBJECT
QT4_WRAP_CPP(PROJECT_HEADERS_MOC${PROJECT_HEADERS})

set(PROJECT_UI${PROJECT_SOURCE_DIR}/ui/QtVtkPCLTest.ui)#ui file
QT4_WRAP_UI(PROJECT_UI_UIC${PROJECT_UI})
#file(COPY${PROJECT_UI_UIC} DESTINATION ${PROJECT_SOURCE_DIR}/include/)#copyui_.h file to include
#message(STATUSPROJECT_UI: ${PROJECT_UI})
#message(STATUSPROJECT_UI_UIC: ${PROJECT_UI_UIC})
#message(STATUSCMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR})
#message(STATUSPROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR})
#message(STATUSCMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR})
#message(STATUSPROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR})
#message(STATUSCMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR})

#set(PROJECT_RC${PROJECT_SOURCE_DIR}/qrc)#resource files
#QT4_WRAP_RESOURCES(PROJECT_RC_RCC${PROJECT_RC})
########################################################

########################################################
#generateexecutables and link libraries
add_executable(QtVtkPCLTest${PROJECT_SOURCES} ${PROJECT_HEADERS_MOC} ${PROJECT_UI_UIC})#${PROJECT_RC_RCC})
target_link_libraries(QtVtkPCLTest${QT_LIBRARIES} ${VTK_LIBRARIES} QVTK ${PCL_LIBRARIES})#QVTKQVTKWidget for VTK in Qt
======================================================================

The QtVtkTest. ui(only including one QVTKWidget) can be generated and edited by QtDesigner as:
======================================================================

<?xml version="1.0"encoding="UTF-8"?>
<ui version="4.0">
<class>mainWindow</class>
<widget class="QMainWindow"name="mainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>722</width>
<height>512</height>
</rect>
</property>
<property name="windowTitle">
<string>Qt VTK Test</string>
</property>
<widget class="QWidget"name="centralwidget">
<widget class="QVTKWidget"name="qvtkWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>691</width>
<height>471</height>
</rect>
</property>
</widget>
</widget>
<widget class="QStatusBar"name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>QVTKWidget</class>
<extends>QWidget</extends>
<header>QVTKWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

======================================================================

The main.cpp is:
======================================================================

#include <QApplication>
#include "QtVtkTest.h"


int main(int argc, char**argv)
{
QApplication app(argc,argv);
Qt_QtVtkTest qtTest;
qtTest.show();

return app.exec();
}

======================================================================

TheQtVtkTest.h is:
======================================================================

#include <QtGui/QMainWindow>
#include "ui_QtVtkTest.h"

class Qt_QtVtkTest: publicQMainWindow
{
Q_OBJECT
public:
Qt_QtVtkTest()
{
ui.setupUi(this);
}
public:
Ui::mainWindow ui;

};

======================================================================

Velt-0.1.3 development: generating events

Happy shrimp
http://blog.csdn.net/lights_joy/ (QQ group: Visual EmbedLinux Tools 375515651).
Welcome to reprint, but please keep the author’s information

Velt, the full name of Visual EmbedlinuxTools, is a Visual Studio plugin similar to Visual GDB to assist Linux development. With this plug-in, you will be able to develop Linux applications (including compilation and debugging) in the Visual Studio IDE, and you can also compile the uboot and Linux kernel, and locate the source code correctly based on error messages at compile time. The current version is 0.1.2, which only supports VS2013, and is a plug-in that has just started development. Can be downloaded in CSDN download channels (http://download.csdn.net/detail/lights_joy/8359251), the installation process, see the Linux development: using Vs2013 + VELT – 0.1.0 from environment to build “. Here are its basic functions:

    supports x86 Linux, HI3516, HI3520, MinGW platforms. Complete the compilation of UBOOT, and automatically locate the corresponding file location according to the error information compiled. Complete the Linux kernel compilation, and automatically locate the corresponding file location according to the compilation error information. Complete the configuration of the Linux kernel. You do not use Makefiles to compile Linux applications. Connect to the target machine using SSH and debug the application with GDB. Connect the target machine with Telnet and debug the application with GDB.

Three build events are defined in VS:


MSBuild defines these three goals as:

  <Target Name="PreBuildEvent" Condition="'$(PreBuildEventUseInBuild)'!='false'">
    <Message Text="Description: %(PreBuildEvent.Message)" Condition="'%(PreBuildEvent.Message)' != '' and '%(PreBuildEvent.Command)' != ''"/>
    <Exec Command="%(PreBuildEvent.Command)$(_BuildSuffix)" Condition="'%(PreBuildEvent.Command)' != ''"/>
  </Target>

  <Target Name="PreLinkEvent" Condition="'$(PreLinkEventUseInBuild)'!='false'">
    <Message Text="Description: %(PreLinkEvent.Message)" Condition="'%(PreLinkEvent.Message)' != '' and '%(PreLinkEvent.Command)' != ''"/>
    <Exec Command="%(PreLinkEvent.Command)$(_BuildSuffix)" Condition="'%(PreLinkEvent.Command)' != ''"/>
  </Target>

  <Target Name="PostBuildEvent" Condition="'$(PostBuildEventUseInBuild)'!='false'">
    <Message Text="Description: %(PostBuildEvent.Message)" Condition="'%(PostBuildEvent.Message)' != '' and '%(PostBuildEvent.Command)' != ''"/>
    <Exec Command="%(PostBuildEvent.Command)$(_BuildSuffix)" Condition="'%(PostBuildEvent.Command)' != ''"/>
  </Target>

In effect, you just throw the commands you entered here to cmd.exe to execute.
For the MinGW platform, this is perfectly fine, but for platforms such as Linux you need to reload the task and leave it to bash.

Common errors and solutions of Qt development application under Ubuntu

Error: HelloWorld directly report error… :-1: error: cannot find -lGL
Reason: Lack of GL library
Sudo apt-get install libgl1-mesa-dev

I downloaded the latest version of QT-everywhere5.3.1, after porting it to the board directly created a Qt Quick program to run on the board, prompted the following error, can not find the solution online, ask how to solve this problem, thank you.
# ./qmlpng
QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
QQmlApplicationEngine failed to load component
qrc:///main.qml:1 module “QtQuick” is not installed
qrc:///main.qml:2 module “QtQuick.Controls” is not installed
qrc:///main.qml:1 module “QtQuick” is not installed
qrc:///main.qml:2 module “QtQuick.Controls” is not installed

Qrc :// main. QML :1 module “QtQuick” is not installed. $QTDIR/ QML will be installed in a folder if you install it.

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
Failed to create OpenGL context for format QsurfaceFormat (version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaB

Or try export QML_IMPORT_PATH=$QTDIR/ QML. It is not clear what it is, it may be different from project to project.

Export QML2_IMPORT_PATH=$QTDIR/ QML =$QTDIR/ QML
If this is not desired, you can override this via:
QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
If this is not desired, you can override this via: Export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1

The original address: http://www.qtcn.org/bbs/read-htm-tid-56902.html

SCP error: not a regular file

Linux local files are uploaded to the server
SCP/home/liujia/file. TXT [email protected]:1/user/liujia
Download the file from the server
[email protected]:/user/liujia/file1. TXT/home/liujia

The command
SCP [email protected]:/user/liujia// home/liujia
Cp not a regular file
The reason is that this is the equivalent of downloading folders, not files.
The solution is to add the parameter -r
SCP – r [email protected]:/user/liujia// home/liujia
That’s it

When Linux installs redis, it executes make install and reports an error: Make: * * [server. O] error 1 (solved)

Reason:
the Redis’s official website to download version of the 6.0 version of make the installation
This is because the GCC version is too low. The GCC installed in YUM is 4.8.5. Therefore, GCC needs to be upgraded. The upgrade process is as follows:

yum -y install centos-release-scl

yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

scl enable devtoolset-9 bash

echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile

gcc -v

Can.

CentOS uses Yum install to report errors

I’m running the install tree command on the machine and there is an error:

[Errno 256] No more mirrors to try

The Internet says you should follow the following two commands:
#yum clean all
#yum makecache
There was no error on the first instruction, but there was an error on the second instruction
Cannot find a valid baseurl for repo: base/7/x86_64
So the solution is to change the nameserver value by changing the resolv.conf
Unable to connect to the Internet. This is one of the host errors
#vim /etc/resolv.conf
Change the nameserver value to 8.8.8.8 or any other DNS value that can connect to the Internet
Then restart the network card
#service network restart
Problem solved!

Linux basic command execution error: the solution of command not found

This is due to a problem with the environment variable. The profile file is not written correctly, resulting in the command line ls and other commands can not be recognized.
Solution: Just type in the following section from the command line. Add the PATH of all the commands under PATH. The system can find these command script files

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin