wastemem script
Copying and pasting the wastemem script is taking more time than I'd like.
running this:
gcc -o lab_wastemem lab_wastemem.c
results in
c1: fatal error: lab_wastemem.c: No such file or directory
Thanks for assistance.
Comments
-
Hi Michael,
You are most likely trying to compile lab_wastemem.c in the wrong directory. Try to find the absolute path of the file, that may help you:
gcc -o lab_wastemem /home/youruser/Downloads/LFS207/SOLUTIONS/s_17/lab_wastemem.c
Reagrds,
Vlad2 -
Thanks @vipopescu. In fact as you scroll down to the solution you will also see s_17/lab_waste.sh. Which will do the compile for you although it is so simple it adds little. Make sure you understand the "RESOURCES" and "SOLUTIONS" tar balls that are mentioned in the introduction. You will need to use them again when you get to the virtualization labs for example. You definitely were not meant to cut and paste the source for the lab. Very error-prone.
2 -
Thanks guys! I figured out my mistake. You're right @vipopescu, I was simply in the wrong directory!
1 -
problem see SOLUTIONS/s_16/lab_wastemem.ch
problem see SOLUTIONS/s_16/lab_waste.shabove given lab link was is not valid link could please share valid script .sh ?
0 -
Hi @sriramvassuthev,
I just downloaded the "solutions" file and extracted it. Once you have extracted the .tar.xz file, you will find the files here:
LFS207/SOLUTIONS/s_16/
Perhaps you missed the LFS207 directory.
Regards,
Luis.0 -
Yes Correct I missed the that file Yeah i got in from this below link.
https://prep.lf.training/?course=LFS207
Regards,
Sriramvassuthev0 -
Hi Sriramvassuthev,
I'm glad that the issue is solved.
Regards,
Luis.0 -
Hello Luisviveropena,
Yes. It Resolve.
When I saw the Script. where lab_waste.sh is integrated with lab_wastemem.ch.
When I Learning this Chapter -21. Filesystem Features: Attributes, Creating, Checking, Usage, Mounting -> Mounting Filesystems (Lesson).
Each filesystem is mounted under a specific directory, as in the following command:
$ mount -t ext /dev/sdb4 /home
- Mounts an ext4 filesystem
- Usually not necessary to specify the type with the -t option
- The filesystem is located on a specific partition of a hard drive (/dev/sdb4)
- The filesystem is mounted at the position /home in the current directory tree
- Any files residing in the original /home directory are hidden until the partition is unmounted
In this , instead of ext have to user ext4 in the command.
Thanks & Regards,
Sriram Vassuthev.S0 -
Hi @sriramvassuthev, I'm glad that the original issue was solved

Regarding the second thing:
Usually not necessary to specify the type with the -t option
Yep, that's right, the OS will try to auto detect it. But also it's not wrong, and in some cases it can be useful, if the OS don't recognize the filesystem type. From the man page for 'mount':
If no -t option is given, or if the auto type is specified, mount will try to guess the desired type. Mount uses the blkid or volume_id library for guessing the filesystem type; if that does not turn up anything that looks familiar, mount will try to read the file /etc/filesystems, or, if that does not exist, /proc/filesystems. All of the filesystem types listed there will be tried, except for those that are labeled "nodev" (e.g., devpts, proc and nfs). If /etc/filesystems ends in a line with a single * only, mount will read /proc/filesystems afterwards.
Regards,
Luis.0 -
Hi @Luis,
I am clear.
By Blank, i am asking below question.
is there filesystem type easily to adopt with different machine and different OS can easily understand mount into system and do process as per user request or Machine request?
Like Common to all OS. Instruction will be different for each OS.
is there any tool to backup only Meta Data Information of System ?
Regards,
Sriram Vassuthev.S0 -
Hi @sriramvassuthev,
is there filesystem type easily to adopt with different machine and different OS
can easily understand mount into system and do process as per user request or Machine request?Can you elaborate on this, please? Do you want to access a filesystem through the network from more than one device?
Please open a new thread for this question, as it's different from the original one, which is already solved.
Regards,
Luis.1 -
Yes Ok. I will Open it new thread.
1 -
Hello - when trying to download lab_wastemem.c in the link at the bottom of the lab notes (solution 16.2) I get the error "Error: jwt expired".
0 -
Hi @badpotato,
It refers to the files you need to download from the Course Resources website. So you need to get a compressed file for the Solutions, uncompress it and you will find the files.
The information about this in on Chapter 1 Course Information / Course Support and Other Resources.
Regards,
Luis.0 -
Hello all,
I am getting some trouble when I attempt to perform the following command:
gcc -o lab_wastemem /home/myusername/LFS207/SOLUTIONS/s_16/lab_wastemem.c
I get the error: fatal error linux/kernel.h: No such file or directory.
I have tried multiple solutions to try and add the file to my os, including sudo apt install build-essential, sudo apt install linux-headers-$(name -r), and sudo apt install --reinstall lib-6-dev. When performing the locate utility to fine kernel.h files, I found multiple results under the usr/src/linux-headers-6.14.0-33 and usr/src/linux-headers-6.14.0-37 directories, so it appears I do have the file, so I am wondering why the error is still being produced here. Can someone assist with this?
0 -
Hi @mbake4,
Yes, that error indicates that the kernel headers are not present in the system.
1.- What OS and version are you working with? In my case I'm running Ubuntu 24.04.4 LTS.
2.- Provide kernel version:uname -r
My OS:
6.8.0-110-generic
3.- What kernel headers packages do you have on your system?
dpkg -l | grep linux-
ii binutils-x86-64-linux-gnu 2.42-4ubuntu2.10 amd64 GNU binary utilities, for x86-64-linux-gnu target
ii cpp-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04.1 amd64 GNU C preprocessor for x86_64-linux-gnu
ii cpp-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) for the amd64 architecture
ii gcc-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04.1 amd64 GNU C compiler for the x86_64-linux-gnu architecture
ii gcc-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the amd64 architecture
ii linux-base 4.5ubuntu9+24.04.2 all Linux image base package
ii linux-image-6.8.0-107-generic 6.8.0-107.107 amd64 Signed kernel image generic
ii linux-image-6.8.0-110-generic 6.8.0-110.110 amd64 Signed kernel image generic
ii linux-image-virtual 6.8.0-110.110 amd64 Virtual Linux kernel image
ii linux-libc-dev:amd64 6.8.0-110.110 amd64 Linux Kernel Headers for development
ii linux-modules-6.8.0-107-generic 6.8.0-107.107 amd64 Linux kernel extra modules for version 6.8.0 on 64 bit x86 SMP
ii linux-modules-6.8.0-110-generic 6.8.0-110.110 amd64 Linux kernel extra modules for version 6.8.0 on 64 bit x86 SMP
ii linux-tools-6.8.0-107 6.8.0-107.107 amd64 Linux kernel version specific tools for version 6.8.0-107
ii linux-tools-6.8.0-107-generic 6.8.0-107.107 amd64 Linux kernel version specific tools for version 6.8.0-107
ii linux-tools-common 6.8.0-110.110 all Linux kernel version specific tools for version 6.8.0In my case I have linux-libc-dev version 6.8.0-110.110 , which matches the running kernel.
4.- Then running the compiler:
luis@ubuntuserver1:~/LFS207/Lab16.2$ ls -l
total 8
-rwxr-xr-x 1 luis luis 506 Apr 21 15:17 lab_waste.sh
-rw-r--r-- 1 luis luis 1751 Apr 21 15:17 lab_wastemem.cluis@ubuntuserver1:~/LFS207/Lab16.2$ gcc -o lab_wastemem lab_wastemem.c
luis@ubuntuserver1:~/LFS207/Lab16.2$ ls -l
total 28
-rwxr-xr-x 1 luis luis 506 Apr 21 15:17 lab_waste.sh
-rwxrwxr-x 1 luis luis 16472 Apr 21 15:32 lab_wastemem
-rw-r--r-- 1 luis luis 1751 Apr 21 15:17 lab_wastemem.cRegards,
Luis.0 -
Thank you @luisviveropena!
I am running Ubuntu version 25.04 via a VirtualBox VM
I am using kernel version 6.14.0 (generic)When reviewing the kernel headers packages, I did find that I have:
meredith-baker@MereUbuntu:~$ dpkg -l | grep linux-
ii linux-libc-dev:arm64 6.14.0-37.37 arm64 Linux Kernel Headers for development
So it should appear to match in this case, right?
When listing the compiler components (ls -l), I receive the following results:
meredith-baker@MereUbuntu:~/LFS207/SOLUTIONS/s_16$ ls -l
total 12
drwxr-xr-x 2 meredith-baker meredith-baker 4096 Jun 14 2024 EXAMPLES
-rw-r--r-- 1 meredith-baker meredith-baker 1751 Jun 14 2024 lab_wastemem.c
-rwxr-xr-x 1 meredith-baker meredith-baker 506 Jun 14 2024 lab_waste.shyet, I am still getting an error when trying to run the compiler at this point:
meredith-baker@MereUbuntu:~$ gcc -o lab_wastemem /home/meredith-baker/LFS207/SOLUTIONS/s_16/lab_wastemem.c
In file included from /home/meredith-baker/LFS207/SOLUTIONS/s_16/lab_wastemem.c:20:
/usr/include/aarch64-linux-gnu/sys/sysinfo.h:24:10: fatal error: linux/kernel.h: No such file or directory
24 | #include <linux/kernel.h>
| ^~~~0 -
Hi @mbake4,
1.- You need to compare the version of package linux-libc-dev against/with the kernel version that you system is running. I.e., what's the output for:
uname -r
2.- Are you working with ARM Architecture?
Regards,
Luis.0 -
Thank you @luisviveropena!
Apologies here. I did put it above but I didn't confirm the outputs received.
My kernel release (uname -r) is
6.14.0-37-genericThe architecture type (uname -m) is
aarch64Which to my knowledge is the technical term for ARM64 correct?
If so, would the header package I have match what I need to run the compiler successfully?
meredith-baker@MereUbuntu:~$ dpkg -l | grep linux-
ii linux-libc-dev:arm64 6.14.0-37.37 arm64 Linux Kernel Headers for development0 -
Hi @mbake4,
I wanted to do a test case on the distro and version you are using, and I found that Ubuntu 25.04 already reached it's end of life cycle, so it's not supported anymore by Ubuntu.
I recommend using Ubuntu 24.04.4 LTS, which is available for ARM. So I can do tests on Ubuntu 24.04.4 for AMD64, which will be the same in terms of versioning for packages.
Regards,
Luis.0 -
Thank you @luisviveropena!
It was able to work when switching to Ubuntu 24.04.4 LTS. Thank you for your help!
1 -
0
Categories
- All Categories
- 175 LFX Mentorship
- 175 LFX Mentorship: Linux Kernel
- 745 Linux Foundation IT Professional Programs
- 372 Cloud Engineer IT Professional Program
- 168 Advanced Cloud Engineer IT Professional Program
- 73 DevOps IT Professional Program - Discontinued
- 3 DevOps & GitOps IT Professional Program
- 98 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- AI & ML Training
- Blockchain & Decentralized Identity Training
- Cloud & Containers Training
- Cybersecurity Training
- DevOps & Site-Reliability Training
- Linux Kernel Development Training
- Networking Training
- Open Source Best Practice Training
- System Administration Training
- System Engineering Training
- Web & Application Development Training
- 2 LFD103-JP クラス フォーラム
- 4 LFD210-CN Class Forum
- 764 LFD259 Class Forum
- 681 LFS101 Class Forum
- 2 LFS158-JP クラス フォーラム
- 162 LFS207 Class Forum
- 3 LFS207-DE-Klassenforum
- 4 LFS207-JP クラス フォーラム
- 61 LFS241 Class Forum
- 52 LFS242 Class Forum
- 42 LFS243 Class Forum
- 19 LFS244 Class Forum
- 4 LFS250-JP クラス フォーラム
- 166 LFS253 Class Forum
- 19 LFS256 Class Forum
- 1.4K LFS258 Class Forum
- 165 LFS261 Class Forum
- 26 LFS267 Class Forum
- 792 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 87 Storage
- 768 Linux Distributions
- 81 Debian
- 67 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 105 Mobile Computing
- 18 Android
- 72 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 392 Off Topic
- 121 Introductions
- 181 Small Talk
- 29 Study Material
- 944 Programming and Development
- 310 Kernel Development
- 616 Software Development
- 977 Software
- 369 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)

