Skip to main content

· One min read
Hreniuc Cristian-Alexandru

Source

If you need to connect remote to a PC and download something via torrent you need to do these steps:

Install transmission-daemon:

apt-get install transmission-daemon

This will install and start the service: transmission-daemon.

If you want to check it's status you can run:

systemctl status transmission-daemon

This will start a service and a web interface to acces the torrent client. This client will be at: ip:9091/transmission.

If you open that url, it will ask a user and password, by default these are:transmission:transmission.

If you want to change something, ex: the username, password, port; you can edit the settings file: /etc/transmission-daemon/settings.json. But before stop the deamon:

systemctl stop transmission-daemon
# After edit, start the daemon
systemctl start transmission-daemon

By default the download_dir is set to /var/lib/transmission-daemon/downloads you can change it to any value.

For username and password for the web interface: rpc-username and rpc-password(put it in plain, it will be hashed automatically after daemon starts).

If you want to access this interface from remote, you can do a tunnel via ssh:

ssh -L 127.0.0.1:9091:127.0.0.1:9091 user@pc

· 3 min read
Hreniuc Cristian-Alexandru

Ever encountered this type of error when you were trying to install Linux on your Laptop?

Some of your hardware needs non-free firmware files to operate.  The firmware can be loaded from
removable media, such as a USB stick or floppy.

The missing firmware files are: iwlwifi-6000g2a-6.ucode iwlwifi-6000g2a-5.ucode

If you have such media available now, insert it, and continue.

Here's how to fix it, based on steps from this guy.

If you fot to this ponit in the installation process, do not close the installation.

Get another usb stick and format it using FAT.

Plug in the usb

If you already have a usb that is formated as FAT(it doesn't need to be empty), skip the next two steps.

Get the usb device:
fdisk -l
# Output
Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Disk model: SanDisk SD8SBAT1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x995ebae8

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 250068991 250066944 119.2G 83 Linux


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-75W
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: 08BAF1CD-519D-4758-8BFE-6B50CBBC078D

Device Start End Sectors Size Type
/dev/sdb1 1922275328 1953523711 31248384 14.9G Linux swap
/dev/sdb2 2048 1922275327 1922273280 916.6G Linux filesystem

Partition table entries are not in disk order.


Disk /dev/sdc: 29.3 GiB, 31457280000 bytes, 61440000 sectors
Disk model: ProductCode
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x263d4ee4

Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 61439999 61437952 29.3G 83 Linux
Delete all partitions and create a new FAT one:
fdisk /dev/sdc

# Press 'd' untill you deleted all partitions.

# Press 'w' to write the changes.

fdisk /dev/sdc
# Press 'n' to create a new partition

# Press 'w' to write the changes.

# Format it as FAT:

mkfs.fat /dev/sdc1
Download the drivers and copy them on the drive:

Go to https://packages.debian.org/buster/firmware-iwlwifi and download the deb file.

Extract it's content:

mkdir wifi
dpkg-deb --extract firmware-iwlwifi_20190114-1_all.deb wifi

Copy files to usb:

cp -r wifi/lib/firmware /mnt/usb_stick
Plugin the usb stick in the laptop that you are installing Debian and mount it:
  • Plugin the USB stick.

  • Press <CTRL>+<Alt>+<F2> key combination, to switch to the second virtual terminal.

  • Run the blkid command, to find out under which device name the USB stick was known: /dev/sdc. Its FAT filesystem, which contained the firmware files, then, was /dev/sdc1.

  • Mount the usb stick:

    cd /mnt
    mkdir mount_usb
    mount /dev/sdc1 /mnt/mount_usb
  • Create a symbolic link to the firmware folder from the usb stick in /lib/firmware:

    ln -s /mnt/mount_usb/firmware /lib/firmware
  • Press <CTRL>+<Alt>+<F5> to continue the installation process.

Everything should work out of the box now.

· 2 min read
Hreniuc Cristian-Alexandru

Here is the source.

Activate WOL in bios:

First, reboot the remote server and go to BIOS > Power Management > “Wake On LAN”. Turn it on. Next, save and close the bios.

Install ethtool:

apt-get install ethtool

Enable:

ethtool -s enp9s0 wol g
# ethtool -s <interface> wol g

Check if enabled:

ethtool enp9s0
# ethtool <interface>
# Output:

Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: Symmetric
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
drv probe ifdown ifup
Link detected: yes

The most important thins is to check these two lines(g should be present):

Supports Wake-on: pumbg
Wake-on: g

You should also make it run at boot-up. Add this is /etc/rc.local:

#!/bin/bash

ethtool -s enp9s0 wol g

exit 0

Then make that file executable:

chmod +x /etc/rc.local

Reboot and check if you get Wake-on: g.

To access it from Internet, add a port forwarding in your router settings, to port 9 (UDP) on your PC.

Example if my PC has the ip 192.168.2.101 and the external port(from the router is 999) it will look like this:

public_ip:999 UDP -> 192.168.2.101:9 UDP.


Turn your pc from linux pc:

apt-get install wakeonlan
wakeonlan -i IP -p PORT MAC

From android.

· One min read
Hreniuc Cristian-Alexandru

I recently installed Debian 10 and liquorix(latest kernel) when I booted a blank screen apeared.

Swithing back to the old kernel worked, but the resolution of my monitor was poor. I tried to see what is the issue and ran :

dmesg

In that output I noticed this line:

drm:amdgpu_pci_probe [amdgpu]] *ERROR* amdgpu requires firmware installed

I searched on google a fix and got to this post.

The fix was simple, I added contrib non-free after main on every line from /etc/apt/sources.list. Then I ran:

apt-get update && apt-get upgrade

And then I installed firmware-linux:

apt-get install firmware-linux

And then I rebooted the PC.

· One min read
Hreniuc Cristian-Alexandru

We encountered a problem when using the debugger from qtcreater with the gcc 9.1.0. The values of the std::string were not printed, they were marked as : <not accessible>. We found the fix on stackoverflow.

The fix is simple, you need to change the file: /usr/share/qtcreator/debugger/stdtypes.py as shown in the diff:

640c640
< (size, alloc, refcount) = d.split("ppp", value.address() + d.ptrSize())
---
> (size, alloc, refcount) = d.split("ppp", data - 3 * d.ptrSize())
643,644c643
< if size > 1000:
< size = 1000
---
> d.check(0 <= size and size <= alloc and alloc <= 100*1000*1000)

· One min read
Hreniuc Cristian-Alexandru

Install ucspi-tcp:

apt-get install ucspi-tcp

This pacakge contains this list of tools

Create tcp server from bash using tcpserver command from ucspi-tcp:

# script.sh content
#!/bin/bash
# read MESSAGE
echo "message: $MESSAGE"
sleep 2
echo " message 2"
sleep 3
echo " message 3"
sleep 2
# ---- end ------- #

# Run tcpserver:
tcpserver -v -H -R IP PORT script.sh

# Open a connection:
echo "" | nc IP PORT

This tcp server can open multiple connections in parallel. Verry usefull when you want to have a mock tcpserver.

Fixed issues:

  1. The read command doesn't work if I add it in the script(I had a client written in C++). But it did work when my client was nc....

The fix was to add \n at the end of the string that I was sending from that client. To reproduce this, you can run a client like this: echo -n "sa" | nc IP PORT and the script should contain a read instruction. You will notice that the server will stop at that read instruction.

· 2 min read
Pamparau Sebastian

gcc and g++ are both compiler drivers. First one is used for C applications while the last one for C++. Even so, they both can be used interchangeably (e.g. use gcc for C++ or g++ for C). This is because in the end both will end up using the same tools (at least for .cpp files) for running the desired action, only the default flags used will differ. This can be analysed by appending the flag -v to both drivers, which will make them output the things done in the background.

The table below shows the notable differences.

Driver commandCompiler flagsAssembler flagsLinker flags
gcc main.cpp -o test -v---lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
g++ main.cpp -o test -v---lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc Also the option -shared-libgcc was automatically given as a gcc option
gcc main.c -o test -vcc1--lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
g++ main.c -o test -vcc1plus -D_GNU_SOURCE--lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc Also the option -shared-libgcc was automatically given as a gcc option

Basically, g++ is equivalent to gcc -shared-libgcc -lstdc++ -lm and for c files, g++ will also use the compiler cc1plus while gcc will use cc1.

Later edit: If you're interested in the --as-needed flag you can checkout this stackoverflow link

· One min read
Hreniuc Cristian-Alexandru

Merge multiple pdfs into one on linux:

Source

Use poppler-utils or poppler package, which comes with multiple tools. The one we are going to use is pdfunite.

Example:

pdfunite 1.pdf 2.pdf 3.pdf 4.pdf 5.pdf 6.pdf out.pdf

Note: Do not forget to add the last parameter which is the output file. If you don't give it, it will override the last input file that you give.


Using pdftk:

pdftk.pdf 2.pdf 3.pdf 4.pdf 5.pdf 6.pdf  cat output out.pdf

Rotate 180:

pdftk pdf1.pdf cat 1-endsouth output rotated_pdf1.pdf

Source: here

· One min read
Hreniuc Cristian-Alexandru

A tutorial can be found here.


First you need to install/build the latest version of doxygen, here you have a tutorial.

yum install flex bison

wget http://doxygen.nl/files/doxygen-1.8.15.src.tar.gz
tar -xf doxygen-1.8.15.src.tar.gz
mkdir -v build &&
cd build &&

cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-Wno-dev .. &&

make -j16

make install

Notice: You will also need to install flex and bison, before building the doxygen binary.

Generate the documentation:

git clone git://github.com/mosra/m.css
cd m.css/documentation

# You may need sudo here
pip3 install jinja2 Pygments --user

Create a Doxyfile-mcss alongside your doxygen.cfg file with this content:

@INCLUDE                = doxygen.cfg
GENERATE_HTML = NO
GENERATE_XML = YES
XML_PROGRAMLISTING = NO

Generate the documentation:

./doxygen.py path/to/your/Doxyfile-mcss

Then go in the output folder(the one set in the doxygen.cfg) and open index.html.

Note: Check the unsuported features here. Ex: Class hierarchy graphs are ignored..