---
# System prepended metadata

title: The experience about installing nachos 4.0

---

# The experience about installing nachos 4.0

Author: [Huang, Han-Xuan.](https://github.com/ntut-xuan)

I still have interested about how to solve the issue when using `nachos-4.0_MP4_clean.tar`.

This note will be updated when I found how to solve the issue with `nachos-4.0_MP4_clean.tar`.

## The issue of trying use nachos-4.0_MP4_clean.tar

### Description issue

 - [x] OS Installation
 - [x] Compile Nachos 4.0
 - [x] Compile halt
 - [ ] Execute halt

The last step (execute halt) will cause the issue that show "Unable to open halt" since the Nachos 4.0 and halt compiled successfully.

I also notice that when compile nachos and compile halt will cause lot of warning.

Since I doubt that the architecture, linux release, or the CPU will cause this issue, we already tried in these environment.

The table below is under Docker environment when trying.

(❌: Failed, 🚫: Disabled (Because Ubuntu 22.04, 20.04 doesn't have i386 image))

| release \ architecture      | x86_64 | i386 |
| ------------- | ------ | --- |
| Ubuntu 22.04  | ❌ | 🚫 |
| Ubuntu 20.04  | ❌ | 🚫 |
| Ubuntu 18.04  | ❌ | ❌ |
| Centos 7.2009 | ❌ | ❌ |

Since I doubt it can not running under docker environment, I tried under VM environment.

The table below is under Virtual Machine environment when trying.

(❌: Failed, 🚫: Disabled (Because Ubuntu 22.04, 20.04 doesn't have i386 image))

| release \ architecture      | x86_64 | i386 |
| ------------- | ------ | --- |
| Ubuntu 22.04  | ❌ | 🚫 |
| Ubuntu 20.04  | ❌ | 🚫 |
| Ubuntu 18.04  | ❌ | ❌ |
| Centos 7.2009 | ❌ | ❌ |

I also doubt is the CPU will cause the error, so I tried on Intel CPU with Google Cloud Platform.

| release\architecture | x86_64 |
| -------------------- | ------ |
| Centos 7.2009 | ❌     |

With these trying, I assume the package have the fatal that cause the halt program can not be opened.


### Why the issue caused?

We don't know why the issue happened. By Prof. Chen said, it may caused by the package haven't implement the open method. The issue is under investigating.

### How to solve it?

The issue is under investigating.


## Solved the issue by replace the package to nachos-ULPGC

 - [x] OS Installation
 - [x] Compile Nachos 4.0
 - [x] Compile halt
 - [x] Execute halt

The package is execute successfully in Docker with centos 7.2009 x86_64 architecture.

I will provide the package in [here](https://github.com/ntut-xuan/FSS-Study/tree/main/lab/hw1).

### How to install the package?

1. Update and install the require package with `yum`

    ```bash=
    yum -y update
    yum -y install compat-gcc-44 compat-gcc-44-c++ gcc gcc-c++ glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 libstdc++-devel ed csh make
    ```
2. Install cross-compiler `mips-decstation.linux-xgcc.gz`

    You should have `usr/local/decstation-ultrix` to implement the following step.

3. Move the package to home directory

    ```
    [root@bceff4abc420 ~]# ls
    nachos
    ```

4. Change the directory to `./nachos/code`, you can find here have 3 Makefile, which is `Makefile.common`, `Makefile.dep`, and `Makefile`.

   In this setp, you should modify the `Makefile.dep` accroding your own OS and architecture.

    ```
    [root@bceff4abc420 code]# ls
    Makefile  Makefile.common  Makefile.dep  bin  filesys  machine  network  test  threads  userprog  vm
    ```

    ```
    # This is part of a GNU-Makefile, to specify system-dependent
    # parts of the Makefile enviroment.
    #
    # This gets included as part of the GNU-Makefile used in each of
    # the subdirectories.
    #
    # Depending on your platform, you need to select the correct definition.
    # Also, you need to edit the Makefile in the bin subdirectory.

    # Linux i386 (default)
    # HOST = -DHOST_i386 -DHOST_LINUX
    # CPP=gcc

    # Linux x86_64
     HOST = -DHOST_x86_64 -DHOST_LINUX
     CPP=gcc

    ...
    ```
    
5. Try make with `make` command, it should executing without any warning and error.

    ```
    [root@bceff4abc420 code]# make | echo $?
    0
    ```
    
    The nachos program will in `userprog` and `threads` directory.
    
6. Try execute halt with nachos program.

    ```
    cd userprog
    ./nachos -e ../test/halt
    ```
    
    ```
    [root@bceff4abc420 userprog]# ./nachos -e ../test/halt
    No threads ready or runnable, and no pending interrupts.
    Assuming the program completed.
    Machine halting!

    Ticks: total 10, idle 0, system 10, user 0
    Disk I/O: reads 0, writes 0
    Console I/O: reads 0, writes 0
    Paging: faults 0
    Network I/O: packets received 0, sent 0

    Cleaning up...
    ```
    
    ```
    cd threads
    ./nachos 
    ```
    
    ```
    [root@bceff4abc420 threads]# ./nachos
    *** thread Hilo 0 looped 0 times
    *** thread Hilo 0 looped 1 times
    *** thread Hilo 0 looped 2 times
    *** thread Hilo 0 looped 3 times
    *** thread Hilo 0 looped 4 times
    *** thread Hilo 0 looped 5 times
    *** thread Hilo 0 looped 6 times
    *** thread Hilo 0 looped 7 times
    *** thread Hilo 0 looped 8 times
    *** thread Hilo 0 looped 9 times
    >>> Thread Hilo 0 has finished
    *** thread Hilo 1 looped 0 times
    *** thread Hilo 1 looped 1 times
    *** thread Hilo 1 looped 2 times
    *** thread Hilo 1 looped 3 times
    *** thread Hilo 1 looped 4 times
    *** thread Hilo 1 looped 5 times
    *** thread Hilo 1 looped 6 times
    *** thread Hilo 1 looped 7 times
    *** thread Hilo 1 looped 8 times
    *** thread Hilo 1 looped 9 times
    >>> Thread Hilo 1 has finished
    *** thread Hilo 2 looped 0 times
    *** thread Hilo 2 looped 1 times
    *** thread Hilo 2 looped 2 times
    *** thread Hilo 2 looped 3 times
    *** thread Hilo 2 looped 4 times
    *** thread Hilo 2 looped 5 times
    *** thread Hilo 2 looped 6 times
    *** thread Hilo 2 looped 7 times
    *** thread Hilo 2 looped 8 times
    *** thread Hilo 2 looped 9 times
    >>> Thread Hilo 2 has finished
    *** thread Hilo 3 looped 0 times
    *** thread Hilo 3 looped 1 times
    *** thread Hilo 3 looped 2 times
    *** thread Hilo 3 looped 3 times
    *** thread Hilo 3 looped 4 times
    *** thread Hilo 3 looped 5 times
    *** thread Hilo 3 looped 6 times
    *** thread Hilo 3 looped 7 times
    *** thread Hilo 3 looped 8 times
    *** thread Hilo 3 looped 9 times
    >>> Thread Hilo 3 has finished
    *** thread Hilo 4 looped 0 times
    *** thread Hilo 4 looped 1 times
    *** thread Hilo 4 looped 2 times
    *** thread Hilo 4 looped 3 times
    *** thread Hilo 4 looped 4 times
    *** thread Hilo 4 looped 5 times
    *** thread Hilo 4 looped 6 times
    *** thread Hilo 4 looped 7 times
    *** thread Hilo 4 looped 8 times
    *** thread Hilo 4 looped 9 times
    >>> Thread Hilo 4 has finished
    *** thread Hilo 5 looped 0 times
    *** thread Hilo 5 looped 1 times
    *** thread Hilo 5 looped 2 times
    *** thread Hilo 5 looped 3 times
    *** thread Hilo 5 looped 4 times
    *** thread Hilo 5 looped 5 times
    *** thread Hilo 5 looped 6 times
    *** thread Hilo 5 looped 7 times
    *** thread Hilo 5 looped 8 times
    *** thread Hilo 5 looped 9 times
    >>> Thread Hilo 5 has finished
    *** thread Hilo 6 looped 0 times
    *** thread Hilo 6 looped 1 times
    *** thread Hilo 6 looped 2 times
    *** thread Hilo 6 looped 3 times
    *** thread Hilo 6 looped 4 times
    *** thread Hilo 6 looped 5 times
    *** thread Hilo 6 looped 6 times
    *** thread Hilo 6 looped 7 times
    *** thread Hilo 6 looped 8 times
    *** thread Hilo 6 looped 9 times
    >>> Thread Hilo 6 has finished
    *** thread Hilo 7 looped 0 times
    *** thread Hilo 7 looped 1 times
    *** thread Hilo 7 looped 2 times
    *** thread Hilo 7 looped 3 times
    *** thread Hilo 7 looped 4 times
    *** thread Hilo 7 looped 5 times
    *** thread Hilo 7 looped 6 times
    *** thread Hilo 7 looped 7 times
    *** thread Hilo 7 looped 8 times
    *** thread Hilo 7 looped 9 times
    >>> Thread Hilo 7 has finished
    *** thread Hilo 8 looped 0 times
    *** thread Hilo 8 looped 1 times
    *** thread Hilo 8 looped 2 times
    *** thread Hilo 8 looped 3 times
    *** thread Hilo 8 looped 4 times
    *** thread Hilo 8 looped 5 times
    *** thread Hilo 8 looped 6 times
    *** thread Hilo 8 looped 7 times
    *** thread Hilo 8 looped 8 times
    *** thread Hilo 8 looped 9 times
    >>> Thread Hilo 8 has finished
    *** thread Hilo 9 looped 0 times
    *** thread Hilo 9 looped 1 times
    *** thread Hilo 9 looped 2 times
    *** thread Hilo 9 looped 3 times
    *** thread Hilo 9 looped 4 times
    *** thread Hilo 9 looped 5 times
    *** thread Hilo 9 looped 6 times
    *** thread Hilo 9 looped 7 times
    *** thread Hilo 9 looped 8 times
    *** thread Hilo 9 looped 9 times
    >>> Thread Hilo 9 has finished
    *** thread Hilo 10 looped 0 times
    *** thread Hilo 10 looped 1 times
    *** thread Hilo 10 looped 2 times
    *** thread Hilo 10 looped 3 times
    *** thread Hilo 10 looped 4 times
    *** thread Hilo 10 looped 5 times
    *** thread Hilo 10 looped 6 times
    *** thread Hilo 10 looped 7 times
    *** thread Hilo 10 looped 8 times
    *** thread Hilo 10 looped 9 times
    >>> Thread Hilo 10 has finished
    No threads ready or runnable, and no pending interrupts.
    Assuming the program completed.
    Machine halting!

    Ticks: total 210, idle 0, system 210, user 0
    Disk I/O: reads 0, writes 0
    Console I/O: reads 0, writes 0
    Paging: faults 0
    Network I/O: packets received 0, sent 0

    Cleaning up...
    ```
    
### Testing in future homework?

It's pending to add.