Posts

Showing posts with the label linux

[SOLVED] E: Problem executing scripts APT::Update::Post-Invoke

If you have a legacy docker version and you try to update you repositories with apt update, probably you will get the following error: E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true' E: Sub-process returned an error code To solve it, you must install a version higher than 20.10.9. If you haven't this version in you apt repositories, you can install it throught snap. To check your docker version just write this command: docker -v  Enjoy it!

[Solved] Interface *mon is too long for linux so it will be renamed to the old style (wlan#) name.

If you tried to start monitor mode in a wireless interface, probably you will see the following message: Interface wlx6466b31e7738mon is too long for linux so it will be renamed to the old style (wlan#) name.  , where 6466b31e7738 is the MAC address from your interface.  Just write the following commands in your terminal: sudo ifconfig wlx6466b31e7737 down sudo ip link set wlx6466b31e7737 name wlan0 sudo ifconfig wlan0 up , where wlx6466b31e7737 is your wireless interface. Now, you could start monitor mode in your interface as follows: sudo airmon-ng start wlan0 Found 4 processes that could cause trouble. Kill them using 'airmon-ng check kill' before putting the card in monitor mode, they will interfere by changing channels and sometimes putting the interface back in managed mode     PID Name    1382 avahi-daemon    1388 NetworkManager    1424 wpa_supplicant    1427 avahi-daemon PHY    Interface  ...

ImageMagick cache resources exhausted

If you are trying to merge multiple images in a pdf you can use "convert" command, and probably will see the following message: convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408. to enable this operation, you must edit the policy.xml file from ImageMagick. This file is located in /etc/ImageMagick-6/policy.xml (if the path doesn't exist, just write /etc/ImageMagick and press Tab). Add the following line before </policymap> <policy domain="coder" rights="read | write" pattern="PDF" /> Also, other common issue is the following: convert-im6.q16: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244. convert-im6.q16: cache resources exhausted `source.jpg' @ error/cache.c/OpenPixelCache/3984. To solve this, just increase the cache resources in disk value. Replace: <policy domain="resource" na...

How to fix TeamViewer: Not ready. Please check your connection

Image
If you run TeamViewer you will see the following output Init... CheckCPU: SSE2 support: yes Checking setup... Launching TeamViewer ... Starting network process (no daemon) Network process already started (or error) Launching TeamViewer GUI ... If you have an eternal loading, you will see the following window: To solve it, and could to connect to a remote computer you must run teamviewer as daemon as follows: sudo teamviewer --daemon enable Action: Installing daemon (15.5.3) for 'systemd' ... installing /etc/systemd/system/teamviewerd.service (/opt/teamviewer/tv_bin/script/teamviewerd.service) Try: systemctl enable teamviewerd.service systemctl start teamviewerd.service Now, execute again teamviewer as follows: teamviewer                     Init... CheckCPU: SSE2 support: yes Checking setup... Launching TeamViewer ... Launching TeamViewer GUI ... Enjoy it!

Microsoft Teams meeting link on linux doesn't work

If you must use Teams in linux, probably you will have this issue. After click the meeting link, Teams opens, but not the meeting. To solve it, you need fix the sentence to execute Teams.  Edit the /usr/bin/teams file and replace: nohup "$TEAMS_PATH" --disable-namespace-sandbox --disable-setuid-sandbox "$@" > "$TEAMS_LOGS/teams-startup.log" 2>&1 & by nohup "$TEAMS_PATH" "$@" --disable-namespace-sandbox --disable-setuid-sandbox > "$TEAMS_LOGS/teams-startup.log" 2>&1 & As you can see, the difference is only the position of "$@" Enjoy it!

How to enable Postgres debugging

Image
 It's very simple. Just install the plugin with the following sentence: sudo apt install postgresql-12-pldebugger Next, edit /etc/postgresql/12/main/postgresql.conf and enable the plugin adding the following line: shared_preload_libraries = 'plugin_debugger' Now, you need to restart the postgres service sudo service postgres restart If you run PGAdmin4, now you can see the extension enabled Enjoy it!

How to install snort 3.1 in Ubuntu 20.10

Image
 In my last post I installed snort3 in Ubuntu 18.04. Now, I tried in Ubuntu 20.10 and I find more issues to fight. When I was compiling I got an Error 2. It is not very intuitive to know what the error is due to. I compiled it again and I catched. Is a libdaq error, associated to a lower version. Now, we proceed to install the last github version of libdaq: git clone https://github.com/snort3/libdaq.git ./bootstrap ./configure make sudo make install Now, we compile again snort, but... make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libdaq.so', needed by 'src/snort'.  Stop. make[2]: Leaving directory '/tmp/snort3-3.1.0.0/build' make[1]: *** [CMakeFiles/Makefile2:2997: src/CMakeFiles/snort.dir/all] Error 2 make[1]: Leaving directory '/tmp/snort3-3.1.0.0/build' make: *** [Makefile:152: all] Error 2 As you see, snort is looking for libdaq.so in /usr/lib/x86_64-linux-gnu. Now, we look for libdaq.so path with locate libdaq.so /usr/local/lib/lib...

How to install snort3 from github

First, you must clone the repository: git clone https://github.com/snort3/snort3.git cd snort3 Now, install snort2 dependencies and some dependencies that snort2 does not use: sudo apt build-dep snort sudo apt install libhwloc-dev libluajit-5.1-dev libunwind-dev  Now, procced to compile the project: ./configure_cmake.sh cd build make Probably you will see the following issue: daq_dlt.h: No such file or directory This happend, because you need a newer labdaq version (the version installed as dependence from snort is older). git clone https://github.com/snort3/libdaq.git cd libdaq ./bootstrap ./configure make sudo make install Now, come back to snort3 folder and try to compile it again. Probably you will see this issue: undefined reference to daq_version_string' This appears because two versions of daq are installed (repository and github version).  To solve it, like is reported here  just remove the older version: apt remove libdaq-dev Now execute the following: /usr/local...

QT and HiDpi configuration to change icon fonts size in applications

Image
If you are using an application with QT interface, probably you will see icons or fonts very large like zoom or vidcutter. To solve it, just add the following QT values in /etc/environment export QT_AUTO_SCREEN_SCALE_FACTOR=0 export QT_SCALE_FACTOR=1 To choose the better values you can test them executing the following command: env QT_SCALE_FACTOR=0.5 QT_AUTO_SCREEN_SCALE_FACTOR=0 app , where app is the application with visualization issues such as vidcutter UPDATE: This steps also works for Zoom, tested on Ubuntu 19.04 Enjoy it!

How to solve convert-im6.q16 issues

If you try to convert multiple jpg to a single pdf probably you will see this message: $ convert `ls -1v` file.pdf convert-im6.q16: Corrupt JPEG data: 94 extraneous bytes before marker 0xd9 `0.jpeg' @ warning/jpeg.c/JPEGWarningHandler/352. convert-im6.q16: not authorized `pictures.pdf' @ error/constitute.c/WriteImage/1056. To solve the first issue just convert the files to png and after to jpg again, like this example: mogrify -format png *.jpg rm *.jpg mogrify -format jpg *.png rm *.png To solve the second, just execute the following command: sudo sed -i 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/g' /etc/ImageMagick-6/policy.xml Enjoy it!

How to install TAPIRE for Assisting Protocol Inference and Reverse Engineering

First, you need to install netgoblin as tapire dependence: cd /tmp git clone https://github.com/conix-security/netgoblin cd netgoblin git checkout develop cd netzob apt install python3-pip pip3 install -r requirements.txt python3 setup.py install cd /tmp git clone https://github.com/conix-security/TAPIRE git checkout develop pip3 install -r requirements.txt ./tapire.py  Warning: FastBinaryTree not available, using Python version BinaryTree. Warning: FastAVLTree not available, using Python version AVLTree. Warning: FastRBTree not available, using Python version RBTree. Traceback (most recent call last):   File "./tapire.py", line 8, in <module>     from menus.mainmenu import main_menu   File "/home/nboettcher/Downloads/TAPIRE/menus/mainmenu.py", line 5, in <module>     from netzob.all import *   File " /usr/local/lib/python3.6/dist-packages/Netzob-1.0.2-py3.6-linux-x86_64.egg/netzob/all.py ", line 36, in <...

ERROR: GetProj4StringSPI: Cannot find SRID (4326) in spatial_ref_sys

If you are using postgis and a cleaner in your database, maybe you could have this error: ERROR:  GetProj4StringSPI: Cannot find SRID (4326) in spatial_ref_sys SQL state: XX000 This error means that your spatial_ref_sys table is empty To fix it, just restore the information that postgis generate when you create this extension in your database. To do it execute the following sentence: psql -d $database_name -f $PATH/spatial_ref_sys.sql where the PATH is the path to spatial_ref_sys.sql For postgres 11 and postgis 2.5 the PATH is /usr/share/postgresql/11/contrib/postgis-2.5/ Other way to execute the same command is: PGPASSWORD=postgres psql "host=localhost dbname=$database_name user=postgres" -f /usr/share/postgresql/11/contrib/postgis-2.5/spatial_ref_sys.sql Enjoy it!

command not found: pip3

This is a common issue. If you try to execute pip3 you probably will get: Command 'pip3' not found, but can be installed with: sudo apt install python3-pip or pip3 zsh: command not found: pip3 although you install it, anyway the same error appears To solve it, you can reinstall it: sudo apt-get remove python3-pip sudo apt-get install python3-pip or execute pip3 as python module: sudo python3 -m pip Enjoy it!

How to send files throught bluetooth from nautilus

The best option is to use an extension to enable this option. sudo apt install python-nautilus nautilus bluez gnome-bluetooth python3 cd ~/.local/share/nautilus-python/extension wget https://raw.githubusercontent.com/TheWeirdDev/nautilus-send-to-bluetooth/master/SendToBluetooth.py nautilus -q HINT: Also you can use /usr/share/nautilus-python/extensions/ to store your extensions Enjoy it! Source:  https://github.com/TheWeirdDev/nautilus-send-to-bluetooth

How to run terminator with rigth click inside nautilus

Image
First, we need to install nautilus-python extension: sudo apt install python-nautilus Now, you need to create the extensions folder: mkdir ~/.local/share/nautilus-python cd ~/.local/share/nautilus-python mkdir extensions cd extensions To finish, download the extension to enable execute terminator in nautilus: wget  http://www.giuspen.com/software/nau3pyext/open-terminal-here.py Edit it and change the label variable "Open Terminal Here" by "Open Terminator" To restart nautilus, just execute: nautilus -q nautilus If you don't have terminator as your default terminal, it is enough to choose it when executing the following command: sudo update-alternatives --config x-terminal-emulator UPDATED In Ubuntu 20.10 the previous tutorial doesn't work. An alternative is to install a nautilus-extension for several terminals: pip3 install nautilus-open-any-terminal Edit ~/.local/share/nautilus-python/extensions/open_any_terminal_extension.py an...

How to run Matlab without root permissions

If you have issues with Matlab to run commands without root, probably you will see this: INFO: READ:  OnSendHeadersMessage{type=OnSendHeaders, uid=557, browserContextId=0, requestId=57, url=https://localhost:31515/messageservice/async, method=POST, headers=Origin: https://localhost:31515 X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.52 Safari/537.36 Content-Type: application/json Accept: */* Referer: https://localhost:31515/remote/proxy/1.5/iframeProxyRelease.html Accept-Encoding: gzip, deflate Accept-Language: en-us Cookie: JSESSIONID2=aUWOscLC3o6cqUdV; ssnc=24WR68u39rLEOyhW }, SocketInfo{channelId=0, browserId=-1, channelType=Main} To fix it, just add permissions to your user with: sudo chown -R $USER:$USER /usr/local/MATLAB/R2018b If you run Matlab again, you will see this: at com.mathworks.mlwidgets.shortcuts.ShortcutUtils.getShortcutsFile(ShortcutUtils.java:703)...

How to backup/restore your linux packages in Ubuntu 18.10

Image
If you need migrate your packages to another computer, the best choice is to restore the packages to avoid install all of them again manually. I'm going to describe three tools that I test to do it. apt-clone is a tool for backup all your packages installed through apt. To install it just execute: sudo apt install apt-clone sudo apt-clone clone path_to_save_backup Now, to restore the packages, just copy this file in your new station and execute the following: sudo apt-clone restore apt-clone-state-*.tar.gz It works very well, but some times you can get this error: Deja-dup is other tool to make backups and restore your packages. When I run it, I got this message: InvalidBackendURL: missing // - relative paths not supported for scheme invalid: invalid:// This bug was reported here  2 years ago, but still is not totally fixed Aptik is tyhe most functional tool with GUI. To install it just execute: sudo apt-add-repository -y ppa:teejee2008/ppa sudo apt-ge...

How to backup your Visual Studio Code extensions

If you want to avoid to use a github account to syncronize your extensions, you can do it fastly as follows: code --list-extensions | xargs -L 1 echo code --install-extension This sentence, you must write it in your terminal. It generates an output with a list of your extensions, like: code --install-extension rogalmic.bash-debug Now, when you would like to import the same extensions, just put the previous output in your terminal. Also, you can copy your extensions folder in ~/.vscode/extensions Enjoy it!

Webcam streaming throught VLC with YUY2 compatibility

If you try to stream your webcam throught VLC you probably will see the following issue: # vlc v4l2:///dev/video0 --sout '#rtp{mux=ts,sdp=rtsp://:8888/live.sdp}'  VLC media player 3.0.4 Vetinari (revision 3.0.4-0-gf615db6332) [000055c7620dd630] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. [00007ff730002fe0] main mux error: cannot add this stream [00007ff730001180] stream_out_rtp stream out error: cannot add this stream to the muxer [00007ff73000ff60] main decoder error: cannot create packetizer output (YUY2) [00007ff73000ff60] main decoder error: buffer deadlock prevented To fix it, you must enable the transcoding and run the following command: cvlc -vvv v4l2:///dev/video0:chroma=mp2v --v4l2-width 1280 --v4l2-height 720 --sout '#transcode{vcodec=mp2v,acodec=mpga,fps=30}:rtp{mux=ts,sdp=rtsp://:8888/live.sdp}' where chroma enables hardware video decoding. You can edit the resolution, codecs and frame ...

v4l2: open /dev/video0: Permission denied

If you try to stream using your webcam throught vlc or xawtv vlc v4l2:///dev/video0 or xawtv -c /dev/video0 probably you will have this issue. To solve it, you must add your user to the video group as follows: sudo adduser username video sudo usermod -a -G video username where username is your user (whoami) Now restart your computer Enjoy it!