11

So, I have installed fortune on my Rackspace server but if I run it without any arguments it says

No fortunes found

I installed the package as root so there shouldn't be a permissions issue. The directory /usr/share/games/fortunes doesn't even exist which is where it's supposed to store the fortunes. I thought it might be a Rackspace package issue so I install the latest stable deb package with dpkg from https://launchpad.net/ubuntu/+archive/primary/+files/fortune-mod_1.99.1-7_amd64.deb. I've tried uninstalling fortune and fortune-mod and re-installing them with aptitude to no avail. What could the issue be?

2
  • How did you install it?
    – Parto
    Dec 1, 2015 at 15:13
  • Just a basic sudo apt-get install fortune. I also tried sudo apt-get autoremove fortune fortune-mod and then re-installed with sudo aptitude install fortune.
    – Alex W
    Dec 1, 2015 at 15:22

5 Answers 5

12

The package fortune (or fortune-mod) only contain the program to display the fortune cookies, not the cookies (texts) themselves.

You need to additionally install a fortunes* package. Which ones are available for your system can be easily checked with the command apt-cache search "^fortunes". On my system, the output is:

fortunes - Data files containing fortune cookies
fortunes-bg - Bulgarian data files for fortune
fortunes-bofh-excuses - BOFH excuses for fortune
fortunes-br - Data files with fortune cookies in Portuguese
fortunes-cs - Czech and Slovak data files for fortune
fortunes-de - German data files for fortune
fortunes-debian-hints - Debian Hints for fortune
fortunes-eo - Collection of esperanto fortunes.
fortunes-eo-ascii - Collection of esperanto fortunes (ascii encoding).
fortunes-eo-iso3 - Collection of esperanto fortunes (ISO3 encoding).
fortunes-es - Spanish fortune database
fortunes-es-off - Spanish fortune cookies (Offensive section)
fortunes-fr - French fortunes cookies
fortunes-ga - Irish (Gaelige) data files for fortune
fortunes-it - Data files containing Italian fortune cookies
fortunes-it-off - Data files containing Italian fortune cookies, offensive section
fortunes-mario - Fortunes files from Mario
fortunes-min - Data files containing selected fortune cookies
fortunes-off - Data files containing offensive fortune cookies
fortunes-pl - Polish data files for fortune
fortunes-ru - Russian data files for fortune
fortunes-spam - fortunes taken from SPAM messages
fortunes-ubuntu-server - Ubuntu server tips for fortune

Install those packages that interest you, usually you want fortunes-min (small package of about 60 kB with few fortune cookies) or fortunes (larger package of about 1 MB with over 15,000 cookies).

The others are either localized (German or Spanish cookies for example) or cover a specific topic only (e.g. spam or offensive). You may of course install multiple fortunes packages.

If you install a language package, these are installed on a subfolder of /usr/share/games/fortunes/ so you may need to prefix it to the database name:

fortune -e -s es/asimov.fortunes ubuntu-server-tips

Oh, and don't forget: fortune works best in combination with cowsay! :D

$ fortune | cowsay
 _____________________________________
/ A handful of patience is worth more \
\ than a bushel of brains.            /
 -------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
2
  • in order to display it to every new terminal, add the following lines to your ~/.bashrc: "if [ -x /usr/games/cowsay -a -x /usr/games/fortune ]; then fortune | cowthink fi"
    – krankuba
    Sep 5, 2018 at 11:51
  • To have only short ones and in one line fortune -s -n 80 | paste -s | awk '{$2=$2};1'. Apr 13, 2019 at 6:20
7

As far as I know, the fortune-mod package only contains the server/engine, not the fortunes to serve. You need to install a package containing actual fortunes as well (try fortunes-min)

1
  • 1
    So I ran sudo apt-cache search fortune and there was a package called fortunes along with tons of other language packages which had them in every different language. Strangely, I was able to install fortunes without installing fortune and vice versa. I believe the fortune data files are listed as a dependency in the normal repository, this must just be a Rackspace thing. Thanks!
    – Alex W
    Dec 1, 2015 at 15:24
1

I had the same issue (and installing fortunes didn't work)

but if I run:

fortune -ao

The fortune program works as expected...

(don't know why...)

0

If you would prefer the original Unix 5 fortune cookie datafile, you can find it here:

fortune cookie

It comes with my small app in C to read it. Change FORTUNEFILEPATH in line 5 (fortune.c) to point to where you want to keep fortune.dat.

This has 10155 entries.

I wish luck :)

-1

You can do below commands and it will work:

$ strfile fortunes/data/fortunes
$ strfile fortunes/data/chinese
$ strfile fortunes/data/tang300
$ strfile fortunes/data/song100
$ strfile fortunes/data/diet

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .