Gnome3: Enable suspend/hibernate option without swap partition

Linux needs swap partition to suspend or hibernate. But there is a way to enable suspend and hibernate without creating a swap partition. The trick is to create a swap file instead of partition and informing linux to use this swap file instead of swap partition.

Install pmi(power management interface) package

sudo apt-get install powermanagement-interface

Now you should be able to suspend using either

sudo pm-suspend


dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend

Peculiarly for me, the screen doesn’t lock when the PC suspends. Alternatively, you can lock and suspend using the following command

gnome-screensaver-command -l && dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend

Enable suspend option in Gnome3 status menu

You can enable suspend option in Gnome3 status menu by installing the following extension.

Crack and install Modelsim on linux

Note: Piracy is crime. Please don’t use or encourage pirated software. If you would like to evaluate Modelsim, try the evaluation version. If you still haven’t changed your mind, read on :P.

1) Install the required dependencies

2) Download modelsim 10.1c for linux and its corresponding crack.

3) Mount the downloaded modelsim iso and install modelsim.

mkdir /tmp/modelsim/
mount -o loop path-to-iso /tmp/modelsim
cd /tmp/modelsim

Note:Install modelsim under ~/modelsim/ directory. If you choose another location, please make sure you exchange the default location with your preferred location in the steps below.

4) Execute this script to crack modelsim

Comment the first two lines in the generated license.dat

#SERVER xxxx xxxxxxxxxxxx 27001
#VENDOR mgcld D:FEATURE mgc_s mgcld 2020.00 1-jan-2021 999 0 TS_OK

5) Fix libfreetype problem (Only required if you face this problem)
Try to start vsim

cd ~/modelsim/modeltech/linux_x86_64/

If vsim reports the following error, your distro’s freetype library doesn’t play well with modelsim.

** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)

Use the following script to compile custom freetype

6) Modelsim is ready to use! One last step, add these commands to ~/.bashrc to avoid executing every time you start a new terminal

Linux and Modelsim!!!! Ain’t it fun?

Ubuntu: Compiling ffmpeg from source

Ubuntu uses avconv instead of ffmpeg. It also doesn’t have a package for libswresample. This can be problematic at times. So I resorted to installing ffmpeg from source. You need the following packages to compile ffmpeg from source.

sudo apt-get install yasm pkg-config

Lets clone the ffmpeg repository and compile it.

git clone FFmpeg
cd FFmpeg
./configure --prefix=/usr/local/ffmpeg --enable-shared
sudo make install

After the above step successfully completes, ffmpeg should be installed in /usr/local/ffmpeg directory. Since we have installed ffmpeg in non standard location, we have to set PKG_CONFIG_PATH and LD_LIBRARY_PATH correctly. Add these lines at the end of your ~/.bashrc.

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ffmpeg/lib/pkgconfig/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ffmpeg/lib/

Install ffmpeg/avconv dev packages in Ubuntu

In Debian and its derivatives, the dev package for ffmpeg/avconv is split into several sub packages:

  • libavdevice-dev
  • libavformat-dev
  • libavfilter-dev
  • libavcodec-dev
  • libswscale-dev
  • libavutil-dev

This command will install all of them:

sudo apt-get install libavdevice-dev libavformat-dev libavfilter-dev libavcodec-dev libswscale-dev libavutil-dev