# How to run acroread9 on FreeBSD 8.1



## ScopeDog (Aug 29, 2010)

First, this is a really terrible method, but I could run acroread9 on FreeBSD 8.1 without errors, so I just want to share it.

When you run acroread9, you will see it terminate with the following error message:


```
terminate called after throwing an instance of 'RSException'
```

However, if you run as root, you won't see it.

According to http://www.eecis.udel.edu/~bmiller/blog/, this is due to missing privilege in 'proc_priocntl'.

I actually don't know what it is, but understood that acroread9 required a sort of special permission or something.

Then, I setuid'ed /usr/local/Adobe/Reader9/ENU/Adobe/Reader9/Reader/intellinux/bin/acroread, which is a binary program of acroread.
However, I got


```
This is not a supported use of GTK+. You must create a helper
program instead. For further details, see:

[url]http://www.gtk.org/setuid.html[/url]

Refusing to initialize GTK+.
```

Since acroread9 uses GTK and GTK hates setuid and setgid, it won't start.

After a short break, I tried sudo.


```
# cd /usr/ports/security/sudo
# make install
```
Then, I visudo'ed and added the following lines.

```
# visudo

XXXX ALL=(root) NOPASSWD: /usr/local/Adobe/Reader9/ENU/Adobe/Reader9/Reader/intellinux/bin/acroread
XXXX ALL=(root) NOPASSWD: /usr/local/bin/acroread
XXXX ALL=(root) NOPASSWD: /usr/local/Adobe/Reader9/ENU/Adobe/Reader9/bin
```

XXXX is your user name.

I started up acroread9 with

```
% sudo -u root acroread
```

BUT acroread9 still complains:


```
Adobe Reader does not need to be run as a privileged user. Pleaseã€€remove 'sudo' from the beginning of the command.
```

I'm getting to hate this guy, but continued to find a solution.

I found that a sh script /usr/local/Adobe/Reader9/ENU/Adobe/Reader9/bin/acroread output the message, so I just commented out the following lines in it:


```
# Do not allow launch using 'sudo'.
#if [ "${ACRO_ALLOW_SUDO+set}" != "set" -a \( "${SUDO_USER+set}" = "set" -o "${SUDO_UID+set}" = "set" -o "${SUDO_GID}" = "set" \) ]; then
# printf "%s\n" "Adobe Reader does not need to be run as a privileged user. Please remove 'sudo' from the beginning of the command."
# exit 1
#fi
```

The output error message was mild but they really don't wanna users to use sudo.

Anyway, I typed


```
% sudo -u root acroread
```

again and acroread9 finally started up!

But this is a really horrible way and we need a smarter solution for it.

If you have a better solution, please tell me.


----------



## DutchDaemon (Aug 29, 2010)

Don't use fonts, use applicable posting tags: http://forums.freebsd.org/showthread.php?t=8816


----------



## wblock@ (Aug 29, 2010)

ScopeDog said:
			
		

> If you have a better solution, please tell me.



"Better" is subjective, but there are several alternatives to Acrobat Reader:


graphics/xpdf
Not the smoothest display, but works.
graphics/epdfview
Nice, small viewer, limited but good enough for most PDFs.
graphics/evince
Big viewer, lots of features, GNOME orientation makes it hard to configure and it seems really confused about default window sizes.


----------



## teckk (Aug 29, 2010)

I'm starting to like little graphics/xpdf more all the time.
A few mods something like

`% printf "xpdf*geometry: 800x700" >> /usr/home/<user>/.Xdefaults`

```
$ cat /usr/home/<user>/.xpdfrc
initialZoom 150
urlCommand      "firefox3 %s"
continuousView yes
```
helps it out.

also check ownership of /usr/home/<user>/.adobe
Everything in it should be owned by user not root.


----------



## ScopeDog (Aug 29, 2010)

Thank you wblock and teckk.

I have used xpdf and epdfview (and also evince probably), but the main reason why I have to use acroread is because I need to strictly check my pdf files output by pdflatex.


----------



## teckk (Aug 29, 2010)

You think that acroread displays pages made with pdflatex differently than xpdf? You may be right when it comes to .gif or something. I haven't found any difference that I have noticed.

I looked here
http://www.eecs.harvard.edu/~mdw/proj/texslides/

The .pdf that was made looked the same in both. Only difference is that adobe took about 5 times as long to get it open.


```
$ acroread -version
9.1.0
```
This version of acroread is working here.

Ports has 9.3.2
http://www.freebsd.org/cgi/cvsweb.cgi/ports/print/acroread9/

Saw a couple of more posts of either acroread 9.3 not working or not working in 8.1

You could try ports-mgmt/portdowngrade and get an earlier version if you think acroread is the problem. 

The update was to fix a security problem though
http://www.adobe.com/support/security/


----------



## ScopeDog (Aug 29, 2010)

It seems my first reply was not posted.

DutchDaemon:
I'm sorry. I'll be careful next time.

teckk:
Even acroread with different versions (and different OSs) sometimes show slight differences. Since this is critical in writing a research paper, I have to confirm with the latest acroread. One time, I thought my paper fit into a designated format and submitted it, but the one with a few modifications sent by an editor did not though it was OK with mine. Probably, this is a rare case and most people will not care it. Thank you anyway.


----------



## wblock@ (Aug 29, 2010)

Installed acroread9 again, and still have the same problem: it opens, displays the PDF, then quickly exits with "terminate called after throwing an instance of 'RSException'".  This happens either as root or user (user with all files in .adobe being user-owned).  It's the same as this PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/135486.

However, Acrobat Reader 9.3.3 for Windows does run under Wine, despite an apparently unimportant "crash" when installing.  Comes up with the "help us make Reader better by annoying you" survey screen and everything.


----------



## ScopeDog (Aug 30, 2010)

wblock said:
			
		

> Installed acroread9 again, and still have the same problem: it opens, displays the PDF, then quickly exits with "terminate called after throwing an instance of 'RSException'". This happens either as root or user



I have just installed acroread 9.3.4, but it's working well with root.
Are you using FreeBSD 8.1?
I clean installed 8.1 last month.


----------



## SirDice (Aug 30, 2010)

ok.. So now you're running the worlds crappiest piece of software as root?

You do realize Adobe Acrobat Reader regularly has security holes in it big enough to drive a truck through it?


----------



## ScopeDog (Aug 30, 2010)

SirDice said:
			
		

> ok.. So now you're running the worlds crappiest piece of software as root?
> 
> You do realize Adobe Acrobat Reader regularly has security holes in it big enough to drive a truck through it?



Ya.....
That's why I said 'terrible'.
But, I need to use the latest version, though I am thinking to switch to acroread8.


----------



## wblock@ (Aug 30, 2010)

ScopeDog said:
			
		

> I have just installed acroread 9.3.4, but it's working well with root.
> Are you using FreeBSD 8.1?
> I clean installed 8.1 last month.



8.1-stable as of two days ago.  Just tried 9.3.4, same problem.


----------



## ScopeDog (Aug 30, 2010)

wblock said:
			
		

> 8.1-stable as of two days ago.  Just tried 9.3.4, same problem.



Ummm.. Mine is 8.1-RELEASE.
Linuxulator's problem? I have no idea.


----------



## Kohji (Oct 6, 2010)

I can use acroread9 by user acount!

My environment is FreeBSD 8.1-RELEASE amd64.

I modified kernel as below.


```
--- p1003_1b.c.org	2010-10-06 21:56:20.968562681 +0900
+++ p1003_1b.c	2010-10-06 21:56:36.300039167 +0900
@@ -177,10 +177,12 @@
 	struct thread *targettd;
 	struct proc *targetp;
 
+#if 0
 	/* Don't allow non root user to set a scheduler policy. */
 	e = priv_check(td, PRIV_SCHED_SET);
 	if (e)
 		return (e);
+#endif
 
 	e = copyin(uap->param, &sched_param, sizeof(sched_param));
 	if (e)
```


----------



## ScopeDog (Oct 7, 2010)

I noticed that allowing regular users to set higher scheduling priority would solve this problem, but it will be against FreeBSD's policy. Therefore, this problem is not as easy as we think... I just wonder why acroread9 needs higher scheduling priority.


----------



## Kohji (Oct 8, 2010)

I think that acroread9 executes as below.
(I tried truss).


```
min = sched_get_priority_min(SCHED_OTHER);
 max = sched_get_priority_max(SCHED_OTHER);
 sched_param.sched_priority = max;
 sched_setscheduler(SCHED_OTHER, &sched_param);
```

I created another patch as below.

```
--- compat/linux/linux_misc.c.org       2010-10-08 14:10:06.852555427 +0900
+++ compat/linux/linux_misc.c   2010-10-08 14:09:44.750791635 +0900
@@ -1334,6 +1334,9 @@
     struct linux_sched_setscheduler_args *args)
 {
        struct sched_setscheduler_args bsd;
+#if 1
+       int error;
+#endif

 #ifdef DEBUG
        if (ldebug(sched_setscheduler))
@@ -1357,7 +1360,14 @@

        bsd.pid = args->pid;
        bsd.param = (struct sched_param *)args->param;
+#if 0
        return sched_setscheduler(td, &bsd);
+#else
+       error = sched_setscheduler(td, &bsd);
+       if (error != 0 && args->policy == LINUX_SCHED_OTHER)
+               error = 0;
+       return (error);
+#endif
 }

 int
```


----------



## ScopeDog (Oct 8, 2010)

I think we need a kernel option like ALLOW_NON_ROOT_SCHED_SET that allows non root users to set higher scheduling priority.
The change in the source code will be very small. Probably, modifying kern/kern_priv.c will be OK.

This will also be helpful for embedded systems.
Actually, I made an earthquake monitoring system with FreeBSD long time ago, and I wished I had had such an option.
Also, when I was researching on a parallel linear equation solver, I had to become root to run my program to get maximum performance for the same reason.

Anyway, it would be a better idea to suggest it.


----------

