Solved Unable to run startx

Hello.
I am a total newbie at FreeBSD. I installed FreeBSD 11.1, and followed the steps given at https://www.freebsd.org/doc/handbook/x11-wm.html

After running pkg install xfce as root (it installed, i think), I tried "startx" I got "command not found".
So I tried
% echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc
As a user of wheel group. It returned me the normal command prompt again. But startx gave me the same error again.
% echo "#!/bin/sh" > ~/.xsession gave me error "event not found".

I have an Intel core 2 duo processor (centrino, 2 GHz), 1GB RAM, 120GB HDD. I have windows 7 on one partition, Linux mint 7 on other, and freebsd on third. (I edited grub to have access to all three). The partition system is as follows:
Code:
FREEBSD (total 20GB)
-freebsd-ufs 2GB /
-freebsd-ufs 2GB /var
-freebsd-ufs 2GB /tmp
-freebsd-ufs 14GB /usr
I have the swap partition outside freebsd's nested partition.
How do I get the xfce started?
 
Last edited:
startx comes in a separate port / package:
Code:
root@kg-core1# pkg which `which startx`
/usr/local/bin/startx was installed by package xinit-1.3.4_1,1
perhaps the xinit port / package isn't installed?
 
Hello again.
I formatted the partition, and installed the freebsd again. The first thing I did was # pkg update then I did # pkg install xorg.
Before installing xfce, out of the curiosity, I ran # startfx. It gave me this screen:
pwaFIDy.jpg


after that I installed xfce using # pkg install xfce
after installing xfce, "startx" gave me the same screen. I was sort of expecting that, so I ran
% echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc
which returned the normal command prompt, without giving any error, or any kind of message at all. So I think it was successful. But when I entered "startx" after that, I got a black screen, and nothing. I waited for like an half hour, but nothing happened. The computer was running, and the screen was powered up, but it was black.

So I ran % echo "#!/bin/sh" > ~/.xsession which gave me the error "event not found".

Now what to do?[/cmd][/cmd]
 
I apologise, but can you please tell me step-by-step? All I have is theoretical knowledge. I have no experience of using Unix or Linux. :(
Add that line to your /etc/rc.conf with the help of an editor: vi(1) or ee(1) which are part of the base install.
eg: sudo vim /etc/rc.conf and add this line: dbus_enable="YES"
or
sudo echo 'dbus_enable="yes"' >> /etc/rc.conf
 
Thanks guys for all the replies/help. But how to enable a standard desktop environment? I dont expect much, only firefox, a video player (possibly VLC), and obviously a file manager. How to achieve this?

Add that line to your /etc/rc.conf with the help of an editor: vi or ee which are part of the base install.
eg: sudo vim /etc/rc.conf and add this line: dbus_enable="YES"
or
sudo echo 'dbus_enable="yes"' >> /etc/rc.conf
I edited the file using vi command. The current content of this file is:
Code:
hostname="kiran.<hostname>.com"
ipconfig_re0="DHCP"
sshd_enable="YES"
moused_enable="YES"
dbus_enable="YES"
#Set dumpdev to "AUTO" to enable crashdumps, "NO" to disable dumpdev="AUTO"
 
Hello guys. I don't know what happened, or how I achieved it, but the XFCE is working now! But at the terminal, I have to use # startxfce4

Is there a way that I can shorten that command to "startx" or at least "startxfce"? Thanks a lot in advance!
 
In your .xinitrc file remove the line you added with echo ( echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc) and add exec startxfce4. For installing software on your machine use pkg-install(8) software (eg: pkg install firefox vlc). Xfce come with his own file manager: Thunar.
 
Stop to write your own .xinitrc (it is often wrong). With Xfce desktop, you must copy /usr/local/etc/xdg/xfce4/xinitrc (it defines some additional environment variables).

Code:
cp /usr/local/etc/xdg/xfce4/xinitrc ~/.xinitrc

Then you can use a login manager (such x11/slim) or startx command.
 
In your .xinitrc file remove the line you added with echo (echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc) and add exec startxfce4. For installing software on your machine use pkg install software (eg: pkg install firefox vlc). Xfce come with his own file manager: Thunar.
Hi.
I already installed firefox. I would prefer startx over slim. Would you please tell me step-by-step how to remove that line, and how to start xfce by entering startx command? Currently startx opens xorg, and I have to enter startxfce4.

Stop to write your own .xinitrc (it is often wrong). With Xfce desktop, you must copy /usr/local/etc/xdg/xfce4/xinitrc (it defines some additional environment variables).

Code:
cp /usr/local/etc/xdg/xfce4/xinitrc ~/.xinitrc

Then you can use a login manager (such x11/slim) or startx command.

I apologise, I have no experience at all with freebsd so I did not understand your reply at all. Would you please put it in simple words?
 
sudo echo 'dbus_enable="yes"' >> /etc/rc.conf
This doesn't do what you think it does and is a common mistake. The redirection happens as a regular user and only the echo is actually elevated. Which means the writing to /etc/rc.conf is done as a user, so this will fail.

You typically see this solved by using tee(1):
echo 'dbus_enable="YES"' | sudo tee /etc/rc.conf
Another option is to make sure the whole line, including the redirection, is fed to sudo(8):
sudo 'echo dbus_enable="YES" >> /etc/rc.conf'
A much nicer option however is to use sysrc(8):
sudo sysrc dbus_enable="YES"
 
Back
Top