# What Services Should I Enable for a Laptop?



## Scribner (Feb 16, 2019)

For the System Configuration, if I'm using a laptop, which system services should I enable that will be started whenever the system boots? I really only need to know about moused and powerd. In the book _Absolute FreeBSD, 3rd Edition_, the author writes, "Laptop users might investigate moused(8) and powerd(8)." For those interested, the author always leaves on dumpdev, ntpd, and local_unbound; I _think_ he also leaves on sshd. See also: 2.8.4. Enabling Services in the FreeBSD Handbook.


----------



## Deleted member 30996 (Feb 16, 2019)

This should give you some idea as to what system and security files you need to edit and what services to enable in /etc/rc.conf:









						Beginners Guide - How To Set Up A FreeBSD Desktop From Scratch
					

I'm going to guide you though the process of getting a fully functional FreeBSD 13.0-RELEASE desktop up and running, complete with system files and security settings, step-by-step as if you've never used UNIX or the command line. Now let's get started:  Insert your boot media and at the Welcome...




					forums.freebsd.org
				




I don't allow myself remote access so thre's no need for SSH to be enabled on my machines. I also set several services so they can't start like telnet, rlogin, portmap, etc.


----------



## Scribner (Feb 16, 2019)

I'm thinking about just leaving everything checked. Could that cause any problems?

For those following my threads on the FreeBSD Forums, I thank you all! I'm grateful for all the help I've received here and -- I must be honest -- am excited to (potentially) join this small but dedicated cohort of COOL people. With that said, I will probably now begin the installation process next Friday. I know I'm inevitably going to make some mistakes, but I want the installation to be as perfect as possible. Thanks, also, to the mods and admins for not censoring me. I will try to be discriminating in the threads I post!


----------



## Deleted member 30996 (Feb 16, 2019)

Scribner said:


> I'm thinking about just leaving everything checked. Could that cause any problems?



If you stick to that outline it should give you a good starting point to work from. It shows the procedure for 11.2  and 12.

But, yes. If you start enabling things you're not exactly sure at this point are responsible for doing or tweaking variables you're likely to run into problems you can't yet solve yourself.


----------



## Scribner (Feb 16, 2019)

Trihexagonal said:


> But, yes. If you start enabling things you're not exactly sure at this point are responsible for doing or tweaking variables you're likely to run into problems you can't yet solve yourself.


I agree with that principle in general, but I thought checking all the boxes might be the thing to do in this particular case. Michael W. Lucas (the author of the aforementioned book) checked every option but moused and powerd and indicated those other two options might be useful to laptop users, though he did not say why.


----------



## twllnbrck (Feb 16, 2019)

Scribner said:


> Michael W. Lucas (the author of the aforementioned book) checked every option but moused and powerd and indicated those other two options might be useful to laptop users, though he did not say why.



You can use powerd(8) daemon for CPU scaling which is advisable for laptops. But I prefer sysutils/powerdxx package on multicore systems but this is a matter of preference.
You can enable moused(8) for using the mouse in the console. In X11 the mouse should work out of the box or you can configure it in the appropriate section of your Xorg configuration.


----------



## Deleted member 30996 (Feb 16, 2019)

Scribner said:


> I agree with that principle in general, but I thought checking all the boxes might be the thing to do in this particular case. Michael W. Lucas (the author of the aforementioned book) checked every option but moused and powerd and indicated those other two options might be useful to laptop users, though he did not say why.



With all due respect, exactly what are these boxes you're talking about checking?

I edit text files on the 8 laptops I own running FreeBSD and OpenBSD. Assuming you're past the install process, which I do outline from building the base system to booting to a x11-wm/fluxbox desktop.

The settings outlined are how I set up my laptops. That doesn't mean it has to be done that way. Not everyone sets their machines up exactly the same as I do, far from it, and you're free to experiment with different settings as you see fit. That's the beauty of it.

Personally, I would concentrate on the FreeBSD Handbook. If you run into problems you're going to be expected to do your homework before asking questions and that's more likely where you'll find the answers than aforementioned tome.


----------



## twllnbrck (Feb 16, 2019)

Trihexagonal said:


> With all due respect, exactly what are these boxes you're talking about checking?


I think Scribner considered the checkpoints in the installer where you can choose the services (local_unbound, moused etc) you would like to be started at boot.


----------



## SirDice (Feb 18, 2019)

Enabling moused(8) is only for PS/2 mice. For USB mice it doesn't need to be enabled, it's automatically loaded via devd(8).


----------



## ekingston (Feb 19, 2019)

With regards to that guide, I think it has some outdated suggestions despite mentioning FreeBSD 12.

1) I was under the impression that hald is deprecated and rarely needed anymore.

2) You are suggesting compiling the kernel and X11 and a lot of other large programs that are available in pre-built binary packages. While I did see suggested changes to the kernel config, this approach is going to make keeping the laptop up-to-date much more difficult and time consuming as you have to re-compile the kernel (and applications) every time you want to apply updates.

3) I didn't see mention of drm-fbsd*-kmod. These are kind of important for accelerated graphics on modern laptops. Did I just miss it?

4) Only one window manager and no mention of desktop environments? I understand the choice of building your own work environment but most people looking to build a laptop probably want a more fully functional environment out of the box. At least mentioning the more reliable desktop environments is probably a good idea.



Trihexagonal said:


> This should give you some idea as to what system and security files you need to edit and what services to enable in /etc/rc.conf:
> 
> 
> 
> ...


----------



## tommiie (Feb 19, 2019)

SirDice said:


> Enabling moused(8) is only for PS/2 mice. For USB mice it doesn't need to be enabled, it's automatically loaded via devd(8).


Too bad Michael W. Lucas failed to mention that.


----------



## ekingston (Feb 19, 2019)

SirDice said:


> Enabling moused(8) is only for PS/2 mice. For USB mice it doesn't need to be enabled, it's automatically loaded via devd(8).



It also might be a good idea to mention how to get better touchpad functionality on a modern laptop:



			SynapticsTouchpad - FreeBSD Wiki


----------



## Deleted member 30996 (Feb 19, 2019)

ekingston said:


> With regards to that guide, I think it has some outdated suggestions despite mentioning FreeBSD 12.
> 
> 1) I was under the impression that hald is deprecated and rarely needed anymore.
> 
> ...



1. You were mistaken. One of the programs I use has sysutils/hal as a dependency or I wouldn't have it installed.

2. Please provide a quote where I suggest compiling a custom kernel. I outline the default installation process and suggest Hardening Options available during the build process. I use ports in the tutorial, the option is yours to use pkg but you will need to read the Handbook. I'm always open to constructive criticism as long as you have your facts straight.

3. All my laptops are from the Vista or Win7 era. Consult the Handbook if you have questions about your card.

4. If they're looking for a  "fully functional environment out of the box" they're looking in the wrong place. Try TrueOS, Trident or whatever they're calling it this week. 

I outline how I set up my desktops and I only use x11-wm-fluxbox. My goal is to get them to a fully functional FreeBSD desktop. They can take it from there if they want to use something like x11/kde5 and consult the Handbook as is expected.


----------



## ekingston (Feb 19, 2019)

Trihexagonal said:


> 1. You were mistaken. One of the programs I use has sysutils/hal as a dependency or I wouldn't have it installed.



I am still pretty sure that hal has been deprecated, BUT if something you are suggesting needs it, then yes it should be in the instructions.



Trihexagonal said:


> 2. Please provide a quote where I suggest compiling a custom kernel. I outline the default installation process and suggest Hardening Options available during the build process. I use ports in the tutorial, the option is yours to use pkg but you will need to read the Handbook. I'm always open to constructive criticism as long as you have your facts straight.



Is this not for compiling a kernel to change defaults?:



Trihexagonal said:


> In FreeBSD 12.0-RELEASE there is a System Hardening screen that expands on that of 11.0-RELEASE. Check the following boxes to enable the options:
> 
> ```
> Disable reading kernel message buffer for unprivledged users
> ...



If those code snippets aren't related to compiling the kernel, what files do I paste that in to?



Trihexagonal said:


> 3. All my laptops are from the Vista or Win7 era. Consult the Handbook if you have questions about your card.



Then perhaps you should stop point new people to a tutorial for 10 year old computers when they ask about how to install FreeBSD on a laptop in 2018? Most beginners are probably not thinking of a computer that old.



Trihexagonal said:


> 4. If they're looking for a  "fully functional environment out of the box" they're looking in the wrong place. Try TrueOS, Trident or whatever they're calling it this week.



Then perhaps you should make that clear at the beginning of your "beginner's guide" as most beginners are going to want something that simple.



Trihexagonal said:


> I outline how I set up my desktops and I only use x11-wm-fluxbox. My goal is to get them to a fully functional FreeBSD desktop. They can take it from there if they want to use something like x11/kde5 and consult the Handbook as is expected.



Then maybe you shouldn't call it a beginner's guide but a "how I do it" guide?

Not telling people the easy way (packages) because you prefer to do it the more flexible way probably doesn't belong in something called a "Beginner's guide".

You have a lot of knowledge and can be very helpful. I just wish you would think beyond how you do things when you claim something is for beginners.


----------



## Vull (Feb 19, 2019)

HAL has been deprecated for several years, but there are a lot of backwards compatibility problems with removing it completely. As I understand it, the Xorg programmers have been working on the problem for years, and also exceeding their time estimates for eliminating it astronomically, for years. KDE/plasma5-plasma still requires it also, and the folks there have also been working on it for years. KDE requires it because xf86-input-evdev requires it, because it's a webcamd dependency. The problem is as immense and complicated as HAL is immense and complicated, but it's being steadily addressed, and will probably go away sometime fairly soon, or at least in the foreseeable future. HAL I'm guessing will probably need to be eliminated before they can even get close to their goal of replacing X11 completely, if indeed that ever happens, and that particular project has also been going on for years, and exceeding its time estimates, well, let me say considerably, if not in fact astronomically, because it ain't likely be over until if and when the big gal sings.

I wrote an easy guide for installing kde5 from packages once, on this forum, but the thread seems to have been deleted by the user who started the thread, who also seems to have disappeared. Most desktop environments that I've tried here are very similar to install. I'll try to post an easy guide like you describe tonight or tomorrow morning when I have a little more time, if someone else doesn't beat me to it. It won't be nearly so comprehensive and long as Trihexagonal's guide though, which is excellent.


----------



## Deleted member 30996 (Feb 20, 2019)

ekingston said:


> I am still pretty sure that hal has been deprecated, BUT if something you are suggesting needs it, then yes it should be in the instructions.



How gracious of you.




ekingston said:


> Is this not for compiling a kernel to change defaults?:
> 
> If those code snippets aren't related to compiling the kernel, what files do I paste that in to?



You obviously don't know the first thing about installing FreeBSD from scratch and your reading comprehension leaves something to be desired.

They aren't pasted into anything, they are options you can choose during the default build process. If you had _ever set up FreeBSD 12 yourself_ you would know that.




ekingston said:


> Then perhaps you should stop point new people to a tutorial for 10 year old computers when they ask about how to install FreeBSD on a laptop in 2018? Most beginners are probably not thinking of a computer that old.



Perhaps you better know a little more of what you're talking about before you question my methods. Thinkpads from that time period are very popular with FreeBSD users.




ekingston said:


> Then perhaps you should make that clear at the beginning of your "beginner's guide" as most beginners are going to want something that simple.



If it's simple you want then FreeBSD just isn't for you. Sorry to be the one to have to break it to you...

There are plenty of guides out there that use pkg. In fact, to the best of my knowledge, I'm the only person who uses ports in their tutorial. I recommend you check out the tutorials authored by vermaden, he has several nice ones.




ekingston said:


> Then maybe you shouldn't call it a beginner's guide but a "how I do it" guide?



It's clearly a Beginners Guide as it's targeted for someone who has never used a terminal.




ekingston said:


> Not telling people the easy way (packages) because you prefer to do it the more flexible way probably doesn't belong in something called a "Beginner's guide".



I taught myself to use ports and is what I've used exclusively the last 14 years. It was an invaluable learning experience for me and a skill everyone should be fluent in IMO.

Try reading more slowly. I do give the reader the option to use pkg, explain the pros and cons of each and refer them to the Handbook if they choose to use pkg.



> You have the option of building programs from source though ports or using pre-compiled binary packages through the pkg system. Using pkg is much faster, but by using ports you can choose your own program options and it's the way I've always done it so that's what we'll use in this tutorial.
> 
> Ports are also updated more often than packages. Therefore, it will be easier to keep your 3rd party software up to date when new vulnerabilities are discovered, and by starting out using ports you'll get a feel for compiling programs and gain more CLI time for experience purposes in the process.
> 
> I recommend not to mix ports and packages, so once you start using ports stay with it. After you gain some experience you may want to rebuild your system and switch from ports to packages. If you'd rather start using the pkg system consult the FreeBSD Handbook.






ekingston said:


> You have a lot of knowledge and can be very helpful.



Opinions vary greatly and run the full spectrum as evidenced earlier today in another thread.




ekingston said:


> I just wish you would think beyond how you do things when you claim something is for beginners.



I'll keep that in mind. Right now I have #1 google ranking on a search for "FreeBSD desktop tutorial" and with the exception of a few people most I've had contact with over the last couple years have managed to successfully set up a FreeBSD desktop using it.


Now that you have an idea what you'd like to see in a Beginners Tutorial, I invite you to write one of your own. Who knows, in a year or so you may rise to the top to take my place on a google search just like I did if you work at it.


----------



## Vull (Feb 20, 2019)

To install kde5 using packages, login as root and enter the following commands:

`cp -p /etc/rc.conf /root/copy_of_rc.conf`
`cp -p /etc/fstab /root/copy_of_fstab`
`cp -p /etc/sysctl.conf /root/copy_of_sysctl.conf`

`pkg install xorg kde5 sddm`

`sysrc dbus_enable="YES"`
`sysrc sddm_enable="YES"`

`echo 'proc            /proc           procfs  rw      0       0' >> /etc/fstab`

`echo 'net.local.stream.recvspace=65536' >> /etc/sysctl.conf`
`echo 'net.local.stream.sendspace=65536' >> /etc/sysctl.conf`

`shutdown -r now`


Obviously you will first need to install FreeBSD and bring it up to date using `freebsd-update`. Consult the FreeBSD handbook for further information if you need any help with that.
Before making changes, create backup copies of system-critical files, as shown above, just in case something goes wrong. You can never be too safe.
When you enter the `pkg install` command, the system will report what it's about to do and ask for confirmation from you before making any changes. Press the "y" key for a "yes" response, and then press the ENTER key to install the packages.
When you reboot the system with the `shutdown -r now` command, a graphical login screen should appear after the reboot. Login using your non-root user name and password. Don't login to your graphical desktop as root, or do so only at your own risk, because it's almost certain to mess things up.
Optionally, you can enable HAL (Hardware Abstraction Layer) to assist with the automatic mounting of USB drives, by logging in as root and entering the command: `sysrc hald_enable="YES"`. Alternatively, if you're concerned about HAL being deprecated, you can install sysutils/automount. To install sysutils/automount for FreeBSD 11.2-RELEASE, it should be sufficient to login as root and enter the command `pkg install automount`. For FreeBSD 12.0-RELEASE, however, you'll need a newer copy of the automount port, such as version 1.6.0 or version 1.6.1. To do so, download the version you want and follow the installation instructions in this link: https://github.com/vermaden/automount
Edited, based on SirDice's advice below, to remove the following two commands which should no longer be needed:
	
	



```
cp -p /boot/loader.conf /root/copy_of_loader.conf
echo 'kern.maxfiles="25000"' >> /boot/loader.conf
```


----------



## SirDice (Feb 20, 2019)

Vull said:


> ```
> echo 'kern.maxfiles="25000"' >> /boot/loader.conf
> ```


I've seen this being suggested in some pkg-message but I doubt this is actually needed any more. The default is already set ten times higher than that. At least on a few of my systems. Looking a little further I see different systems giving me different values (but all of them much larger than 25000). I suspect this is set dynamically based on a couple of factors. So check this before setting it as you're likely to actually lower the value instead of increasing it.


```
dice@maelcum:~ % sysctl kern.maxfiles
kern.maxfiles: 120308
dice@molly:~ % sysctl kern.maxfiles
kern.maxfiles: 519536
```


----------



## Vull (Feb 20, 2019)

SirDice said:


> I've seen this being suggested in some pkg-message but I doubt this is actually needed any more. The default is already set ten times higher than that. At least on a few of my systems. Looking a little further I see different systems giving me different values (but all of them much larger than 25000). I suspect this is set dynamically based on a couple of factors. So check this before setting it as you're likely to actually lower the value instead of increasing it.
> 
> 
> ```
> ...


Ha! Thanks, I didn't know that, and it's good to know, but for my purposes 25000 is still probably more than enough, and if there happened to be any chance that it would make any difference in resource usage, I might actually do well to decrease it even further, as I'm always looking for ways to decrease the resource usage of KDE. I like KDE a lot overall, but it has a lot of features I don't need or want, and for some time now I've been running it on a system with fairly meager resources-- 32-bit Intel with only 3 GB RAM on an old model Dell Dimension 4700. So on this machine I'm now running plasma5-plasma instead, and in fact it was you who first brought the plasma5-plasma alternative to my attention in another post some time back. So thanks again!


----------



## SirDice (Feb 20, 2019)

Dug around a little further, maxfiles is dynamically set nowadays based on 1/12th of the number of memory "pages". So it's automatically adjusted depending on the amount of memory a machine has. 

Lines 270-280: https://svnweb.freebsd.org/base/releng/12.0/sys/kern/subr_param.c?revision=340470&view=markup


----------



## Vull (Feb 20, 2019)

So since I have 3GB RAM I would have had maxfiles = 65536 before I changed it.  I think I'll stick with the 25000 but of course other readers of this guide might feel differently about it.

Edit: Gave it some more thought, and since it's part of the base system rather than KDE it could affect the performance of postgresql, php, and who knows what else. So I'm taking it out of my own system and also out of post #17 above.


----------

