xrdp configuration and xfce4

280 views
Skip to first unread message

David Newman

unread,
Aug 7, 2018, 7:30:38 PM8/7/18
to freebsd-...@freebsd.org
In search of a working xrdp configuration to get connected from a Mac
running the Microsoft RDP client to a FreeBSD 11.2 machine running xfce4.

This worked fine until May, when a package upgrade from 0.6.x to 0.9.x
broke a working config.

Since then, startxfce4 doesn't run automatically, and copy-paste stopped
working even though it's enabled in xrdp.ini. Worse, I didn't make
backups of the old configs before running the pkg upgrade.

I've examined the xrdp.ini and startwm.sh scripts but don't know what to
change for FreeBSD. In particular, startwm.sh script is oriented toward
Linux distros, and I don't know what changes to make for FreeBSD.

The freebsd-questions archive and searches for xrdp-on-Freebsd
configuration information didn't help, and I don't know enough about X
to get this working from the man pages.

Thanks in advance for configuration clues and/or working configs.

dn


_______________________________________________
freebsd-...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

Koichiro Iwao

unread,
Aug 7, 2018, 9:20:42 PM8/7/18
to David Newman, freebsd-...@freebsd.org
Hi,

> I've examined the xrdp.ini and startwm.sh scripts but don't know what
> to
> change for FreeBSD. In particular, startwm.sh script is oriented toward
> Linux distros, and I don't know what changes to make for FreeBSD.

Just start Xfce.

--
meta <me...@FreeBSD.org>

David Newman

unread,
Aug 7, 2018, 9:25:32 PM8/7/18
to Koichiro Iwao, freebsd-...@freebsd.org
On 8/7/18 6:19 PM, Koichiro Iwao wrote:
> Hi,
>
>> I've examined the xrdp.ini and startwm.sh scripts but don't know what to
>> change for FreeBSD. In particular, startwm.sh script is oriented toward
>> Linux distros, and I don't know what changes to make for FreeBSD.
>
> Just start Xfce.

Not sure what changes I would make in startxm.sh to automate this. The
existing script has file locations for X on Linux distros.

After the upgrade, a connection takes around 30-60 seconds, much longer
than before. Eventually a black background and xterm appear, and I can
manually run 'startxfce4 &' from there.

Even then, copy/paste is still broken.

Thanks in advance for any clues on automating xfce startup and enabling
copy/paste (which, again, both worked before the upgrade).

dn

Koichiro Iwao

unread,
Aug 7, 2018, 9:33:02 PM8/7/18
to David Newman, freebsd-...@freebsd.org
On Tue, Aug 07, 2018 at 06:24:15PM -0700, David Newman wrote:
> Not sure what changes I would make in startxm.sh to automate this. The
> existing script has file locations for X on Linux distros.

Really?

```
#!/bin/sh
startxfce4
```

That's all.

--
meta <me...@FreeBSD.org>

David Newman

unread,
Aug 7, 2018, 10:12:08 PM8/7/18
to freebsd-...@freebsd.org
On 8/7/18 6:31 PM, Koichiro Iwao wrote:
> On Tue, Aug 07, 2018 at 06:24:15PM -0700, David Newman wrote:
>> Not sure what changes I would make in startxm.sh to automate this. The
>> existing script has file locations for X on Linux distros.
>
> Really?
>
> ```
> #!/bin/sh
> startxfce4
> ```
>
> That's all.

Sorry, no go.

A startwm.sh script with just these two lines produces a black screen
with one xterm and doesn't start xfce, let alone deal with the
copy/paste problem.

Also tried with '/usr/local/bin/xfce4-session' but got the same results.

Either of these is exactly the same outcome as using the default
startxm.sh script supplied with xrdp from the pkg repo.

I am restarting the xrdp service and exiting the xterm after each attempt.

If you have this working successfully with a similar environment --
Microsoft RDP client on a Mac connecting to xrdp 0.9.x on FreeBSD 11.2
-- are you able to share your xrdp.ini and startwm.sh files?

Thanks!

dn

Oleg Cherkasov

unread,
Aug 8, 2018, 12:33:53 PM8/8/18
to freebsd-...@freebsd.org
On 08. aug. 2018 04:10, David Newman wrote:
> On 8/7/18 6:31 PM, Koichiro Iwao wrote:
>> On Tue, Aug 07, 2018 at 06:24:15PM -0700, David Newman wrote:
>>> Not sure what changes I would make in startxm.sh to automate this. The
>>> existing script has file locations for X on Linux distros.
>>
>> Really?
>>
>> ```
>> #!/bin/sh
>> startxfce4
>> ```
>>
>> That's all.
>
> Sorry, no go.
>
> A startwm.sh script with just these two lines produces a black screen
> with one xterm and doesn't start xfce, let alone deal with the
> copy/paste problem.
>
> Also tried with '/usr/local/bin/xfce4-session' but got the same results.
>
> Either of these is exactly the same outcome as using the default
> startxm.sh script supplied with xrdp from the pkg repo.
>
> I am restarting the xrdp service and exiting the xterm after each attempt.
>
> If you have this working successfully with a similar environment --
> Microsoft RDP client on a Mac connecting to xrdp 0.9.x on FreeBSD 11.2
> -- are you able to share your xrdp.ini and startwm.sh files?

Have you tried to make ~/.xsession file with:

#! /bin/sh
startxfce4

David Newman

unread,
Aug 8, 2018, 2:00:00 PM8/8/18
to freebsd-...@freebsd.org
Previously the .xsession file was just 'startxfce4'.

But adding the '#! /bin/sh' line and restarting xrdp did not change the
behavior: It's still a black screen with one xterm, and no xfce4 desktop
or copy/paste support.

Of course startxfce4 will run manually from the xterm but along with
copy/paste, those are the problems I'm looking to solve.

Thanks.

dn

Oleg Cherkasov

unread,
Aug 8, 2018, 3:19:08 PM8/8/18
to freebsd-...@freebsd.org
On 08. aug. 2018 19:57, David Newman wrote:
> On 8/8/18 9:32 AM, Oleg Cherkasov wrote:
>> On 08. aug. 2018 04:10, David Newman wrote:
>
> Previously the .xsession file was just 'startxfce4'.
>
> But adding the '#! /bin/sh' line and restarting xrdp did not change the
> behavior: It's still a black screen with one xterm, and no xfce4 desktop
> or copy/paste support.
>
> Of course startxfce4 will run manually from the xterm but along with
> copy/paste, those are the problems I'm looking to solve.

I think it was another in X called ~/.xinitrc, just give it a try.

David Newman

unread,
Aug 8, 2018, 4:53:30 PM8/8/18
to freebsd-...@freebsd.org
On 8/8/18 12:16 PM, Oleg Cherkasov wrote:
> On 08. aug. 2018 19:57, David Newman wrote:
>> On 8/8/18 9:32 AM, Oleg Cherkasov wrote:
>>> On 08. aug. 2018 04:10, David Newman wrote:
>>
>> Previously the .xsession file was just 'startxfce4'.
>>
>> But adding the '#! /bin/sh' line and restarting xrdp did not change the
>> behavior: It's still a black screen with one xterm, and no xfce4 desktop
>> or copy/paste support.
>>
>> Of course startxfce4 will run manually from the xterm but along with
>> copy/paste, those are the problems I'm looking to solve.
>
> I think it was another in X called ~/.xinitrc, just give it a try.

That file previously had these contents:

exec /usr/local/bin/startxfce4 --with-ck-launch

Changing this to just:

startxfce4

and restarting the xrdp service did not result in xfce4 starting by
itself or copy/paste being enabled.

It's possible FreeBSD-specific changes are needed to xrdp.ini,
startwm.sh, and maybe other config files, but I don't know what those
changes are.

Thanks.

dn

doug

unread,
Aug 8, 2018, 6:23:53 PM8/8/18
to David Newman, freebsd-...@freebsd.org
On Wed, 8 Aug 2018, David Newman wrote:

> On 8/8/18 12:16 PM, Oleg Cherkasov wrote:
>> On 08. aug. 2018 19:57, David Newman wrote:
>>> On 8/8/18 9:32 AM, Oleg Cherkasov wrote:
>>>> On 08. aug. 2018 04:10, David Newman wrote:
>>>
>>> Previously the .xsession file was just 'startxfce4'.
>>>
>>> But adding the '#! /bin/sh' line and restarting xrdp did not change the
>>> behavior: It's still a black screen with one xterm, and no xfce4 desktop
>>> or copy/paste support.
>>>
>>> Of course startxfce4 will run manually from the xterm but along with
>>> copy/paste, those are the problems I'm looking to solve.
>>
>> I think it was another in X called ~/.xinitrc, just give it a try.
>
> That file previously had these contents:
>
> exec /usr/local/bin/startxfce4 --with-ck-launch
>
> Changing this to just:
>
> startxfce4
>
> and restarting the xrdp service did not result in xfce4 starting by
> itself or copy/paste being enabled.
>
> It's possible FreeBSD-specific changes are needed to xrdp.ini,
> startwm.sh, and maybe other config files, but I don't know what those
> changes are.

Do you have physical access to the FreeBSD system? If so look at
.xsession-errors in your home dir. In /var/log you will have Xorg.0.log and some
other simiarly name files. It seemed like getting xfce started was at least part
of the problem. If not, sorry for the noise.

I use xdm with my .xsession as follows:

artemis:~> cat .xsession
#!/bin/sh
/usr/bin/ssh-agent /usr/local/bin/startxfce4

startxfce4 from the console login also works. I do not have any other user
defined files.

Koichiro IWAO

unread,
Aug 8, 2018, 11:38:38 PM8/8/18
to o1...@member.fsf.org, freebsd-...@freebsd.org

>>> ```
>>> #!/bin/sh
>>> startxfce4
>>> ```
>>>
>>> That's all.
>>
>> Sorry, no go.
>>
>> A startwm.sh script with just these two lines produces a black screen
>> with one xterm and doesn't start xfce, let alone deal with the
>> copy/paste problem.

Did you see /var/log/xrdp-seman.log?

In this context, ~/.xsession or ~/.xinitrc doesn't affect. Forget it.

--
`whois vmeta.jp | nkf -w`
meta <me...@vmeta.jp>

Koichiro IWAO

unread,
Aug 8, 2018, 11:38:49 PM8/8/18
to David Newman, freebsd-...@freebsd.org

> Sorry, no go.
>
> A startwm.sh script with just these two lines produces a black screen
> with one xterm and doesn't start xfce, let alone deal with the
> copy/paste problem.

Also try creating ~/startwm.sh instead with following two lines.
Don't forget to add execute permission to the script. If it doesn't
work and you see xterm, see and show me /var/log/xrdp-sesman.log.

>> ```
>> #!/bin/sh
>> startxfce4
>> ```

Again, in xrdp context, ~/.xinitrc or ~/.xsession doesn't affect. Forget
it and
see /usr/local/etc/xrdp/startwm.sh or ~/startwm.sh.

--
`whois vmeta.jp | nkf -w`
meta <me...@vmeta.jp>

David Newman

unread,
Aug 9, 2018, 2:21:21 PM8/9/18
to freebsd-...@freebsd.org


On 8/8/18 3:22 PM, doug wrote:
> On Wed, 8 Aug 2018, David Newman wrote:
>
>> On 8/8/18 12:16 PM, Oleg Cherkasov wrote:
>>> On 08. aug. 2018 19:57, David Newman wrote:
>>>> On 8/8/18 9:32 AM, Oleg Cherkasov wrote:
>>>>> On 08. aug. 2018 04:10, David Newman wrote:
>>>>
>>>> Previously the .xsession file was just 'startxfce4'.
>>>>
>>>> But adding the '#! /bin/sh' line and restarting xrdp did not change the
>>>> behavior: It's still a black screen with one xterm, and no xfce4
>>>> desktop
>>>> or copy/paste support.
>>>>
>>>> Of course startxfce4 will run manually from the xterm but along with
>>>> copy/paste, those are the problems I'm looking to solve.
>>>
>>> I think it was another in X called ~/.xinitrc, just give it a try.
>>
>> That file previously had these contents:
>>
>> exec /usr/local/bin/startxfce4 --with-ck-launch
>>
>> Changing this to just:
>>
>> startxfce4
>>
>> and restarting the xrdp service did not result in xfce4 starting by
>> itself or copy/paste being enabled.
>>
>> It's possible FreeBSD-specific changes are needed to xrdp.ini,
>> startwm.sh, and maybe other config files, but I don't know what those
>> changes are.
>
> Do you have physical access to the FreeBSD system?

Didn't mention before, but this is a VM running in VMware vSphere. I
have ssh and virtual console access. I don't think the VM part is
relevant since xfce4 and copy-paste worked on the same VM prior to the
upgrade from xrdp 0.6.x to 0.9.x (and again, the root problem here is my
failure to back up configs before the upgrade).


>If so look at
> .xsession-errors in your home dir. In /var/log you will have Xorg.0.log
> and some other simiarly name files. It seemed like getting xfce started
> was at least part of the problem. If not, sorry for the noise.

Sorry, but there's no .xsession-errors file in the home directory.



>
> I use xdm with my .xsession as follows:
>
> artemis:~> cat .xsession
> #!/bin/sh
> /usr/bin/ssh-agent /usr/local/bin/startxfce4
>
> startxfce4 from the console login also works. I do not have any other
> user defined files.

Interesting. startxfce4 from the console login also works for me, but
without copy/paste support.

I'm going to try Iwao-san's suggestion about startwm.sh and will report
back.

dn

David Newman

unread,
Aug 9, 2018, 3:24:12 PM8/9/18
to freebsd-...@freebsd.org
On 8/8/18 8:37 PM, Koichiro IWAO wrote:
>
>> Sorry, no go.
>>
>> A startwm.sh script with just these two lines produces a black screen
>> with one xterm and doesn't start xfce, let alone deal with the
>> copy/paste problem.
>
> Also try creating ~/startwm.sh instead with following two lines.
> Don't forget to add execute permission to the script. If it doesn't
> work and you see xterm, see and show me /var/log/xrdp-sesman.log.
>
>>> ```
>>> #!/bin/sh
>>> startxfce4
>>> ```
>
> Again, in xrdp context, ~/.xinitrc or ~/.xsession doesn't affect. Forget
> it and
> see /usr/local/etc/xrdp/startwm.sh or ~/startwm.sh.

Partial success! xfce4 now starts automatically with a local startwm.sh
file.

However, copy/paste functionality still is missing. This worked with the
earlier 0.6.x pkg, and appears to be enabled in the 0.9.x version of the
xrdp.ini file. Is there something else that needs to be enabled?

Thanks!

dn

David Newman

unread,
Aug 9, 2018, 6:33:09 PM8/9/18
to freebsd-...@freebsd.org
On 8/9/18 12:22 PM, David Newman wrote:
> However, copy/paste functionality still is missing. This worked with the
> earlier 0.6.x pkg, and appears to be enabled in the 0.9.x version of the
> xrdp.ini file.

ps. Here are the clipboard settings currently in
/usr/local/etc/xrdp/xrdp.ini:

cliprdr=true
channel.cliprdr=true

Checking the logs, there is no update to xrdp.log, xrdp-sesman.log, or
Xorg.10.log upon a copy/paste failure.

dn

Koichiro IWAO

unread,
Aug 9, 2018, 7:33:21 PM8/9/18
to David Newman, freebsd-...@freebsd.org

>> Again, in xrdp context, ~/.xinitrc or ~/.xsession doesn't affect.
>> Forget
>> it and
>> see /usr/local/etc/xrdp/startwm.sh or ~/startwm.sh.
>
> Partial success! xfce4 now starts automatically with a local startwm.sh
> file.

Which did you try? ~/startwm.sh? If you got success with ~/startwm.sh,
there might be a bug of xrdp. Some people reported similar issue to
yours.

Let me break down the issue and help us improve xrdp before looking at
clipboard issue.

1. remove ~/startwm.sh
2. confirm /usr/local/etc/xrdp/startwm.sh starts startxfce4
3. login via xrdp
4. you'll see xterm
5. see /var/log/xrdp-sesman.log
6. you'll see the log like this

[20180710-23:08:24] [CORE ] waiting for window manager (pid 41266) to
exit
[20180710-23:08:24] [CORE ] error starting default wm for user meta -
pid 41266
[20180710-23:08:25] [DEBUG] errno: 2, description: No such file or
directory
[20180710-23:08:25] [DEBUG] execlp3 parameter list:
[20180710-23:08:25] [DEBUG] argv[0] = startwm.sh
[20180710-23:08:25] [DEBUG] argv[1] = startwm.sh

If you see the log like this, xrdp is failing to find
/usr/local/etc/xrdp/startwm.sh.
If you specify the full path to startwm.sh in sesman.ini, it should
work. Try it.
Don't forget to restart xrdp-sesman after you edited sesman.ini.

```
DefaultWindowManager=/usr/local/etc/xrdp/startwm.sh
```

Thank you for your cooperation.

--
`whois vmeta.jp | nkf -w`
meta <me...@vmeta.jp>

David Newman

unread,
Aug 10, 2018, 11:50:00 AM8/10/18
to freebsd-...@freebsd.org
On 8/9/18 4:26 PM, Koichiro IWAO wrote:
>
>>> Again, in xrdp context, ~/.xinitrc or ~/.xsession doesn't affect. Forget
>>> it and
>>> see /usr/local/etc/xrdp/startwm.sh or ~/startwm.sh.
>>
>> Partial success! xfce4 now starts automatically with a local startwm.sh
>> file.
>
> Which did you try? ~/startwm.sh?

Yes. xfce4 starts up with ~/startwm.sh in place, using the contents and
permissions you described.

> If you got success with ~/startwm.sh,
> there might be a bug of xrdp. Some people reported similar issue to yours.

OK. That is a separate issue, but a big one for me, as it makes remote
management difficult.

Where is the appropriate place to report the clipboard issue?

> Let me break down the issue and help us improve xrdp before looking at
> clipboard issue.
>
> 1. remove ~/startwm.sh
> 2. confirm /usr/local/etc/xrdp/startwm.sh starts startxfce4
> 3. login via xrdp
> 4. you'll see xterm
> 5. see /var/log/xrdp-sesman.log
> 6. you'll see the log like this
>
> [20180710-23:08:24] [CORE ] waiting for window manager (pid 41266) to exit
> [20180710-23:08:24] [CORE ] error starting default wm for user meta -
> pid 41266
> [20180710-23:08:25] [DEBUG] errno: 2, description: No such file or
> directory
> [20180710-23:08:25] [DEBUG] execlp3 parameter list:
> [20180710-23:08:25] [DEBUG]         argv[0] = startwm.sh
> [20180710-23:08:25] [DEBUG]         argv[1] = startwm.sh
>
> If you see the log like this, xrdp is failing to find
> /usr/local/etc/xrdp/startwm.sh.
> If you specify the full path to startwm.sh in sesman.ini, it should
> work. Try it.
> Don't forget to restart xrdp-sesman after you edited sesman.ini.
>
> ```
> DefaultWindowManager=/usr/local/etc/xrdp/startwm.sh
> ```
>
> Thank you for your cooperation.

Thank YOU, Iwao-san, for your help with this.

The behavior is exactly as you described, but only if we replace the
startwm.sh script supplied with the pkg with the two-line version you
suggested:

#!/bin/sh
startxfce4

The startwm.sh script supplied with the package has three different
cases for Linux distributions (lines 66-88) but nothing for xfce4 on
FreeBSD.

Thanks again for your help with the startup issue, and in advance for
pointers on debugging the clipboard issue.

dn

Koichiro IWAO

unread,
Aug 16, 2018, 2:00:17 AM8/16/18
to David Newman, freebsd-...@freebsd.org

> Thank YOU, Iwao-san, for your help with this.
>
> The behavior is exactly as you described, but only if we replace the
> startwm.sh script supplied with the pkg with the two-line version you
> suggested:
>
> #!/bin/sh
> startxfce4
>
> The startwm.sh script supplied with the package has three different
> cases for Linux distributions (lines 66-88) but nothing for xfce4 on
> FreeBSD.
>
> Thanks again for your help with the startup issue, and in advance for
> pointers on debugging the clipboard issue.

Then, your issue is identical to a bug some other people already
reported. Please be patient until we fix the bug. For the moment,
specifying DefaultWindowManager by full path might be a workaround.

And one more, xrdp pkg/ports installs startwm.sh but it is an example
for Linux. You're supposed to create your own startwm.sh that fits your
environment and need. It is unkind but I suppose FreeBSD users are more
skilled than ordinary GNU/Linux users.

Regarding the clipboard issue, I will send you another post later.

--
`whois vmeta.jp | nkf -w`
meta <me...@vmeta.jp>

Koichiro IWAO

unread,
Aug 16, 2018, 2:08:18 AM8/16/18
to freebsd-...@freebsd.org, dne...@networktest.com
Regarding clipboard issue, add this to your SessionVariables section in
sesman.ini.

> CHANSRV_LOG_LEVEL=LOG_LEVEL_DEBUG

Then xrdp will produce more debug logs. See
`~/.local/share/xrdp/xrdp-chansrv.*.log`
and what happens when you copy something to clipboard.

--
`whois vmeta.jp | nkf -w`
meta <me...@vmeta.jp>

David Newman

unread,
Aug 16, 2018, 10:10:17 PM8/16/18
to freebsd-...@freebsd.org
>> And one more, xrdp pkg/ports installs startwm.sh but it is an example
>> for Linux. You're supposed to create your own startwm.sh that fits your
>> environment and need. It is unkind but I suppose FreeBSD users are more
>> skilled than ordinary GNU/Linux users.

Hi Iwao-san,

I'll generally agree that FreeBSD users are a skilled lot but I don't
want to engage in OS flame wars.


On 8/16/18 2:00 AM, Koichiro IWAO wrote:
> Regarding clipboard issue, add this to your SessionVariables section in
> sesman.ini.
>
>> CHANSRV_LOG_LEVEL=LOG_LEVEL_DEBUG

Done.

[Chansrv]
; drive redirection, defaults to xrdp_client if not set
FuseMountName=thinclient_drives

[SessionVariables]
PULSE_SCRIPT=/usr/local/etc/xrdp/pulse/default.pa
CHANSRV_LOG_LEVEL=LOG_LEVEL_DEBUG


>
> Then xrdp will produce more debug logs. See
> `~/.local/share/xrdp/xrdp-chansrv.*.log`
This was no ~/.local/share/xrdp directory after restarting the xrdp and
xrdp-sesman services. I manually created the directory and touched the
xrdp-chansrv.0.log file (owned by the user, mod 0644) but do not see any
entries going into that file.

David Newman

unread,
Aug 26, 2018, 1:10:48 PM8/26/18
to freebsd-...@freebsd.org
On 8/16/18 7:08 PM, David Newman wrote:

> On 8/16/18 2:00 AM, Koichiro IWAO wrote:
>> Regarding clipboard issue, add this to your SessionVariables section in
>> sesman.ini.
>>
>>> CHANSRV_LOG_LEVEL=LOG_LEVEL_DEBUG
>
> Done.
>
> [Chansrv]
> ; drive redirection, defaults to xrdp_client if not set
> FuseMountName=thinclient_drives
>
> [SessionVariables]
> PULSE_SCRIPT=/usr/local/etc/xrdp/pulse/default.pa
> CHANSRV_LOG_LEVEL=LOG_LEVEL_DEBUG
>
>
>>
>> Then xrdp will produce more debug logs. See
>> `~/.local/share/xrdp/xrdp-chansrv.*.log`
> This was no ~/.local/share/xrdp directory after restarting the xrdp and
> xrdp-sesman services. I manually created the directory and touched the
> xrdp-chansrv.0.log file (owned by the user, mod 0644) but do not see any
> entries going into that file.

Checking back on this, I don't have any debug info on the xrdp clipboard
issue as described above.

The lack of clipboard capability is a big problem when troubleshooting.
If freebsd-questions is not the correct forum to report this issue,
where else to report this?

Many thanks!
Reply all
Reply to author
Forward
0 new messages