1

I followed this tutorial to install FreeBSD 10.1 and at the step where it says "Add the following lines to /etc/rc.conf" I must to add the following lines in there:

hald_enable="YES" dbus_enable="YES" performance_cx_lowest="Cmax" economy_cx_lowest="Cmax" 

But I'm new in Unix and I don't know how to add these lines in /etc/rc.conf, I tried with cd but it says Too much arguments. How can I add these lines in the /etc/rc.conf?

EDIT: I didn't installed yet a desktop environment.

2
  • 2
    I need to ask: What made you try cd? Commented Nov 16, 2014 at 18:42
  • 2
    That was the first thing that came in my head. Commented Nov 16, 2014 at 18:57

3 Answers 3

6

There is a dedicated utility called sysrc, which should be already installed on your FreeBSD. For example:

sysrc hald_enable=YES 

Here's a one-liner:

sysrc hald_enable=YES dbus_enable=YES performance_cx_lowest="Cmax" economy_cx_lowest="Cmax" 

See man 8 sysrc for more details.

Alternatively, for services one can use service(8) to enable a service on FreeBSD 13.0 or later:

service sshd enable 

See rc.subr(8) on your system to figure out if the enable command is supported by services on your system.

1
  • This should be the right answer. Editing files by hand is evil. It's error prone, it's not script-friendly, and scripting may not achieve the same idempotence. Commented Dec 8, 2017 at 19:02
3

You need to learn some sort of text editor. There are several available for FreeBSD like nano, ed, vi, emacs, and many others. I don't want to start a flame war so I'll encourage you to learn them on your own.

If you want to get the really quick and dirty way to acomplish what your asking try:

cat >> /etc/rc.conf << "EOF" dbus_enable="YES" performance_cx_lowest="Cmax" economy_cx_lowest="Cmax" EOF 
4
  • 1
    That's complicated for a beginner. You can do echo 'hald_enable="YES"' >> file to append a line to a file. And I fully agree: you need to learn how to use an editor. Commented Nov 16, 2014 at 18:41
  • @Marki oops...forgot to change it back to /etc/rc.conf Now the asker just needs to copy and paste as root. Commented Nov 16, 2014 at 18:46
  • There is an easy editor on FreeBSD called ee. Commented Sep 17, 2017 at 21:33
  • Regarding the ee editor… Described in the Handbook. See man page. Commented Nov 25, 2018 at 7:41
1

A simple way would be..

echo "hald_enable="YES" dbus_enable="YES" performance_cx_lowest="Cmax" economy_cx_lowest="Cmax"" >> /etc/rc.conf 
3
  • You have to use single quotes around expression, that contains double quotes. Commented Nov 16, 2014 at 21:30
  • Nope, tried it myself. Commented Nov 16, 2014 at 21:39
  • 1
    And did the result contain the double quotes as specified in the question? Commented Nov 16, 2014 at 21:53

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.