Best (and Most Correct) Way to Run FreeBSD for Desktop

Yeah. I was hoping you'll look at more than one such article, but even this was a useful exercise in doing research and connecting the dots back to your FreeBSD adventures. :)
I will try to read more about TWM once I get KDE set up. It does seem interesting, but right now all I can think about is getting KDE set up.

While those instructions are not harmful per se i believe that tutorials should be as short as possible and focus on the necessary steps. Maybe people know that these modules get started while booting and are confused and wonder why you start them beforehand.
Upon further reflection, I think you were in the right, and I was in the wrong. I am going to amend my instructions (see Rough Draft #5 below) to say those two instructions are not necessary. With that said, I am still going to do the instructions myself -- even though I'm sure 99% of FreeBSD users would not. This is because I am overly cautious and want to do everything I can to make sure everything is loaded and works. Keeping the instructions in the rough draft -- though saying they are not necessary -- is mostly just for myself, but maybe other people will find seeing those steps mentioned and why they don't need to be followed helpful. Thank you for your concern.

--

I think I am going to attempt to install KDE now because tonight is the longest lunar eclipse in 580 years. (I know, I'm weird.) How do I take a screenshot once I get into KDE (so I can post it here)?

--

Instructions for Installing KDE on FreeBSD (Rough Draft #5)

In this fifth rough draft of instructions, I will show you how to install KDE that will be started with the command startx. My second rough draft of instructions should not be followed because steps I20-I23 are not edited from a usr account (i.e. they should not be edited as root). The third rough draft of instructions should also not be followed because steps J23-J27 should be merged with step J4. The fourth rough draft is mostly correct; this fifth rough draft makes minor edits to L7, L8, and L13. My first rough draft of instructions shows you how to install KDE that is started by sddm. Thanks go to astyle for ironing out the final details and everyone else who contributed on The FreeBSD Forums.

L1. Enter the superuser/root account by entering % su and the password for the root account. Note that the command prompt on the shell (%, $, #, etc.) is dependent on what user is currently logged in. Therefore, the % should not actually be typed out. Once in the root account, the command prompt will be #.

L2. Run # pkg install drm-kmod

L3. Enter the easy editor to edit the file /etc/rc.conf by entering the following command: # ee /etc/rc.conf

L4. Once in the easy editor, on a new line, enter the following two lines on separate lines:
Code:
kld_list="/boot/modules/i915kms.ko"
dbus_enable="YES"

L5. Make sure to hit Enter so the file starts on a new line after saving.

L6. Save and exit the easy editor by pushing Esc and following the prompts to save and exit. The KMS driver should now be set up.

L7. (L7 and L8 are superfluous if you reboot in step L10. i915kms and dbus get loaded while booting because you added them to /etc/rc.conf in L4. In other words, you can skip L7 and L8. I am still including the steps for future reference.) Go ahead and load the drm driver. Run # kldload /boot/modules/i915kms.ko

L8. (L7 and L8 are superfluous if you reboot in step L10. i915kms and dbus get loaded while booting because you added them to /etc/rc.conf in L4. In other words, you can skip L7 and L8. I am still including the steps for future reference.) Run # service dbus start

L9. Run # pkg install xorg

L10. Reboot by running # shutdown -r now and booting up to a command-line login prompt.

L11. Log in as regular user (this is important).

L12. Run % startx as regular user (Even the Handbook tells you to do that, the Quick Start section 5.4.1, Step 3.)

L13. TWM window manager will start. You can return to text mode by opening the pop-up menu by left-clicking on the desktop and then clicking Exit.

L14. Become the superuser/root account again by running % su

L15. Reboot by running # shutdown -r now

L16. After logging in, become the superuser/root account again by running % su

L17. Run # pkg install kde5 firefox

L18. Enter the easy editor to edit the file /etc/fstab by entering the following command: # ee /etc/fstab

L19. Once in the easy editor, on new lines, enter the following two lines (you can push the Tab key or spacebar after entering each field):
fdesc /dev/fd fdescfs rw 0 0 proc /proc procfs rw 0 0
(See post #33. There is debate on whether this instruction should be included; I am including it because it may be beneficial for those who want to run applications such as LibreOffice.)

L20. Make sure to hit Enter so the file starts on a new line after saving.

L21. Save and exit the easy editor by pushing Esc and following the prompts to save and exit.

L22. Run # mount /dev/fd

L23. Run # mount /proc

L24. Exit the superuser account by running # exit. All files in your $HOME directory should be edited as a regular user, not as root.

L25. Enter the easy editor to edit the file ~/.xinitrc by entering the following command: % ee ~/.xinitrc

L26. Once in the easy editor, on a new line, enter the following line:
Code:
exec ck-launch-session startplasma-x11

L27. Make sure to hit Enter so the file starts on a new line after saving.

L28. Save and exit the easy editor by pushing Esc and following the prompts to save and exit.

L29. Become the superuser/root account again by running % su

L30. Reboot by running # shutdown -r now

L31. If you chose not to reboot, enter # exit to leave the superuser account.

L32. If everything worked, you should see the KDE desktop after running % startx as a regular account.
 
KDE is up and running! See the attachments for a photo (I have not figured out how to do screenshots yet).

However, I have some concerns and took (mostly good) notes.

1. After entering L2, I got this message:
The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]

I entered y. I take it this bootstraps the system to use packages; is that right?

2. When I was trying to type L7, it entered the command too soon (I don’t think I accidentally pressed Enter). So the command was something like # kldload /boot/ or some other fractional portion rather than # kldload /boot/modules/i915kms.ko

I got some kind of error message, which I wish I wrote down. I even had to type exit to get back to the command prompt (the cursor was just blinking on some empty line). Do you know why this happened? And do you know anything about the command kldload and if I potentially messed up my computer?

3. When I did step L8, I got this message:
dbus does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

4. For L13, I clicked Exit, but I also had to enter exit in all the xterm’s to get back to text mode.

5. I skipped L18-L23, because I couldn’t figure out where to enter the fields in L19. Is it OK that I skipped these steps? Can I add those lines and run those commands later? Please see the attached photo and let me know where I should enter each of the fields.

6. This one is not specific to the desktop install, but, rather, has been present ever since I installed FreeBSD last night. Do you know why my computer's clock is set to UTC, but it shows my timezone (CST) after the UTC time when I first boot up the computer? Shouldn't the time either be my local time or the timezone be UTC? I'm confused with this nomenclature. I believe I set up the computer to check the network time at startup, yet it still seems maybe a minute off. Do you know what's going on with the computer's clock?
 

Attachments

  • fstab.jpg
    fstab.jpg
    106.3 KB · Views: 212
  • kde-is-born.jpg
    kde-is-born.jpg
    68.4 KB · Views: 213
FreeBSD 13.0-RELEASE

# kldload /boot/modules/i915kms.ko

Instead (the full path is superflous):

# kldload i915kms

add two lines to /etc/rc.conf :

For safety, better make it habit to use sysrc(8).

(People sometimes add a line without realising that instead, it's necessary to edit an existing line. And so on.)

say they got /dev/fd in package messages, namely in LibreOffice.

There's no such message.

<https://www.freshports.org/editors/libreoffice/#message>

<https://cgit.freebsd.org/ports/tree/editors/libreoffice>
 
I made my main user part of the operator, wheel, and video groups.

So:

L14. Become the superuser/root account again by running % su

– that's unnecessary, because operators can reboot.

L15. Reboot by running # shutdown -r now

Instead, to avoid loss of history:
  1. exit (repeatedly, if necessary) until the login prompt reappears
  2. If no other user is logged in (at a different tty), Control-Alt-Delete
– alternatively, explicitly save command history before shutdown(8).

Assuming use of a shell that allows saving; <https://forums.freebsd.org/posts/522112>.
 
These four steps:

L3. Enter the easy editor to edit the file /etc/rc.conf by entering the following command: # ee /etc/rc.conf

L4. Once in the easy editor, on a new line, enter the following two lines on separate lines:
Code:
kld_list="/boot/modules/i915kms.ko"
dbus_enable="YES"
L5. Make sure to hit Enter so the file starts on a new line after saving.

L6. Save and exit the easy editor by pushing Esc and following the prompts to save and exit.

– can be condensed to a single line:

sysrc dbus_enable="YES" ; sysrc kld_list+=i915kms

The KMS driver should now be set up.

(For Intel graphics.)
 
Likewise, L2, L9, L17 can be condensed to a single line
pkg install drm-kmod xorg kde5 firefox

I don't want to sound mean but i think 70% of this tutorial is just unecessary information.
Keep it short, keep it simple. No one wants to read an entire book just to install KDE.
 
Something subtle: installing those four packages at once might lead to a long-ish list of post-installation messages, one or more of which might be overlooked.

If there's a separate step for installation of graphics/drm-kmod, then the one and only package message will be more likely to receive attention.

Keep it short, keep it simple.

+1

This topic is, I think, more of a learning journey than the "Best (and Most Correct) Way to Run FreeBSD for Desktop". The journey is a good thing :) the guidance draft instructions will be debatable.
 
Ok, but you can read all the messages afterwards with pkg info -a -D or for a single package with pkg info -D <package>.

Edit:
I would structure the tutorial like this:
  1. Become root
  2. Install necessary packages
  3. Read post-installation messages of packages
  4. Edit /etc/rc.conf to start services on boot
  5. Edit /etc/fstab for additional mount points
  6. Reboot
  7. Edit ~/.xinitrc in order to start KDE on startx
  8. Profit
 
Instead (the full path is superflous):

# kldload i915kms
Thanks; I will think about adding that to the instructions if I make another rough draft.

For safety, better make it habit to use sysrc(8).

(People sometimes add a line without realising that instead, it's necessary to edit an existing line. And so on.)
Thanks; that's good to know. If I make another rough draft, I will add a note about that. I did actually use sycrc in my first rough draft of instructions (post #53). I switched to editing /etc/rc.conf because I thought it provided more understanding of what was going on in the step.

Regarding editing an existing line versus adding a line, I added two new lines without even checking (a mistake). But I take it, in this instance, I was supposed to add two new lines?

I'm not sure what I will mount then, when I figure out how to do that.

Please share your rc.conf and the output from pkg info -x dbus
See the attached photos. I take it you wanted me to run pkg info -x dbus as root?

For screenshots in KDE or Mate, just press the [Print Screen] or [prt sc] key on your keyboard, if your keyboard has such a key. A save screenshot file dialog should pop up immediately.
Thanks; that worked! I've never seen a screenshot program that advanced before.

– that's unnecessary, because operators can reboot.
Thanks. I did not know that.

Instead, to avoid loss of history:
  1. exit (repeatedly, if necessary) until the login prompt reappears
  2. If no other user is logged in (at a different tty), Control-Alt-Delete
– alternatively, explicitly save command history before shutdown(8).

Assuming use of a shell that allows saving; <https://forums.freebsd.org/posts/522112>.
When you say "to avoid loss of history," do you mean to avoid data loss or just to avoid losing a visual record of the previous commands entered?

A related question, what does Control-Alt-Delete do on FreeBSD? Does it work in the command-line interface as well as KDE?

I am using the tcsh shell.

These four steps:



– can be condensed to a single line:

sysrc dbus_enable="YES" ; sysrc kld_list+=i915kms
Thanks. I will think about adding that if I make another rough draft. Would I also be able to run # sysrc dbus_enable="YES" && service dbus start ; sysrc kld_list+=i915kms? Furthermore, how could I add to that command to load the drm driver? In my first set of instructions I use # kldload /boot/modules/i915kms.ko. Would it be something like # sysrc dbus_enable="YES" && service dbus start ; sysrc kld_list+=i915kms && kldload i915kms?

(For Intel graphics.)
Thanks. If I make another rough draft I will specify that in L6.

Likewise, L2, L9, L17 can be condensed to a single line
pkg install drm-kmod xorg kde5 firefox

I don't want to sound mean but i think 70% of this tutorial is just unecessary information.
Keep it short, keep it simple. No one wants to read an entire book just to install KDE.
Earlier versions of my rough draft did have you install drm-kmod and xorg with kde5 and firefox. My discussion with astyle (and possibly other users) made me decide to install all the packages in a particular order.

The instructions are mostly for myself, being a noob. I found that short instructions often left out steps or didn't explain how things worked. With that said, debating the instructions for installing a FreeBSD desktop is what this thread is all about!

This topic is, I think, more of a learning journey than the "Best (and Most Correct) Way to Run FreeBSD for Desktop". The journey is a good thing :) the guidance draft instructions will be debatable.
Agreed. I would never be so bold as to say my instructions are the "Best (and Most Correct) Way to Run FreeBSD for Desktop." They should be approached with healthy skepticism.

Edit:
I would structure the tutorial like this:
  1. Become root
  2. Install necessary packages
  3. Read post-installation messages of packages
  4. Edit /etc/rc.conf to start services on boot
  5. Edit /etc/fstab for additional mount points
  6. Reboot
  7. Edit ~/.xinitrc in order to start KDE on startx
  8. Profit
That's helpful, thanks.

--

If anyone has time, could you please also look over my post-installation questions (post #129)?

Maybe start with figuring out why my system clock is UTC, but the timezone shows as Central U.S. (CST). It looks like I might be able to set the clock in KDE, but, because the problem was there before I installed KDE (and it seems more like a FreeBSD issue), I think it would be better to do a correction in the command line. In another thread on the Forums, a user says to create an empty file for /etc/wall_cmos_clock by running # touch /etc/wall_cmos_clock, but other people suggest doing other methods. Even after reading the man page, I am not sure what the touch command does.
 

Attachments

  • rcconf.jpg
    rcconf.jpg
    99.2 KB · Views: 151
  • pkginfoxdbus.jpg
    pkginfoxdbus.jpg
    92.3 KB · Views: 145
… using the tcsh shell. …

Run a few commands, then close the terminal window (without commanding exit); Alt-F4 should do it. Then in a new terminal window:

history

– the commands will not be there (at the tail of the history).

Having a well-kept history (appropriate use of history -S, exit and Control-D) can help with learning.
 
A related question, what does Control-Alt-Delete do on FreeBSD? Does it work in the command-line interface as well as KDE?
Ctrl-Alt-Del keyboard combination is for rebooting the computer. This key combination works even on FreeBSD, and it doesn't care if you're in a CLI or in KDE - the computer will reboot regardless. I only use that if the rest of the computer becomes visually unresponsive.
 
… it doesn't care if you're in a CLI or in KDE - the computer will reboot …

KDE Plasma

The default for Control-Alt-Delete is log out (a dialogue), not reboot.

My preferences:

1637453865223.png

Defaults:

1637453899771.png

TTY

In plain English: Control-Alt-Delete triggers a graceful/nice reboot.

Semi-technical:

… In chronological order:
  1. <https://cgit.freebsd.org/src/commit...c?id=ad4240fec4feed2dfca1ca0e0bb303eb01aa3a5b> move all functions related to shutting down to one file called kern_shutdown.c …
  2. <https://cgit.freebsd.org/src/commit...c?id=3e755f76d1f51651901d3893554a92b8aa371684> Make it possible to pass boot()'s flags to shutdown_nice() …
  3. <https://cgit.freebsd.org/src/commit/?id=acf0ab0669861bdcef9c49f5ed87ff6c82bd1d1b> init: Only run /etc/rc.shutdown if /etc/rc was run. …
  4. <https://cgit.freebsd.org/src/commit/?id=912d59378b93b34f395d4e7e98078d76ec50005f> Clean up shutdown_nice(). Just send the right signal to init(8). Right now, init(8) cannot distinguish between an ACPI power button press or a Ctrl+Alt+Del sequence on the keyboard. …
kern_shutdown.c « kern « sys - src - FreeBSD source tree <https://cgit.freebsd.org/src/tree/sys/kern/kern_shutdown.c>
 
– the commands will not be there (at the tail of the history).
Did you mean to say the commands will be there? I'm guessing running all these commands as a regular user (not root) works?

Ctrl-Alt-Del keyboard combination is for rebooting the computer. This key combination works even on FreeBSD, and it doesn't care if you're in a CLI or in KDE - the computer will reboot regardless. I only use that if the rest of the computer becomes visually unresponsive.
Thank you. I think grahamperrin corrected you below, so it's my understanding that Ctrl-Alt-Del will do a "graceful" reboot in the command-line interface and log out in KDE.

If anyone has time, looking over and answering my post-installation questions in post #129 would be extremely helpful. Also, answering my questions to (mostly) grahamperrin in post #138 would be helpful.

I still think people should start here:
Maybe start with figuring out why my system clock is UTC, but the timezone shows as Central U.S. (CST). It looks like I might be able to set the clock in KDE, but, because the problem was there before I installed KDE (and it seems more like a FreeBSD issue), I think it would be better to do a correction in the command line. In another thread on the Forums, a user says to create an empty file for /etc/wall_cmos_clock by running # touch /etc/wall_cmos_clock, but other people suggest doing other methods. Even after reading the man page, I am not sure what the touch command does.

I don't know if anyone has ever had the wrong time set on their computer before, but it really detracts from the user experience. My clock is currently +6, so it's quite a bit off. I think I will appreciate my FreeBSD computer much more once I get the correct time set.

I know it's probably bad form to post all these noob questions on the Forums, but I am a new user to FreeBSD and I plan to stay with it for the long haul. Once I get all of these concerns taken care of, I will get back to work learning the OS. I don't want to start any more threads on these questions in the Forums. Ideally, in the future, I will be confident enough to search the Forums for my issues without needing to post new threads. Thanks again.
 
I am not sure what the touch command does.
See the touch(1) manpage or type man touch for the same information in Konsole/XTerm. What touch does is slap the 'Last saved' timestamp onto a file. If you saved a file at 2:32 PM, that will be the 'last saved' timestamp on your file. Or, you can skip opening the file altogether, and type touch myfile instead. If you ran the touch command at 2:32 pm, that will be the 'last saved' timestamp on your file.
But for your issue, I'd suggest looking at date(1) manpage or type man date. If you just run date in a terminal like Konsole, it will show you today's date. But,
Code:
     date 8506131627

sets the date to "June 13,    1985, 4:27 PM".

    date    1432

sets the time to 2:32 PM, without modifying the date.

You do have to be root to modify the system's date.

Oh, I'm not taking you out to movies. Download 'em yourself. ;)
 
See the touch(1) manpage or type man touch for the same information in Konsole/XTerm. What touch does is slap the 'Last saved' timestamp onto a file. If you saved a file at 2:32 PM, that will be the 'last saved' timestamp on your file. Or, you can skip opening the file altogether, and type touch myfile instead. If you ran the touch command at 2:32 pm, that will be the 'last saved' timestamp on your file.
But for your issue, I'd suggest looking at date(1) manpage or type man date. If you just run date in a terminal like Konsole, it will show you today's date. But,


You do have to be root to modify the system's date.

Oh, I'm not taking you out to movies. Download 'em yourself. ;)
Thanks for the explanation of touch(1). It's my understanding the command touch will also create a file if the file doesn't exist, which I think might be needed in my case.

I think what you're suggesting is post #3 from this thread I linked to: <https://forums.freebsd.org/threads/utc-time-setting.9254/>. However, what I was asking about, from post #2, seems to have more reactions, so I'm wondering if that's a better method.

Thanks for specifying to run date as root. Because the date is correct, I take it I should just make sure to use that method (of setting the time only) when the correct date is showing.

A related question: Do you know why my clock runs about a minute slow? I enabled the ntpd system service when I installed FreeBSD, so I thought that would automatically set the correct time at boot.
 
Back
Top