{"id":79082,"date":"2026-11-17T01:54:50","date_gmt":"2026-11-17T01:54:50","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79082"},"modified":"2026-11-17T01:54:50","modified_gmt":"2026-11-17T01:54:50","slug":"linux-intermediate-06-systemd","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79082","title":{"rendered":"Linux Intermediate 06 \u2014 Boot, Services, Logs, and Timers"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1991\">Linux Intermediate category<\/a> \u00b7 Lesson 6 of 9<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>AI disclosure<\/strong> \u2014 AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Learning goal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Trace the boot-to-service path, inspect logs, and create a timer that runs a tiny user service.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concepts and setup<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Firmware loads a boot path, a bootloader typically loads the kernel, and the kernel starts the first userspace process. On a systemd system, targets group units. A unit can be loaded but inactive, or active without being enabled for the next boot. journalctl adds time and unit filters when you need evidence.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This recreates the site&#8217;s periodic shell-log idea using a systemd user timer. Use a VM with a working user session and user journal, not a bare container. Without user lingering, a user manager may stop after logout. Do not enable linger for this exercise.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Inspect boot and one service<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>ps -p 1 -o comm=\nsystemctl get-default\nsystemctl --failed --no-pager\njournalctl -b -n 3 --no-pager<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemd\nmulti-user.target\n0 loaded units listed.\nNov 16 14:00:05 labhost systemd[1]: Startup finished ...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Log access depends on permissions, and a desktop may show graphical.target. -b narrows logs to the current boot. Read the service&#8217;s exact unit before restarting it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Run and remove a user timer<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p ~\/.config\/systemd\/user\ncat &gt; ~\/.config\/systemd\/user\/oe-linux-tick.service &lt;&lt;'EOF'\n[Unit]\nDescription=Open Education Linux lab tick\n[Service]\nType=oneshot\nExecStart=\/usr\/bin\/echo linux-lab-tick\nEOF\ncat &gt; ~\/.config\/systemd\/user\/oe-linux-tick.timer &lt;&lt;'EOF'\n[Unit]\nDescription=Run Open Education tick once\n[Timer]\nOnActiveSec=5s\nAccuracySec=1s\nEOF\nsystemctl --user daemon-reload\nsystemctl --user start oe-linux-tick.timer\nsystemctl --user list-timers --all | grep oe-linux-tick\n# Wait about six seconds before running the following command.\njournalctl --user -u oe-linux-tick.service -n 5 --no-pager\nsystemctl --user stop oe-linux-tick.timer\nrm ~\/.config\/systemd\/user\/oe-linux-tick.{service,timer}\nsystemctl --user daemon-reload<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>... oe-linux-tick.timer oe-linux-tick.service\nNov 16 14:01:07 labhost echo[3100]: linux-lab-tick<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use the oe-linux-tick name only if no files by that name already exist. The timer triggers the same-base-name service. An inactive oneshot after successful completion is normal. For repeated scheduling, add a suitable recurring timer expression rather than a busy shell loop.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Questions only<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>What is the difference between active and enabled?<\/li>\n\n\n<li>Why run daemon-reload after writing a unit?<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Show current-boot logs for the system unit ssh.service.<\/li>\n\n\n<li>Why might an Ubuntu SSH unit name differ from a Red Hat-family one?<\/li>\n\n\n<li>Where do you look if a timer appears active but the intended command failed?<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Questions and answers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check answers<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>What is the difference between active and enabled?<\/strong><br><strong>Answer<\/strong> \u2014 Active means running or active in the unit&#8217;s defined sense now. Enabled means configured for start through an enablement relationship.<\/li>\n\n\n<li><strong>Why run daemon-reload after writing a unit?<\/strong><br><strong>Answer<\/strong> \u2014 It makes the manager reread changed unit definitions.<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment answer key<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Show current-boot logs for the system unit ssh.service.<\/strong><br><strong>Answer<\/strong> \u2014 journalctl -b -u ssh.service &#8211;no-pager. First confirm that ssh.service is the unit name on your system.<\/li>\n\n\n<li><strong>Why might an Ubuntu SSH unit name differ from a Red Hat-family one?<\/strong><br><strong>Answer<\/strong> \u2014 Distributions package services with different names. Discover them with systemctl list-unit-files &#8216;ssh*.service&#8217;.<\/li>\n\n\n<li><strong>Where do you look if a timer appears active but the intended command failed?<\/strong><br><strong>Answer<\/strong> \u2014 Check the matching service&#8217;s status and journal and inspect list-timers for the actual trigger.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Source articles on this site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=78691\">Q &amp; A:  Linux: Switch Users, Boot Process, File System<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=65712\">Log currently running shell processes into a file in every 30 seconds. #Linux\/Unix: Shell Programming \u2013 001<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=9949\">\u0987\u0989\u09a8\u09bf\u0995\u09cd\u09b8\u0983 \u09b8\u09bf\u09b8\u09cd\u099f\u09c7\u09ae \u09b2\u0997\u09bf\u0982 (Unix \u2013 System Logging)<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=78519\">Step by step DNS Server installation in ubuntu in a fresh VM<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Continue the course<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Previous lesson 05 \u2014 Package Managers and Repositories. Next lesson 07 \u2014 IP Addresses, Routes, and Name Resolution.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1991\">Linux Intermediate category<\/a> \u00b7 Lesson 6 of 9<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Trace the boot-to-service path, inspect logs, and create a timer that runs a tiny user service.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1991],"tags":[],"class_list":["post-79082","post","type-post","status-publish","format-standard","hentry","category-linux-intermediate","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":79102,"url":"http:\/\/bangla.sitestree.com\/?p=79102","url_meta":{"origin":79082,"position":0},"title":"Linux Administration Course \u2014 Start Here and Lesson Index","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"A 33-lesson Linux course from shell fundamentals to server administration, performance, and a recovery capstone.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79083,"url":"http:\/\/bangla.sitestree.com\/?p=79083","url_meta":{"origin":79082,"position":1},"title":"Linux Intermediate 07 \u2014 IP Addresses, Routes, and Name Resolution","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Separate the problems of link state, addressing, routing, name resolution, and listening services.","rel":"","context":"In &quot;Linux Intermediate&quot;","block_context":{"text":"Linux Intermediate","link":"http:\/\/bangla.sitestree.com\/?cat=1991"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79099,"url":"http:\/\/bangla.sitestree.com\/?p=79099","url_meta":{"origin":79082,"position":2},"title":"Linux Advanced 2 05 \u2014 Kernel Modules and Resource Limits","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Read kernel module information and identify the current process\u2019s resource-control group without changing the kernel.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79071,"url":"http:\/\/bangla.sitestree.com\/?p=79071","url_meta":{"origin":79082,"position":3},"title":"Linux Basics 03 \u2014 Editing Text and Reading Files","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Edit a text file in a terminal and verify the exact lines you saved.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79085,"url":"http:\/\/bangla.sitestree.com\/?p=79085","url_meta":{"origin":79082,"position":4},"title":"Linux Intermediate 09 \u2014 Block Devices, Filesystems, and Mounts","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Distinguish a block device from a filesystem and a mount point, and inspect each layer without changing it.","rel":"","context":"In &quot;Linux Intermediate&quot;","block_context":{"text":"Linux Intermediate","link":"http:\/\/bangla.sitestree.com\/?cat=1991"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79081,"url":"http:\/\/bangla.sitestree.com\/?p=79081","url_meta":{"origin":79082,"position":5},"title":"Linux Intermediate 05 \u2014 Package Managers and Repositories","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Inspect installed packages and repositories before taking action, and tell a package database from a dependency resolver.","rel":"","context":"In &quot;Linux Intermediate&quot;","block_context":{"text":"Linux Intermediate","link":"http:\/\/bangla.sitestree.com\/?cat=1991"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79082"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79082\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79082"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}