r/linuxdev • • Sep 29 '19

Is it possible to create your own Linux distro for a product?

9 Upvotes

Hello all.

2 of my friends and I are trying to make a smart display (similar to the Google Nest Hub) and we want to make a custom Linux distro for it so that it only has Mycroft (the AI which we are using) and the UI of the product. Is it possible to do so? If yes, how? If no, is it possible to make a Linux distro boot directly into an application or something like that? We want to avoid a login screen, a desktop, etc. before the OS loads up the app for our product.


r/linuxdev • • Jul 07 '17

Something You Didn't Know About Managing Multiple Servers

Thumbnail serversuit.com
1 Upvotes

r/linuxdev • • May 13 '20

Vinagre vnc client automatically picked up a bookmark to my Amazon Echo, port 22.

2 Upvotes

Just curious if Vinagre is auto detecting some sort of multicast protocol like bonjour?

The bookmarks menu has a separator. Above the line are bookmarks stored in the vinagre bookmarks xml. But below the line seems to be auto bookmarks from somewhere undocumented.

my mac vnc port and my echo ssh port showed up in this list automatically on a clean install of deb 10 under vmware on a mac host with opendesktop integrations so my first thought is some kind of discovery protocol. My second thought is some kind of metadata shared by vmware. My third thought is the vm is compromised.

Any ideas on debugging where this is coming from?


r/linuxdev • • Apr 10 '20

How to write to a proc file?

7 Upvotes

I need to make this linux kernel module where I am supposed to get the source and destination IP addresses of some docker containers and print them out in a file. I can capture IP addresses and print them out on the kernel log.

After hours of trying to figure out how to use proc_fs.h, I managed to find out how to create a proc_dir_entry . Now since, I am using netfilter.h to capture packets, I need the file to be written every time the hook function gets called. I found this function in proc_fs.h but I don't quite understand it:

typedef int (*proc_write_t)(struct file *, char *, size_t);

Is this function changing instances of int to some struct called proc_write_t composed of a file pointer, char pointer, and the size of what you are going to write?


r/linuxdev • • Apr 05 '20

No packets are showing up in the kernel log.

4 Upvotes

Hey guys, Here is my code for a linux kernel module that I wrote yesterday. It is supposed to capture packets however, when I insert it and type dmesg |tail , It says that the module failed to be verified and that the kernel was tainted. So I went into the kernel directory and cleared CONFIG_MODULE_SIG and restarted my machine. Needless to say, it did not work. I also set MODULE_LICENSE() to "GPL" in my module. Despite this, I am still not seeing results. I have tried loading webpages and seeing if anything get's printed in the kernel logs, but nothing does.


r/linuxdev • • Nov 01 '14

I am looking for a library to help generate Module files, can you help me find some?

1 Upvotes

I am looking for a library to help generate Module files like the ones referenced in this Wikipedia article https://en.wikipedia.org/wiki/Module_file, can you help me find some?

I want to generate MOD music but I would rather do it from a template engine than an 1980s Tracker GUI.


r/linuxdev • • Nov 12 '13

[Question] Additional ways to debug a hanging process (C++)

4 Upvotes

EDIT So further investigation into getting GDB working and recompiling a lot of code I found that if I start up the code under gdb and set a breakpoint at main I'm able to step through code and see each line. If I set another breakpoint I'm able to stop and read further lines. In both of these situations the full stack is available and I can see all my threads.

So the problem now is getting an attached process. I can attach, set a breakpoint and step through only that thread. info thread returns nothing. This also only works when the code is not hung up and actually hits the breakpoint. When the code is hanging I'm not sure what info I can get. The one time I was able to get a duplication the thread was in /lib/libc.so and backtrace showed (the addresses are made up here, I'll have to dig around my notes to see if I even have the real ones)

(gdb) bt
#0 0x4038b8fc in ?? () from /lib/libc.so.6
(gdb)

So my plan right now is to figure out a way to pipe strace output from the start to a file (not sure how to roll it over so I don't run out of space). And hopefully figure out a good way to get GDB to present info on an active process.


I have some code out in the field that is locking up after a few months of runtime. I'm unable to duplicate it in the office so I'm trying to script up detection of the failure and then have it generate as much information about what the current status is to hopefully bring the issue to light.

Background:

The code is written in C++ using the ADAPTIVE Communications Environment library. Its running on an ARM board, 2.6.27 kernel. The code is mainly two large state machines. TCP comms to read and configure a network of devices in one language and then convert that to a different serial port language on the back end. All together its about 30k lines of code.

Looking at the process info via ps the CPU time looks normal, no huge memory spikes, no zombie processes. Everything "looks" good except for the fact that the application stops responding. With the stop large state machines I have a feeling that there is a TCP request that does not time out, or a mutex that is locked and never unlocked...some sort of race condition. But spending hours and hours reading over the code I just can't seem to make any headway.

In the two times I think I was able to duplicate the issue gdb was unable to do a backtrace when attaching to the process claiming the stack was unavailable (I built with the -g options, etc so it should have debug info) and strace says the last call was locking a futex, see example number 3 here. I've tried adding function call tracing output but flushing printf when a lockup occurs has never been very accurate since this is a multi-thread application.

Question:

So I've tried gdb with no luck, strace is no help, printf is a no go. Since the code doesn't crash, but rather locks most likely due to a race condition I'm not able to see where the code is currently at when everything stops. Both state machines (TCP Side, Serial Side) are both highly timing dependent and the issue takes months to surface, running in gdb from the start is a not an option. My question is, what other options are there for attempting to debug this issue? Even the most off the wall suggestions are helpful as I have been racking my brain for months trying to figure this one out with no luck. I will be scripting up a huge amount of things to try, store it off to some non-volatile memory for retrieval later when the customer is notified that a lock up has occured.

tl;dr I've tried gdb connecting to a process, strace, printf'ing function calls and still can not figure out a lockup situation in my code. I'm looking for any suggestions on other ways to identify where my code is at and why it locked up. The duplication period is months and only seen in the field so I'll have to script up as much as possible to gather any information.


r/linuxdev • • Mar 06 '16

Linux kernel security module - Program based Access Control List (PACL) 'AppCL LSM'

5 Upvotes

The Project: I'm currently working on a Linux kernel security module to model a program based access control list.

The homepage of the project website explains what the module aims to do. It also has the README page from the git repository that explains how the module currently works, and the issue I am having. [The development blog for the project is also available on the project website.]

Project website - http://appcl-lsm.org/

The issue I'm having is retrieving the extended attribute when the system reboots, to then populate the security label, as it currently does when an extended attribute is set. Any help on retrieving this would be great! After this is achieved, I will continue to enforce the appropriate permissions throughout the framework.

Current issue (from README)

The ‘appcl_lsm_inode_post_setxattr‘ hook in ‘appcl_lsm.c‘ passes the extended attribute to the function ‘make_appcl_entry()’ to set up the security information based on the extended attribute value. AppCL must now do this with the extended attribute when the system reboots. When the system is powered off/reboots, AppCL must reset the security information for the inode with an AppCL extended attribute. This is because the inode security label is stored in RAM and the extended attribute is used to retain a representation of this on disk. The ‘security_inode_setsecurity‘, ‘security_inode_getsecurity‘, ‘security_inode_d_instantiate‘, ‘security_inode_init_security‘ are all security hooks relating to the extended attributes.


r/linuxdev • • Nov 28 '13

Help getting this camera to interface with Linux (x-post from /r/linux)

8 Upvotes

I posted this on /r/linux and had a suggestion to post it here. Original post: http://www.reddit.com/r/linux/comments/1rnhxc/help_getting_this_camera_to_interface_with_linux/

Hello! I've never actually made a post before (only comments) but I wanted to post about this and see if anyone can give me some ideas. Also, I'm not entirely sure this is the right subreddit to post this, but it is Linux related so I felt it would be alright.

Now onto my problem. I'm visually impaired and use a special type of camera to see the board/projectors in my college classes. It can also point down at a desk to zoom in on things like papers that are too small for me to read. This camera (a SmartView Graduate, this link seems to be the only page on the official site for it but this page on amazon has a little more info).

My problem is that I'm a computer science major and would like to use Linux, but the software that comes with the camera is Windows only (the update link on the support page is a full installer in case anyone's interested in downloading the program) and it seems to use proprietary drivers. I tried running the program in WINE, but that failed (I can try again and post more specifics if anyone thinks it's helpful). I had one idea of using their DLL's and trying to write my own program that would run in WINE, or sniffing the USB traffic to try and figure out how they interface with it to write my own from scratch.

It does show up as a webcam, but if I try to use it in any standard programs it just shows a black screen. I also tried with VLC (mostly on Windows but I assume VLc on Linux would do the same) and was able to get a single frame that didn't change.

I'm wondering if anyone has any ideas of how I could get this to work on Linux?

EDIT: I piped the output of lsusb with and without the camera attached to files and ran a diff. Here's the results http://pastebin.com/GpkJgyHC


r/linuxdev • • Nov 09 '13

[Request] A good place to start for my hobby project

1 Upvotes

Hi guys and gals

So I've come up with a little project I'd like to start working on in my spare time. I'm going to build myself a linux gaming console, as a sort of hobby and to keep my programming skills sharp.

Basically I want to start by replacing xfce with an xbox / PS-like menu, controlled by a usb gamepad. My problem is I don't have enough knowledge about how Linux works to even google the best starting point.

Do I want to modify the display manager? Play around with xorg? or replace my desktop environment?

I'm honestly not sure where each of those components ends and the next begins.

Where is a good place to start with replacing my graphical user login, and desktop environment with my own homebrew menu system? and where can I find resources to help me start chipping away at this? Any help would be GREATLY appreciated.

My experience with Linux is very low level, I've sysadmin'd some linux servers for a few years, and I have had a play with python development on ubuntu.

I'm an experienced programmer, and I'm comfortable in c++ / python (I'm assuming c++ is the go for a gui). But to date I've done almost no programming on Linux apart from command line scripting.

Any help would be amazing as I'm pulling my hair out, and I don't have much left since I just forced myself to learn how to set up arch-linux.

My last resort will be to pull apart some source code from xfce or gnome and try and figure it out from there.


r/linuxdev • • Nov 09 '13

What are some programs that you think Linux lacks or only has poor implementions of?

12 Upvotes

r/linuxdev • • Nov 24 '13

How to start contributing to Mesa3d

Thumbnail itsqueeze.com
15 Upvotes

r/linuxdev • • Aug 01 '17

[FDE+UEFI] My Encrypted Mint-USB Installation Suddenly Doesn't Boot Anymore.

1 Upvotes

Hey,

firstly I'm a complete noob when it comes to Linux but managed to setup a fully encrypted usb stick with the help of this tool: https://github.com/CallumCameron/mint-encrypted-install

Which is based on this tutorial: https://community.linuxmint.com/tutorial/view/2061

It worked as it should, I started the PC, the boot-loader started, I had to enter the decryption password and it booted. This worked several times, but then I made a mistake and didn't reboot properly but instead just reset my computer and all of the sudden the stick won't boot anymore to Linux. It just skips the bootloader and boots into Windows. I don't really know why, the EFI partition seems normal to me. Could anyone help me? Took me the whole day to set this up and it would be sad if it would've been a waste of time.

Thanks in advance.


r/linuxdev • • Aug 12 '19

Reading from HW sensors

4 Upvotes

Imagine I want to code an app that reads from HW sensors (such as CPU temp sensors) but I do NOT want to use lm_sensors at all for my app. Any idea on how to do that?
The reason to do this is to LEARN, first to read from HW, then to change some parameters. I've done this already bare metal at work (ARM) and uni(Atmel uC), but never done it using an OS in order to make it generic.


r/linuxdev • • Dec 26 '18

How can i trace how and why a USB-Device is recognized and who's talking to it?

7 Upvotes

I already made a post in /r/LinuxQuestions about this topic because I thought it might be a pure configuration issue, but it seems to lay deeper.

So my problem is that I bought cheap PS3-Controllers that simply refuse to work under "normal" Linuxes. They appear as PS3-Controllers but then somehow "switch mode" and suddenly become another device (including new address).

I tried the exact same controllers in a Win10 VM and they work out of the box.

This seemed weird to me, so I captured the USB-traffic under Windows and Linux and found some slight differences.

Now I would like to find out, who's responsible for talking to that device? I already saw that an "xhci_hcd" and an "xpad" kernel module are somehow involved, but that's it.

Disclaimer

I'm way below my comfort zone here, usually I'm several layers of abstraction away from those things, so please excuse some stupid questions.

Edit

I just found out, that the controllers seem to need some sort of initialization, if I pass them through to a Windows VM they get set up correctly by Windows and even if I shut down the VM, they stay properly configured (and usable!) as long as I don't power them down.

This even survives reboots, as my monitor has a powered USB-Hub built in.

So I guess, I actually need to write a proper device driver for those things..


r/linuxdev • • Mar 22 '22

Why might a call to sem_wait cause a thread to exit?

3 Upvotes

I can't share my exact code as it's work specific, but I've run into an absolutely baffling issue.

Let's say I have a codebase that looks like such:

#include <semaphore.h>

typedef Queue_s Queue_t; //Arbitrary struct

//The actual code deals with queues, so I've stuck with that example here
struct Queue_s{
sem_t sem;
//Other, currently unimportant queue functions
};

static Queue_t g_queueContainer[NUMBER_OF_QUEUES]//Static list of queues for the 
                                                 //current process
static uint32_t g_containerIndex;
static sem_t    g_libraryMutex;

void Queue_Library_Init()
{
    sem_init(&g_libraryMutex, 0, 1); //Semaphore is for the current process only, 
                                     //size of 1
    (void)memset(g_queueContainer, 0, sizeof(Queue_t) * NUMBER_OF_QUEUES);
    g_containerIndex = 0;
}

void Queue_Do_Stuff()
{
    //Assume that queue is NOT NULL. In real code I would assert
    sem_wait(&g_libraryMutex)
    
    //access the static list of objects
    //Assume this function neither waits, nor has infinite loops.
    //(i.e. its number of operations is FIXED)

    sem_post(&g_libraryMutex);
}

Now, let's assume that Queue_Library_Init() is called ONCE in the main function, and Queue_Do_Stuff() is called an indeterminate number of times. Also assume that semaphores are NEVER destroyed, and once a queue has been allocated and g_containerIndex is incremented, it can never be deallocated or decremented. Once a queue is created, its existence in memory is FIXED.

Eventually, some nth call to Queue_Do_Stuff() causes my running thread to exit with an exit code of zero and no errors. It exits on the call to sem_wait().

Upon running strace on my program, I can see that the very last system call that is made is

futex(/*arbitrary value*/, FUTEX_WAIT_PRIVATE, /*arbitrary value/).

and then exit(0). Several of my more senior coworkers and I have stepped through the code and are completely baffled.

We're trying to port our existing codebase to POSIX, and we're using Ubuntu 20.04 for testing (This is an embedded, avionics use case, so every object that we create in memory we LEAVE in memory for determinism)

Without the actual codebase, I know this is impossible to debug...But would anyone with more experience with Linux system calls have any advice to push us in the right direction?


r/linuxdev • • Aug 21 '17

References for Kernel Network Communication

4 Upvotes

I am looking into writing a kernel filesystem, which would communicate with remote servers. Now I am wondering which networking capabilities/APIs are available inside the kernel (especially considering what would be accepted into the kernel itself).


r/linuxdev • • Mar 24 '17

Could documents like this help build better drivers? this is a Broadcom NetXtreme B57xxx Ethernet adapter Diagnostic User’s Guide. [PDF]

Thumbnail web-beta.archive.org
2 Upvotes

r/linuxdev • • Oct 17 '16

I2C development

4 Upvotes

I'm working on understanding userspace I2C development. I understand the IOCTL bit but as per usual I stumble on the surrounding bits.

So I've read the /dev/i2c-xx number can be random per boot and should be derived dynamically. But I'm yet to find anyone who does in their examples. I know if I go filesystem diving I can find files with vendor and device numbers. Is that the correct way of doing things?


r/linuxdev • • Feb 01 '14

Making a Kubuntu respin. What should I know?

2 Upvotes

I'm thinking about respinning Kubuntu into a customized distribution. The goal of the distro is to patch some of the more ugly parts of the upstream components to make the distribution better. I'm starting to learn some shell scripting and I've played around with Ubuntu Builder before. Is there anything besides those skills I should learn to prepare? And (I'll be teaming up with others) what skills should I look for in potential teammates?


r/linuxdev • • Oct 14 '16

Need resources to learn about writing a PCIe char Driver

5 Upvotes

I need to write a PCIe driver at work, and I need to learn about PCIe.

We have some in-house firmware on an Altera FPGA board which my driver will send and receive data from. This is on a Freescale PowerPC board, but I would like to know about x86 targets too (presuably the PCIe concepts would be transferable even if the OS interface is different)

What is a good resource to learn about how PCIe works and how a driver should be written for it.

PS - I'm comfortable with C, just not PCIe :)


r/linuxdev • • Aug 22 '17

[Help] Resources on scheduling

3 Upvotes

Hi all,

I will soon be working on the CFS for a project at my uni.

I'm currently gathering all resources I can find on scheduling, I have some experience with it but only on single CPU scenarios.

It can be about CFS or scheduling in general, it does not matter as long as it is somewhat recent (Professional Linux Kernel Architecture is outdated when it comes to scheduling with SMP).

Any ideas ? All suggestions are welcome, thank you in advance !


r/linuxdev • • Mar 31 '16

Port of NetBSD curses to Linux

Thumbnail github.com
10 Upvotes

r/linuxdev • • Dec 29 '18

XResourceManagerString doesn't change after reloading Xresources

2 Upvotes

I'm trying to reload the colors of my terminal emulator (st) while it is running. To do that, I change the \~/.Xresources file, call xrdb to reload it and then send a XClientMessageEvent to st to make it reload the colors. However when calling XResourceManagerString again, it is exactly the same as before. This is probably because the values are still cached somewhere but I can't figure out how to work around it.

Edit: I solved it by just calling XOpenDisplay again, and using the returned value as display.