Logged-In As
ACCOUNT
Not Logged In
Describe what a NetBSD installation does The NetBSD Project
Status: Closed Time to complete: 96 hrs Mentors: Aleksej Saushev, Jeff Rizzo, Julian Fagir, Julian Coleman Tags: howto, system, C

NetBSD has an installer called sysinst. But for several cases installations are not run from a system with a direct interface, but rather something else where you don't have sysinst available. Imagine an installation in a chroot environment, an automated installation, with another interface (e.g. ssh), etc.


For all these issues, it is necessary to know what a NetBSD installation exactly does. You have to look at the code of sysinst and document what it does in which step, and what is necessary to get a system running.

Our preferred format for the submission is some form of plain text, as that is most portable and can be read anywhere.  If you want to use a word processor, please export the file as text.  You could also add something like markdown or latex to add structure (these are both plain text based), but that is not a requirement.

There has been a discussion on a mailing-list about this: http://mail-index.netbsd.org/tech-install/2012/10/21/msg000345.html 

Aleksej Saushev created a script for this. You mainly have to read the script, compare the results against what you read in sysinst, and then elaborate what the script does. You should make clean the steps it takes and why it takes them. 

Uploaded Work
File name/URL File size Date submitted
inst-v1.markdown 7.4 KB January 12 2013 10:56 UTC
inst-v2.markdown 7.9 KB January 12 2013 15:55 UTC
inst-v2-fix.markdown 7.8 KB January 12 2013 16:05 UTC
inst-v3.markdown 8.2 KB January 13 2013 03:36 UTC
inst-v3-script.markdown 953 bytes January 13 2013 03:37 UTC
inst-v4.markdown 9.1 KB January 13 2013 09:33 UTC
inst-v5.markdown 9.2 KB January 13 2013 10:36 UTC
inst-v6.markdown 9.2 KB January 13 2013 12:06 UTC
Comments
wmzhere on January 11 2013 12:08 UTC Task Claimed

I would like to work on this task.

Julian Fagir on January 11 2013 12:14 UTC Task Assigned

This task has been assigned to wmzhere. You have 96 hours to complete this task, good luck!

wmzhere on January 12 2013 05:15 UTC Problem

Hi, 


I'm trying to install BSD disk labels and errors occur. I used "disklabel" to partition the disk, and I entered "W" to write the partition table. But "disklabel" doesn't save the table.


Could you help me?


 


Here's the output:


 


 


NetBSD# disklabel -i sd0


Enter '?' for help


partition> a


Filesystem type [?] [4.2BSD]: 


Start offset ('x' to start after partition 'x') [0.007843137254901960675468330919102299958467c, 64s, 0.03125M]: 


Partition size ('$' for all remaining) [954.7215686274510062503395602107048034668c, 7790528s, 3803.96875M]: 1024M


 a:   2097152        64     4.2BSD      0     0     0  # (Cyl.      0*-    257*)


partition> b


Filesystem type [?] [swap]: 


Start offset ('x' to start after partition 'x') [954.7294117647059010778320953249931335449c, 7790592s, 3804M]: a


Partition size ('$' for all remaining) [4.015686274509803865839785430580377578735c, 32768s, 16M]: $


 b:   5726144   2097216       swap                     # (Cyl.    257*-    958*)


partition> W


Label disk [n]? 


partition> P


4 partitions:


#        size    offset     fstype [fsize bsize cpg/sgs]


 a:   2097152        64     4.2BSD      0     0     0  # (Cyl.      0*-    257*)


 b:   5726144   2097216       swap                     # (Cyl.    257*-    958*)


 c:   7823296        64     unused      0     0        # (Cyl.      0*-    958*)


 d:   7823360         0     unused      0     0        # (Cyl.      0 -    958*)


partition> Q


NetBSD# disklabel -i sd0


Enter '?' for help


partition> P


4 partitions:


#        size    offset     fstype [fsize bsize cpg/sgs]


 a:   7790528        64     4.2BSD      0     0     0  # (Cyl.      0*-    954*)


 b:     32768   7790592       swap                     # (Cyl.    954*-    958*)


 c:   7823296        64     unused      0     0        # (Cyl.      0*-    958*)


 d:   7823360         0     unused      0     0        # (Cyl.      0 -    958*)


 

wmzhere on January 12 2013 07:03 UTC Solved

Hi, 


Hmm... I should answer "y" to "Label disk [n]? ". However, the description is a bit confusing after all.


I shouldn't have posted this silly question. I'm sorry.

wmzhere on January 12 2013 10:56 UTC Ready for review

The work on this task is ready to be reviewed.

Aleksej Saushev on January 12 2013 12:29 UTC Review

1. "When there is no sufficient memory, NetBSD would kill the program trying to allocate memory."


This is wrong. NetBSD is not linux.


2. It would be nice to provide some summary why such unusual tar flags are used ("xzphef").


Also, it would be nice not to use obsolete tar syntax for flags. Please, prepend them with dash ("-xz...").


3. "Install bootstrapper for PBR". You must mean "boot loader".


4. "If your current directory is inside `/inst`, unmounting will fail because there are files in use."


This is confusing. A user may wonder which files are in use and find that there're none in fact.


The problem is that any process effectively holds its current working directory (CWD) open. You can easily see it in the output of "fstat" command.


5. On fstab and MAKEDEV. You asked the question on IRC, and here's the answer.


No, I didn't forget them. I left them out on purpose.


Running MAKEDEV is not needed, see init(8).


fstab issue is trickier. The main reason why I don't generate fstab is that you don't know the name of boot device exactly. It may be "wd0" or "sd0" depending on the nature of device. Or it may be "wd3" depending on how you plugged your HDD in. Still the system boots and mounts its root file system (perhaps even swap but I'm not sure about default stock NetBSD, someone should test it).

Aleksej Saushev on January 12 2013 12:29 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

wmzhere on January 12 2013 15:55 UTC Ready for review

The work on this task is ready to be reviewed.

Aleksej Saushev on January 12 2013 19:02 UTC Review

1. If you boot into new installation without fstab, you get read-only root file system. And you definitly don't have /inst anymore. Perhaps you should adapt instruction to address this. At least by mentioning that this is the way to detect how boot device is called. Or instruct how to mount file system so that fstab can be written.


2. While you're there, it would be nicer to use sysctl instead of dmesg.


3. While you're there, it would be nice to explain how "silent" disklabel generation works. (This is useful since it has application in backup and [so-called "bare iron"] recovery plans).

Aleksej Saushev on January 12 2013 19:02 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

Aleksej Saushev on January 12 2013 20:47 UTC Unaddressed issues

"When there are no sufficient memory, the mapping process will fail, and NetBSD will simply kill the process."


Arbitrary process doesn't fail when there's insufficient memory. Some processes launch garbage collection, others reduce cache sizes, and thus don't fail. NetBSD is not linux, it doesn't kill random processes to make more space available.

wmzhere on January 13 2013 03:42 UTC Re: Review

Hi, 


Thank you for your suggestions. However, there are still doubts about memory and the script.


I read document about UVM(http://www.netbsd.org/docs/kernel/uvm.html), this description and yours are different.


How does UVM handle running out of memory? (top)


UVM uses lazy allocation. This means programs can overallocate virtual memory. When UVM detects an out of VM completely condition and a lazy allocated bit of memory is accessed, the offending process will be KILLed and the system will continue. There is also a small buffer of reserve pages only for use by the paging system, which allows the pagedaemon to run comfortably when there is otherwise no free ram. Most of this work was done by Chuck Silvers.


As for the script, I modified "/etc/rc.d/root", and it mounts rootfs correctly, but the system still doesn't boot normally. Several services are not started and it dosen't boot into multi-user mode.


 

wmzhere on January 13 2013 03:42 UTC Ready for review

The work on this task is ready to be reviewed.

Aleksej Saushev on January 13 2013 08:54 UTC Review

The following issue is still unaddressed:


"The memory manager doesn't actually allocate memory when a program requests. Only when the program tries to access the memory does the memory manager map the page to RAM. When there are no sufficient memory, the mapping process will fail, and NetBSD will simply kill the process."


NetBSD is NOT linux, it doesn't kill processes randomly.


You're trying to prove your point by referencing documentation, but have you checked when that moment happens? Or whether the documentation reflects reality at all? In reality, I ran NetBSD with all swap space used up, when it was grinding disk for hours (or even days) with no process killed. This is the situation when linux "simply" kills random processes as you describe it.


Please, remove this part. It is not true, or it is highly dubious at the very least. What is more important is that it isn't essential here.


 


"#NetBSD sysctl -n kern.root_device"


I suggest that you change prompt to look closer to what user will see in this case. It is more like "# ", without "NetBSD" part.


 


"#NetBSD mount -rw /dev/wd0a /"


Options "r" and "w" conflict, don't they? Why are you using both?


 


"PATHa        /    ffs    rw,log         1 1"


I suggest to follow common practice and use "@PATH@" to mark substituded parts.


 


"Several services are not started and it dosen't boot into multi-user mode."


You haven't configured rc to enter multi-user mode. At least you don't mention it in the documentation. You can check rc.conf on working system and see how it is done.

Aleksej Saushev on January 13 2013 08:54 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

wmzhere on January 13 2013 09:33 UTC Ready for review

The work on this task is ready to be reviewed.

Aleksej Saushev on January 13 2013 09:49 UTC Review

Please, use "chmod a=rx" instead of cryptic "555". See chmod(1).


 


<<sed -ne "s/^@PATH@/\/dev\/$BOOTDEV/;p;">>


Please, drop "-n" flag instead of printing lines explicitly.


Use another delimiter so that you don't need to escape slashes, e.g. "s:/this:/that:"

Aleksej Saushev on January 13 2013 09:50 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

wmzhere on January 13 2013 10:36 UTC Ready for review

The work on this task is ready to be reviewed.

Aleksej Saushev on January 13 2013 12:07 UTC Task Closed

Congratulations, this task has been completed successfully.