# Is single user mode still required when installing world?



## octix (May 1, 2020)

Hello again,

The official handbook does not mention single user mode (anymore?), however `/usr/src/UPDATING` contains below steps.


```
<make sure you have good level 0 dumps>
    make buildworld
    make buildkernel KERNCONF=YOUR_KERNEL_HERE
    make installkernel KERNCONF=YOUR_KERNEL_HERE
                            [1]
    <reboot in single user>                [3]
    mergemaster -Fp                    [5]
    make installworld
    mergemaster -Fi                    [4]
    make delete-old                    [6]
    <reboot>
```

Also, according to Michael W. Lucas we should use single user mode.

Which source to trust? I did install a few times now in multi user mode, but this doesn't help too much. I tried install world in single mode and it failed for me (I ran only `zfs mount -a`).

Handbook: https://www.freebsd.org/doc/en/books/handbook/makeworld.html

Thank you in advance.


----------



## D-FENS (May 1, 2020)

I can only share my (failed) experience. I have been building the kernel successfully in normal mode, but then when trying to build world in normal mode it always failed.
To be honest, I never dug into it and tried single user mode. I just switched to binary packages and freebsd-update because building the ports took forever even on my 16 core Threadripper. Since then I build only kernel and the rest I update binarily, it's fast and works great.


----------



## zirias@ (May 1, 2020)

Single-user mode makes sure nobody uses the machine, so that's the "safest" option. Of course you still need to make sure your system filesystem is writable, which isn't the default in single-user mode -- on ZFS, do `zfs set readonly=false zroot` (assuming your root pool is named zroot) for that.

That said, I never used single-user mode for updates. The risk is pretty small -- it's very unlikely to affect running processes. It could affect the sessions of users that are logged in, temporarily behaving erroneously. Of course, if you have a busy system with many users, you should opt for booting to single-user, after sending out notice about maintenance downtime


----------



## octix (May 1, 2020)

roccobaroccoSC said:


> I can only share my (failed) experience. I have been building the kernel successfully in normal mode, but then when trying to build world in normal mode it always failed.
> To be honest, I never dug into it and tried single user mode. I just switched to binary packages and freebsd-update because building the ports took forever even on my 16 core Threadripper. Since then I build only kernel and the rest I update binarily, it's fast and works great.


Building ports? I don't think building world rebuilds the ports too. In any case, I tried yesterday and it took ~35min.  That said, I do upgrade packages through `pkg upgrade` with  `latest` instead of `quarterly`, although I am trying to keep the host with minimal installed packages and use jails for anything extra (e.g. a samba machine). Thanks for sharing.



Zirias said:


> Single-user mode makes sure nobody uses the machine, so that's the "safest" option. Of course you still need to make sure your system filesystem is writable, which isn't the default in single-user mode -- on ZFS, do `zfs set readonly=false zroot` (assuming your root pool is named zroot) for that.
> 
> That said, I never used single-user mode for updates. The risk is pretty small -- it's very unlikely to affect running processes. It could affect the sessions of users that are logged in, temporarily behaving erroneously. Of course, if you have a busy system with many users, you should opt for booting to single-user, after sending out notice about maintenance downtime


I thought I am missing something. I found that later (`readonly=false`), but was not sure if it's enough. I will try next time. Thanks.

Btw, according to the Absolute FreeBSD book, single-user is a  must


> You can have conflicts where vital programs won’t run when installed in multiuser mode. This is rare, but if it happens with _/bin/sh_, you’re in a world of hurt.
> ...
> Running in multiuser mode can cause other upgrade problems, such as subtle races, symbol issues, and innumerable other headaches.
> ...
> ...


----------



## SirDice (May 1, 2020)

There's only been one upgrade when you really needed to boot the new kernel first before installing world. This was when FreeBSD 5.0 was released and FreeBSD switched to UFS2. That's the only time when it was absolutely necessary or you ended up with a completely broken system. Since then I never reboot, only when I was completely done at the end of the upgrade/update procedure. Never had any problems with that. The handbook just gives you the absolute _safest_ way to do it.


----------



## octix (May 1, 2020)

SirDice said:


> There's only been one upgrade when you really needed to boot the new kernel first before installing world. This was when FreeBSD 5.0 was released and FreeBSD switched to UFS2. That's the only time when it was absolutely necessary or you ended up with a completely broken system. Since then I never reboot, only when I was completely done at the end of the upgrade/update procedure. Never had any problems with that. The handbook just gives you the absolute _safest_ way to do it.



So you are saying I could just do `cd /usr/src  && make update && make buildworld && make kernel && make installworld && mergemaster -Fi` ?


----------



## Alain De Vos (May 1, 2020)

Once I got a kernel crash when updating world in multi-user user. Since then I always go to single user, init 1


----------



## pboehmer (May 1, 2020)

We've been running FreeBSD since version 2.8.  Our standard procedure over the years has been to install world in single user mode when doing major version upgrades (11.3->12.1) and stay in multi-user mode on minor version upgrades (11.2->11.3).  The only exception to this procedure, as SirDice noted above, was the 5.x release cycle.


----------



## SirDice (May 1, 2020)

octix said:


> So you are saying I could just do  cd /usr/src && make update && make buildworld && make kernel && make installworld && mergemaster -Fi ?


I normally use `mergemaster -U`, but yes, that's what I do and have been doing since I started with FreeBSD (around the 3.0 era). This only bit me once, during the aformentioned upgrade to FreeBSD 5.0. I screwed that one up because I read /usr/src/UPDATING _after_ the upgrade utterly failed on me. So, make sure to read /usr/src/UPDATING _before_ you attempt to upgrade.


----------



## octix (May 1, 2020)

Very cool. Thank you all for sharing.


----------

