How to disable Samba in build ?

  • ACBIAS wrote: 2024-04-11 13:32 Whenever I remove support for Samba in buildroot menuconfig, the image still contains the Samba daemon.
    How do i disable the compilation of Samba for good ?



    Hello, after removing Samba in Buildroot, please refer to https://wiki.luckfox.com/Luckfox-Pico/L ... figuration for saving and recompiling. Otherwise, there may be a possibility that packages marked with ".stamp_target_installed" will continue to remain in the rootfs.

    You can also try a simple method to solve the Samba shutdown issue by deleting or moving /etc/init.d/S91smb to another directory (for backup purposes, it's recommended to make a backup). After restarting Luckfox-pico, you won't see Samba-related processes running anymore.
  • Sure I can stop or disable the Samba daemon a posteriori. But I want to remove it for good. The fact that it always comes back hints me that a fragment is integrated *after* configuration of buildroot in the building process.

    It seems that samba is forcefully build anyway because some makefile brings it back, indepentently of how buildroot is configured.
    And this was done by the luckfox Team, as hints the SDK´s changelog:
    V1.1 Updatelog
    Rootfs built using buildroot, making it easier to add or remove applications
    Previously, the rootfs was directly built using busybox, which has been moved to the busybox branch
    Buildroot now defaults to enabling the following libraries:
    (...)
    Samba
    Automatically starts on boot
    Account: root
    Password: luckfox
    Last edited by ACBIAS on 2024-04-12 11:46, edited 1 time in total.
  • ACBIAS wrote: 2024-04-12 10:47 Sure I can stop or disable the Samba daemon a posteriori. But I want to remove it for good. The fact that it always comes back hints me that a fragment is integrated *after* configuration of buildroot in the building process.

    It seems that samba is forcefully build anyway because some makefile brings it back, indepentently of how buildroot is configured.
    And this was done by the luckfox Team, as hints the SDK´s changelog:
    V1.1 Updatelog
    Rootfs built using buildroot, making it easier to add or remove applications
    Previously, the rootfs was directly built using busybox, which has been moved to the busybox branch
    Buildroot now defaults to enabling the following libraries:
    (...)
    Samba
    Automatically starts on boot
    Account: root
    Password: luckfox

    Also the sentence: the rootfs was directly built using busybox, which has been moved to the busybox branch makes no sense.


    Hello, if you need to completely disable the related services of Samba, please try commenting out the relevant content in <Luckfox-pico SDK>/sysdrv/Makefile.

    Code: Select all

    	cp $(SYSDRV_DIR)/tools/board/buildroot/samba_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smb.conf
    	cp $(SYSDRV_DIR)/tools/board/buildroot/smbpasswd_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smbpasswd
    
    This is because directly using the Samba provided in Buildroot may have some compatibility issues. Additionally, Samba is a commonly used file sharing method, so we chose to enable it by default to reduce the difficulty of porting for users.

    Regarding "the rootfs was directly built using busybox, which has been moved to the busybox branch," it simply records the version update process. The initial version used busybox as the default rootfs, and later we switched the rootfs construction method to Buildroot to simplify the software package management process.

  • cp $(SYSDRV_DIR)/tools/board/buildroot/samba_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smb.conf
    cp $(SYSDRV_DIR)/tools/board/buildroot/smbpasswd_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smbpasswd
    This is what i did and it seems to have no effect: those two config files are still there.
    Not only those two config files: also ALL the Samba-related binaries:
    smbcacls smbclient smbcontrol smbcquotas smbd smbget smbpasswd smbspool smbstatus smbtar smbtree

    While I understand that Samba can be more or less useful for Windows user, the way Samba is forced into the SDK is quite inelegant. Or at least it should be clear what is integrated by luckfox over buildroot, which makefiles, in which order...

    The question remains: which makefiles should I tweak so that no Samba will be build ? not only the two config files but also the whole Samba binaries and libs.
  • ACBIAS wrote: 2024-04-12 12:11

    cp $(SYSDRV_DIR)/tools/board/buildroot/samba_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smb.conf
    cp $(SYSDRV_DIR)/tools/board/buildroot/smbpasswd_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smbpasswd
    This is what i did and it seems to have no effect: those two config files are still there.
    Not only those two config files: also ALL the Samba-related binaries:
    smbcacls smbclient smbcontrol smbcquotas smbd smbget smbpasswd smbspool smbstatus smbtar smbtree

    While I understand that Samba can be more or less useful for Windows user, the way Samba is forced into the SDK is quite inelegant. Or at least it should be clear what is integrated by luckfox over buildroot, which makefiles, in which order...

    The question remains: which makefiles should I tweak so that no Samba will be build ? not only the two config files but also the whole Samba binaries and libs.
    Hello, please confirm your operations.
    annotate the relevant instructions in the <Luckfox-pico Sdk>/sysdrv/Makefile.
    Then proceed with the following steps:

    0. Clear the relevant configurations (`./build.sh clean rootfs`) to delete the contents of the output folder in the buildroot.
    1. In buildroot menuconfig, deselect the option for samba4.

    Code: Select all

    cd <SDK>/sysdrv/source/buildroot/buildroot-2023.02.6/
    make luckfox_pico_defconfig
    make menuconfig
    
    2. Save the configurations.

    Code: Select all

    make savedefconfig 
    make
    
    3. Recompile the root filesystem.

    Code: Select all

    ./build.sh rootfs
    [code]
    4. Package the rootfs into the image rootfs.img.
    [code]
    /build.sh firmware
    
    Normally, after removing samba4 and recompiling, the resulting image should not contain related binary files.

    Lastly, we understand that there is considerable demand among Luckfox-pico users for Samba. Many users prefer the convenience of directly using it rather than going through a complex porting process(Affected by the uclibc compiler).

    Thank you for your support of Luckfox-pico.
  • Sorry for the late answer and thank you for efforts helping me.
    The procedure you give does not work.

    - I start from scratch, clone the repository, then choose my board (RV1106 with OS on the SD card), and execute a first build.sh so that all parts of buildroot are downloaded. I then clean up the rootfs build with
    build.sh clean rootfs
    - then i comment out in
    <Luckfox-pico Sdk>/sysdrv/Makefile
    anything I can find about Samba (actually there is just the script that copies the two config files in place)

    - then I configure the kernel, remove any samba support, and save the config (
    make luckfox_pico_defconfig -> make menuconfig -> make save_defconfig -> make
    )

    - then i build the kernel, the firmware, and flash it:
    build.sh rootfs -> build.sh firmware
    Result: The Samba package is still build with the rootfs. The kernel module and config files are gone, but all the binaries are still part of the rootfs.

    I cannot really develop on this platform if i cannot grab control on how the firmware is build and what really gets in. I´d like to start with a bare minimum version, sporting merely just a SSH server to access the filesystem, and iterate from that point.

    Any other idea how I can get rid of Samba totally ?
    Last edited by ACBIAS on 2024-04-21 6:36, edited 2 times in total.
  • ACBIAS wrote: 2024-04-21 5:49 Sorry for the late answer and thank you for efforts helping me.
    The procedure you give does not work.

    - I start from scratch, clone the repository, then choose my board (RV1106 with OS on the SD card), and execute a first build.sh so that all parts of buildroot are downloaded. I then clean up the rootfs build with
    build.sh clean rootfs
    - then i comment out in
    <Luckfox-pico Sdk>/sysdrv/Makefile
    anything I can find about Samba (actually there is just the script that copies the two config files in place)

    - then I configure the kernel, remove any samba support, and save the config (
    make luckfox_pico_defconfig -> make menuconfig -> make save_defconfig -> make
    )

    - then i build the kernel, the firmware, and flash it:
    build.sh rootfs -> build.sh firmware
    Result: The Samba package is still build with the rootfs. The kernel module and config files are gone, but all the binaries are still part of the rootfs.

    I cannot really develop on this platform if i cannot grab control on how the firmware is build and what really gets in. I´d like to start with a bare minimum version, sporting merely just a SSH server to access the filesystem, and iterate from that point.

    Any other idea how I can get rid of Samba totally ?

    Hello,
    We have tested and confirmed that it's possible to properly disable Samba-related applications.
    samba4 add
    samba_add_buildroot.jpg
    smb_add.jpg
    samba4 delete
    samba_delete_buildroot.jpg
    smb_delete.jpg
    Typically, when we execute "./build.sh rootfs," the generated rootfs is stored in <Luckfox-pico>sysdrv/out/rootfs_uclibc_rv1106. Then, when we proceed to execute "./build.sh firmware," it packages it into rootfs.img.

    Before executing "./build.sh firmware," please perform "./build.sh clean rootfs" to carry out additions and deletions in Buildroot. Afterwards, check if the relevant binary files are truly deleted under rootfs_uclibc_rv1106 before proceeding with the packaging operation.
    Similarly, you can customize your rootfs by directly deleting the binary files you don't want to keep in rootfs_uclibc_rv1106.

    If you need an earlier version of the SDK, you can revert using Git. However, since adding Samba was implemented in earlier versions of Buildroot, reverting to the initial SDK might render Buildroot unable to construct the root file system.
  • Hello and thank you a lot for your efforts helping me.
    I still cannot get the same result than you, and I really wonder what obvious part I´m missing.
    Here are the exact steps I do:
    # cloning the SDK locally
    git clone https://github.com/LuckfoxTECH/luckfox-pico.git
    cd luckfox-pico

    # I select "BoardConfig-SPI_NAND-Buildroot-RV1106_Luckfox_Pico_Pro_Max-IPC" (Choice 8)
    ./build.sh lunch

    # I compile everything, this way buildroot and all its components are downloaded
    ./build.sh

    # Let´s flash the default version. At this point Samba is present and running
    tools/linux/Linux_Upgrade_Tool/upgrade_tool uf output/image/update.img

    # Now I want to change my buildroot config. I start by commenting out the two lines that copy the config files for Samba in the image
    vi sysdrv/Makefile
    #cp $(SYSDRV_DIR)/tools/board/buildroot/samba_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smb.conf
    #cp $(SYSDRV_DIR)/tools/board/buildroot/smbpasswd_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smbpasswd

    # Let´s configure buildroot now. First copy the default config for this board into .config
    cd sysdrv/source/buildroot/buildroot-2023.02.6/
    make luckfox_pico_defconfig
    # Go on with buildroot configuration
    make menuconfig
    # There i deselect Samba4 and add the packages I need (socat, thttpd, and dropbearSSH). I also deselect openSSH (because i use the more frugal DropbearSSH)
    make
    # I want those changes saved for good as default buildroot config, so I issue:
    make savedefconfig

    # At this point Samba is fully deselected in the buildroot config. I go back to the SDK root folder
    cd ../../../..

    # To clean up any previously build rootfs, i issue:
    ./build.sh clean rootfs


    # Then I rebuild the rootfs (should not include Samba, right ?)
    ./build.sh rootfs

    # Ok, let´s build the firmware with my new rootfs
    ./build.sh firmware

    # And flash it
    tools/linux/Linux_Upgrade_Tool/upgrade_tool uf output/image/update.img
    When I log into my board, i can observe that what I selected in buildroot menuconfig is there:
    ps afx
    187 root /usr/sbin/dropbear -R
    192 mosquitt /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
    (...)
    369 nobody /usr/sbin/thttpd -C /etc/thttpd.conf
    (...)
    445 root /usr/sbin/dropbear -R
    And the Samba daemon is not running, because the config files are now missing. BUT:
    The samba package is still in the build !!!
    :
    # ls /usr/bin/sm*
    smbcacls smbclient smbcontrol smbcquotas smbget smbpasswd smbspool smbstatus smbtar smbtree
    So, I really don´t know what I do wrong here. The steps are easily reproduced, and lead always to the same result: Whatever I do, the Samba package i always brought in. I believe there must be something flawed in the Makefiles, that I do not understand.

    I much appreciate your help and believe we´ll find soon the root cause of this behavior, but I admit I have no further clue why Samba always slips in the build.
  • Also done:
    - Tested on latest Fedora FC39 and latest Debian 12.5 : same behavior on both platforms
    - Edited sysdrv/tools/board/buildroot/luckfox_pico_defconfig and removed Samba, then repeated the steps above (also the ./build.sh clean rootfs step, and additionally did ./build.sh clean firmware before rebuilding the kernel and the formware image): also no change

    I know i can edit the resulting rootfs before building the image, and thus remove samba from the rootfs, but this does address why samba is forced in the rootfs image. Samba just shouldn´t be there if it´s removed from the buildroot config.