sdm commands include:
-
sudo sdm --customize raspios-image.imgPerform Phase 0 configuration, and drops you in a shell inside the image for Phase 1 customization
-
sudo sdm --burn /dev/sdX --host hostname raspios-image.imgBurns the IMG file onto the specified SD card and sets the hostname on the card.
-
sudo sdm --burnfile customized-for-myhostname.img --host myhostname raspios-image.imgBurns the IMG file to the specified SD Card Image and sets the hostname. The customized IMG file must be burned to an SD Card to be used.
-
sudo sdm --explore raspios-image.imgOR
sudo sdm --explore /dev/sdXUses systemd-nspawn to enter the IMG file (first example) or SD Card (second example) container to explore and/or make manual changes to the image. When using
--explorethere is no access to the files in the host system. -
sudo sdm --extend [--xmb nnn] raspios-image.imgExtends the image by the specified size and exits. The
--extend [--xmb nnn]switch can also be used in conjunction with--customize. The IMG is extended before starting customization. -
sudo sdm --shrink raspios-image.imgShrinks the image to be as small as possible and exits.
-
sudo sdm --ppart raspios-image.imgPrints the partition tables in the IMG file.
-
sudo sdm --mount raspios-image.imgOR
sudo sdm --mount /dev/sdXMounts the IMG file (first example) or SD Card (second example) onto the running host system. This enables you to manually and easily copy files from the running host system into the IMG.
NOTE: BE VERY CAREFUL! When you use the
--mountcommand you're running as root with access to everything! If you copy or delete a file and neglect to prefix the file directory reference with /mnt/sdm you will modify your running system. -
sudo sdm --infowhat β Display one of the databases that specify timezones, locale, keymaps, and wifi-country. The what argument can be one oftime,locale,keymap, orwifi. The requested database is displayed with thelesscommand.--info helpwill display the list of options.
sdm has a broad set of command switches. These can be specified in any case (UPPER, lower, or MiXeD).
All files that you provide to sdm, whether on the command line or in arguments to a plugin, must use full paths. For instance, to use a file in your home directory, don't use file or ~/file, use /home/<mylogin>/file. Relative file paths may not work because the current directory in which any sdm function is running may change.
-
--1pibootconffile β Specify a 1piboot.conf file to use instead of the one in /usr/local/sdm/1piboot/1piboot.conf. -
--aptcacheIPaddr β Use APT caching. The argument is the IP address of the apt-cacher-ng server -
--apt-dist-upgradeβ Some RasPiOS Bullseye images have a strange software configuration, which causesapt-get upgradeto fail. This switch forces sdm to useapt-get --dist-upgradewhich updates correctly. [In the 2021-10-30 set of images, the "with Desktop" versions have a set of problematic VLC modules installed.] -
--apt-optionsvalue β Controls which functions will be performed by sdm-phase1.--apt-optionsand--poptionsare synonyms. Possible values include:- noautoremove β do not do an
apt autoremove - nologdates β do not include date/times in apt.log
- noupdate β do not do an
apt update - noupgrade β do not do an
apt upgrade - none β set noupdate,noupgrade,noautoremove specified
Enter multiple values as a single string separated by commas. For example
--poptions noupdate,noupgrade - noautoremove β do not do an
-
--autologinβ Cause the user to autologin when the system restarts -
--b0scriptscript β Call the functiondo_b0scriptin script when burning. script will be called after the output has been burned, and operates in effectively a Phase 0 environment. See Burn Scripts -
--b1scriptscript β Like--b0script, but is called in an nspawn container. See Burn Scripts -
--batchβ When customization completes do not drop to an interactive command prompt inside the nspawn container; instead, just exit -
--bootscriptsβ Directs sdm-firstboot to run the boot scripts in /usr/local/sdm/1piboot/0*-*.sh. If--bootscriptsis specified when creating the sdm-enhanced IMG, every SD Card burned will run the boot scripts on First Boot. If not specified on IMG creation, it can be also be specified when burning the SD Card to run the boot scripts on that SD Card. See First Boot Scripts and Congfigurations for further details. -
--bupdateitem β Used only on--burncommand. item can be plugin: Check and update plugins- Best to not include it always unless you know what you're doing
--bupdateis only honored on a burn command, and is not inspected during a customize command- This is very handy when you're in the process of developing a new plugin or updating an existing plugin
-
--chrootβ By default sdm usessystemd-nspawnto enter the container in Phase 1/post-install phases. Some (likely older) host OSes may have issues with that. Ifsystemd-nspawnfails with anexecveerror, retry the command and add--chroot. -
--convert-root fstype[,[+]size]β Use with--burnto create disks with eitherbtrfsorlvmrootfs. See Disks and Partitions -
--convert-root-mount-options "options"β Specify mount options for the converted rootfs. The options are passed tomount -owhen mounting the rootfs for the burn process. For example,--convert-root-mount-options "compress=zstd"to enable compression when burning to a btrfs. -
--cscriptscriptname β Specifies the path to your Custom Phase Script, which will be run as described in the Custom Phase Script section below. -
--csrc/path/to/csrcdir β A source directory string that can be used in your Custom Phase Script. One use for this is to have a directory tree where all your customizations are kept, and pass in the directory tree to sdm with--csrc. -
--custom[1-4]β 4 variables (custom1, custom2, custom3, and custom4) that can be used to further customize your Custom Phase Script. -
--datefmt "fmt"β Use the specified date format instead of the default "%Y-%m-%d %H:%M:%S". Seeman datefor format string details. -
--ddsw"switches" β Provide switches for theddcommand used with--burn. The default is "bs=16M iflag=direct". If--ddswis specified, it replaces the default value. -
--encryptedβ Use with the--exploreand--mountcommands to access encrypted disks. See Disk Encryption. -
--expand-at-bootβ The rootfs will be expanded when the system first boots. You must either use--regen-ssh-host-keysor--plugin sshhostkey:generate-keys. This switch is only supported with Trixie and later IMGs; however, the version is not checked. -
--expand-rootβ Used with--burn. Expands the root partition on the SSD/SD Card after burning, and disables the default (quick) first boot that does this, since sdm has already expanded the partition -
--extendβ Used in conjunction with the--xmbswitch to extend an image. If used without--customizethe IMG is extended but no other action is taken. If used with--customizethe IMG is extended before the IMG is customized. -
--extract-log/path/to/dir β Extract the log files /etc/sdm/apt.log and /etc/sdm/history from the device or IMG and save them in the specified directory -
--extract-script/path/to/script β Run the provided script when extracting log information. Can be used for correctness checking, etc. -
--gptβ Directs the--burncommand to set the burned disk to GPT partitions -
--groupsgrouplist β Specify the groups to be added to new users created with theuserplugin. The default list is:users,adm,dialout,audio,netdev,video,plugdev,cdrom,games,input,gpio,spi,i2c,render,sudo -
--hosthostname or--hostnamehostname β Specifies the name of the host to set onto the SD Card when burning it. -
--loadlocal wifiβ Starts a WiFi Captive Portal to obtain and test the WiFi Credentials during the First Boot. See Captive Portal for details. The flashled and internet options are not supported with--loadlocal wifi. -
--logwidthN β Set the maximum log line width before lines are split. Default is 96 characters. -
--norestartor--norebootβ Do not restart the system after the First Boot. This is useful if you set--restartwhen you build the image, but want to disable the automatic restart for a particular SD Card when you burn it. -
--nowait-timesyncβ Don't wait for the system time to sync in sdm FirstBoot -
--nspawnsw"switches" β Provide additional switches for the systemd-nspawn command. Seeman systemd-nspawn. -
--plugin plugin-name:"arguments"β Include the named plugin with its arguments. sdm interprets a plugin name that starts with "@" as a file containing a list of plugins to include See Plugins for complete plugin details -
--plugin-debugβ Enable additional debug printout in plugins (useful for plugin development) -
--poptionsvalue β See--apt-optionsabove for details.--apt-optionsand--poptionsare synonyms. -
--reboot nβ Restart the system at the end of the First Boot after waiting an additional n seconds. The-rebootswitch can be used on the command when customizing the IMG (will apply to all SD Cards) or on the--burncommand (will apply only to SD cards burned with--restartset. The system will not restart until the boot process has fully completed. Waiting an additional time may be useful if your system has services that take longer to start up on the first boot. sdm waits until n seconds (n=20 for `--restart) after the graphical or multi-user target is reached. -
--redactβ See Passwords for details. -
--redo-customizeβ Directs sdm to not prompt for confirmation to redo the customization on a target found to already be customized. -
--regen-ssh-host-keysβ The sdm FirstBoot process will regenerate the SSH host keys on the first system boot once the system time has been synchronized. This is useful so that the date/times on /etc/ssh-host* host keys are actual, eliminating potential future confusion. However, the system will move ahead and regenerate the keys if the time has not been synchronized within 60 seconds or if--nowait-timesync. -
--restartβ Restart the system at the end of the First Boot. The--restartswitch and--rebootare synonomous except that you cannot specify an additional restart wait with the--restartswitch. -
--runonly pluginsβ Only run plugins. If no device or directory specified, sdm defaults to directory '/' on the running system. -
--showaptβ Show the output from apt (Package Manager) on the terminal in Phase 1. By default, the output is not displayed on the terminal. All apt output is captured in /etc/sdm/apt.log in the IMG. -
--sdmdir/path/to β sdm normally is in /usr/local/sdm. If you want it to be put somewhere else when you customize an image, use this switch to specify the location. To install sdm itself into a different directory, specify it as the parameter toinstall-sdmwhen you first install sdm -
--update-pluginsβ Typically for sdm development use only. When plugins are used during an sdm burn, they are run from the copy in the source IMG. This switch causes sdm to look for newer updates on the host system, and update the burn target before running the plugins. -
--vncbasebase β Set the base port for VNC virtual desktops; RealVNC Console service is not changed. -
--wifi-countrycountryname β Specify the name of the country to use for the WiFi Country setting. See /usr/share/zoneinfo/iso3166.tab for the complete WiFi Country code list. Also see the--l10ncommand switch which will extract the current WiFi Country setting from /etc/wpa_supplicant/wpa_supplicant.conf or /etc/wpa_supplicant/wpa_supplicant-wlan0.conf on the system on which sdm is running. -
--xmbn β Specify the number of MB to extend the image. The default is 2048 (MB), which is 2GB. You may need to increase this depending on the number of packages you choose to install in Phase 1. If the image isn't large enough, package installations will fail. If the image is too large, it will consume more disk space, and burning the image to an SD Card will take longer.
For a list of switches can be used with --burn, see Burn Scripts. When used with --burn, they affect only the output SSD/SD Card, and not the IMG file.