Dec
27
2019
How to create an AppImage

AppImage is a brilliant way to have executable linux apps to every distro, without the need of re-packaging or re-build them. Without getting into too many details, it uses FUSE (Filesystem in Userspace) and SquashFS to bundle the app into one file.

AppImages require FUSE to run. Filesystem in Userspace (FUSE) is a system that lets non-root users mount filesystems.

So here are my personal notes on how to create Mozilla Firefox 68.3.0esr binary archive to an AppImage file.

download

Let’s begin by gathering all necessaries files

export VERSION=68.3.0esr

curl -sLO https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage

curl -sL https://ftp.mozilla.org/pub/firefox/releases/$VERSION/linux-x86_64/en-US/firefox-$VERSION.tar.bz2 | tar xjf -

configuration files

we need 3 files, under the firefox directory

  • AppRun (executable shell script)
  • Icon (.png,.svg,.xpm)
  • firefox.desktop (freedesktop.org desktop file)

AppRun

this is our guide, this file will start our application inside the AppImage mount.

#!/bin/sh
cd "$(dirname "$0")"
exec ./firefox "$@"

or

cat > firefox/AppRun <<EOF
#!/bin/sh
cd "\$(dirname "\$0")"
exec ./firefox "\$@"

EOF

Dont forget to make it executable

chmod +x firefox/AppRun

Icon

There is an image within firefox directory that we can use as firefox icon:

./firefox/browser/chrome/icons/default/default128

firefox.desktop

for more info check here: Desktop Entry Specification

[Desktop Entry]
Categories=Network;WebBrowser;
Icon=/browser/chrome/icons/default/default128
Name=Mozilla Firefox
Terminal=false
Type=Application
Version=1.0

or

cat > firefox/firefox.desktop <<EOF
[Desktop Entry]
Categories=Network;WebBrowser;
Icon=/browser/chrome/icons/default/default128
Name=Mozilla Firefox
Terminal=false
Type=Application
Version=1.0
EOF

In the Icon attribute, it must be an absolute path, not relative.

Perms

Give execute permission to appimagetool

chmod +x appimagetool-x86_64.AppImage

Build your AppImage

./appimagetool-x86_64.AppImage --no-appstream firefox/

Mozilla Firefox

if everything is okay, you will see this:

ls -l Mozilla_Firefox-x86_64.AppImage

and you can run it !

./Mozilla_Firefox-x86_64.AppImage

firefoxappimage.png

if you want to run a specific profile:

./Mozilla_Firefox-x86_64.AppImage --profile $(pwd)/.mozilla/firefox/ichznbon.test/

Mount

When you are running your AppImage, you will notice that there is a new mount point in our system (fusermount)

$ mount | grep -i firefox
Mozilla_Firefox-x86_64.AppImage on /tmp/.mount_MozillshcmPB type fuse.Mozilla_Firefox-x86_64.AppImage (ro,nosuid,nodev,relatime,user_id=347,group_id=347)

and if you look really careful, you will see that it is mounted under /tmp/ !

$ ls /tmp/.mount_MozillshcmPB
application.ini     firefox          icons               libmozsqlite3.so  libplc4.so       minidump-analyzer     Throbber-small.gif
AppRun              firefox-bin      libfreeblpriv3.chk  libmozwayland.so  libplds4.so      omni.ja               updater
browser             firefox-bin.sig  libfreeblpriv3.so   libnspr4.so       libsmime3.so     pingsender            updater.ini
chrome.manifest     firefox.desktop  liblgpllibs.so      libnss3.so        libsoftokn3.chk  platform.ini          update-settings.ini
crashreporter       firefox.sig      libmozavcodec.so    libnssckbi.so     libsoftokn3.so   plugin-container
crashreporter.ini   fonts            libmozavutil.so     libnssdbm3.chk    libssl3.so       plugin-container.sig
defaults            gmp-clearkey     libmozgtk.so        libnssdbm3.so     libxul.so        precomplete
dependentlibs.list  gtk2             libmozsandbox.so    libnssutil3.so    libxul.so.sig    removed-files

That’s it !

Your first AppImage bundle linux package.

Docker Notes

FUSE · AppImage/AppImageKit Wiki · GitHub

docker run --cap-add SYS_ADMIN --cap-add MKNOD --device /dev/fuse:mrw --rm -ti ubuntu:18.04 bash


 apt-get update

 apt-get -y install curl libfuse2 file 

 export VERSION=68.3.0esr

 curl -sLO https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage

 curl -sL https://ftp.mozilla.org/pub/firefox/releases/$VERSION/linux-x86_64/en-US/firefox-$VERSION.tar.bz2 | tar xjf -

 cat > firefox/AppRun <<EOF
#!/bin/sh
cd "\$(dirname "\$0")"
exec ./firefox "\$@"
EOF

 cat > firefox/firefox.desktop <<EOF
[Desktop Entry]
Categories=Network;WebBrowser;
Icon=/browser/chrome/icons/default/default128
Name=Mozilla Firefox
Terminal=false
Type=Application
Version=1.0
EOF

 chmod +x appimagetool-x86_64.AppImage

 ./appimagetool-x86_64.AppImage --no-appstream firefox/
appimagetool, continuous build (commit 64321b7), build 2111 built on 2019-11-23 22:20:53 UTC
WARNING: gpg2 or gpg command is missing, please install it if you want to create digital signatures
Using architecture x86_64
/firefox should be packaged as Mozilla_Firefox-x86_64.AppImage
Deleting pre-existing .DirIcon
Creating .DirIcon symlink based on information from desktop file
Generating squashfs...
Parallel mksquashfs: Using 8 processors
Creating 4.0 filesystem on Mozilla_Firefox-x86_64.AppImage, block size 131072.
[===========================================================================================================================|] 1583/1583 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
    compressed data, compressed metadata, compressed fragments,
    compressed xattrs, compressed ids
    duplicates are removed
Filesystem size 71064.05 Kbytes (69.40 Mbytes)
    36.14% of uncompressed filesystem size (196646.16 Kbytes)
Inode table size 5305 bytes (5.18 Kbytes)
    60.46% of uncompressed inode table size (8774 bytes)
Directory table size 1026 bytes (1.00 Kbytes)
    54.78% of uncompressed directory table size (1873 bytes)
Number of duplicate files found 3
Number of inodes 81
Number of files 67
Number of fragments 7
Number of symbolic links  1
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 13
Number of ids (unique uids + gids) 1
Number of uids 1
    root (0)
Number of gids 1
    root (0)
Embedding ELF...
Marking the AppImage as executable...
Embedding MD5 digest
Success

Please consider submitting your AppImage to AppImageHub, the crowd-sourced
central directory of available AppImages, by opening a pull request
at https://github.com/AppImage/appimage.github.io

final notes:

 du -h Mozilla_Firefox-x86_64.AppImage
70M Mozilla_Firefox-x86_64.AppImage

 ls -l Mozilla_Firefox-x86_64.AppImage
-rwxr-xr-x 1 root root 72962088 Dec 26 21:55 Mozilla_Firefox-x86_64.AppImage

 file Mozilla_Firefox-x86_64.AppImage
Mozilla_Firefox-x86_64.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.18, stripped

 ldd Mozilla_Firefox-x86_64.AppImage
    not a dynamic executable
Tag(s): AppImage, firefox
Aug
02
2015
disabling pocket on firefox

I am really disappointed about some of mozilla’s decisions.

One of them is the pocket integration.

Serves no purpose at all to embed a company’s add-on,
inside firefox without the choice of remove it!

So here is how to disable it :

open about:config and search for pocket

pocket_enabled.jpg

empty every string and change every boolean value to false:

pocket_disabled.jpg

Tag(s): firefox, pocket
Jan
17
2015
Firefox Session Cookies

A couple days ago, i wrote a blog post about how firefox don’t delete cookies from Pin Tabs here.

A friend of mine D. Glynos from census suggested to me that this problem/feature may be related to session cookies.

I was troubled about it and today i did a little research on the matter.

So when using firefox session restoration feature, firefox keeps all the session cookies in place and you can continue your work without a problem. If you hit F5 (refresh page) then the session is terminated and you have to log-in from the start.

OK, i don’t use session restoration but Pin Tabs. Seems that firefox considers Pin Tab as a session restoration process and that’s why it keeps the session cookies.

And this is by design !!!!!!!

There is also a 7 years bug (still opened - click here) that applies on Pin Tabs also.

Till now, i have not found a config (in about:config) option to tell firefox NOT to keep the session cookies when closing the browser!

UPDATE: 20150325

I got an email from a friend that suggest to take a look on this post from bugzilla:

443354#c48

I did a lot of testing and changed the below values to:

browser.sessionstore.privacy_level = 2
browser.sessionstore.privacy_level_deferred = 2
browser.sessionstore.privacy_level_deferred = 1

that means:

Never store extra session data.

but unfortunately the above did nothing for me.

the above did the trick for me

Anyhow, many thanks to Alex for informing me about this.

Jan
09
2015
firefox security cookie monster bug

[ PLZ read my new blog post on the matter]

Today i came across to a very nasty security firefox bug: when using Pin Tabs, firefox doesnt remove the first (in alphabetical order domain) cookies.

I am using Firefox v34.0.5 so it’s the latest stable version as of the time of writing this blog post.

PLZ, Let me try to walk you through my findings.

Below my settings:

firefox_cookie_settings.jpg

As you can see, firefox should remove all the cookies when I close it.
I use Pin Tabs for my day-to-day web sites/apps.

I ‘ve noticed that I am always logged in to a specific web site.
That gave me the creeps. How the hell i am already logged in to this web site.
I have just opened up my firefox and firefox should have removed all the cookies!

I closed every opened/pinned tab and removed all cookies by hand.
Restarted firefox, logged in to this site and then closed firefox.
Opened up again firefox and there was no cookie.

Strange

I am now thinking that my morning coffee had vodka inside.

Pin Tabbed a few sites, logged in to all of them, restarted firefox and then i am still logged in only to this specific web site.
Opened up the “Show Cookies …” setting from preferences and show a few cookies. Restarted once more firefox and invest the cookies again. Still logged in to this specific site.

The “Show Cookies …” setting presents the domain cookies in alphabetical order. So that gave me a clue. The site starts from the letter C and is always the first one domain cookie.

OK, time to write some php cookie code to further investigate this issue.



<?php

if ( !isset ( $_COOKIE["aaaa"] ) ) { 
        $cookie_value = 0;
}

$cookie_value = ++$_COOKIE["aaaa"];
setcookie ( "aaaa" , $cookie_value , strtotime("+1 day")  );

?>
<html>
<body>
<?php
        echo "Hit F5<br>";
        echo "cookie value is: " . $_COOKIE["aaaa"];
            
?>
</body>
</html>

Keep in mind, that the visiting server must send the set_cookie within the html headers. Before the html body.

Closed everything, removed every cookie. UnPin every tab and restarted firefox.
Visited my php test page, show cookie value, restarted firefox. No cookie.

Opened up once again firefox, visited my php test page. “Pin Tab” the test page, hit F5 a few times and then restart firefox. A cookie !!!!

So there is a security bug.

I’ll try to pass this to my mozillian friends so they file a security bug report.

Remember if you are logged in to amazon via a Pin Tab … amazon will always track you as it would (perhaps) be the first (in alphabetical order) domain cookie.

Tag(s): firefox, bug, cookie
Aug
05
2013
how to change the url search on firefox

firefox_search_url.png

Tag(s): firefox
Jun
26
2013
firefox addons

I am using mostly these addons for privacy

[updated 20180201]

Tag(s): firefox
Apr
08
2013
html5test

tl;dr

click here: html5test

full blog post:

I use a lot of different web browsers on a daily bases for testing and viewing company’s web applications and of course for browsing through the internet.

I use firefox cause it’s just works - without a lot of tweeks and has a huge addon library.
I dont like chromium cause i need to work through a lot of different proxies and chromium doesnt have yet a FoxyProxy plugin (or i havent found one yet).

I like working with midori web browser cause is the most light WebKit engine browser and when firefox is giving me the pain, i immediately switch to midori (till i have to work with foxyproxy).

In most cases everybody have an another web browser that they use for time to time but isnt their default browser or doesnt work perfectly as they want, but they love it as if it was their own baby project. This is my feelings about vimprobable2. It’s an amazing project - amazing.

For my line of work, i couldnt bypass internet explorer (even if i wanted to - and i want to) so in the mix i will bring up IE too.

I wanted to test their html5 capabilities and these are my results:

html5test.png

So clearly chromium is the leader and firefox Nightly with it’s gecko engine just behind.
I also loved that vimprobable2 scored better that midori.

IE version 8.0.6001.1872 scored 42/500 !
Nightly is Firefox Nightly version as of this blog post writing time

Every project tested (except IE) was in its latest version.

So test your browser with: html5test

Sep
28
2012
Vim English-Greek Spell Dictionary

I use vim as my primary editor.


btw i've never believed in Vim Vs Emacs cause the are two very different 
programs that do very different staffs with very different ways.

Apples and Orange.

The only (by me) common thing is that you can use them as editors too.

I use mutt as my primary MUA with $EDITOR=vim.

Writing frequently emails in more than one language can be harsh with no key bindings or a spell checker. You have to be very careful cause a tiny typo error can confuse a lot of people or worse.

People in sysadmin jobs understand what i mean a little better than others.

vim has been integrated with spell checking functionality. English (of course) are embedded.

To read all about that, open vim and on command mode write:


: help spell

If you want globally to map a function key to English spell checking functionality then, in /etc/vimrc write something like that:


:map <f5> :setlocal spell spelllang=en_us<return>

Next time you open vim (or editing an email through mutt) you can press F5 to spell check your text/email.

 

For Greek spell you need to google it. If you do that, then you’ll find instructions of using openoffice greek spell zip file for creating yours vim spell file (hint: mkspell). You can map it with F6 key and use it as above.

But I am writing both English & Greek and i am boring of typing F[what ever] key or switching languages and mpla mpla mpla mpla …

I use english_greek_spelling_dictionary of Firefox.

So how cool should be if a similar spell checking mechanism exist for vim ? A few days ago, linuxinside.gr had a tribute on pkst (Κώστας Παπαδήμας) and the idea strike me at that moment.

Here are the instructions of making your own



wget -c https://addons.mozilla.org/firefox/downloads/file/108368/english_greek_spelling_dictionary-0.5.5-tb+fx+sm.xpi
unzip english_greek_spelling_dictionary-0.5.5-tb+fx+sm.xpi
cd dictionaries/

At this point we will use mkspell.
Open vim:


vim

and on command mode type:


:mkspell engr English & Greek

The result is something like this:


Reading affix file English & Greek.aff ...
Trailing text in English & Greek.aff line 532: υ
Affix name too long in English & Greek.aff line 871: AA
Reading dictionary file English & Greek.dic ...
First duplicate word in English & Greek.dic line 588565: ΑΒΑ
12794 duplicate word(s) in English & Greek.dic
Compressing word tree...
Compressed 12575870 of 13454281 nodes; 878411 (6%) remaining
Compressed 15867 of 20446 nodes; 4579 (22%) remaining
Writing spell file engr.utf-8.spl ...
Done!
Estimated runtime memory use: 4415720 bytes

If you try to use a region name, then you will be facing the below error msg:


:mkspell en_gr English & Greek

E751: Output file name must not have region name

The result is : engr.utf-8.spl

We can move this to vim default spell location:


sudo cp engr.utf-8.spl /usr/share/vim/vim73/spell/

To map a key to English-Greek spell dictionary, open /etc/vimrc and add the below line:


:map <f6> :setlocal spell spelllang=engr<return>

Here is an example:

vim.spell.png

and here is the file (if you dont want to make it)

engr.utf-8.spl