apt get life

Life around technology

  • Technology
    • Guides
    • Linux
    • Development
      • Laravel
    • Misc
    • Raspberry Pi
  • Writing
  • Crafts
    • Crochet
    • Model Making
    • Painting
  • Privacy Policy
You are here: Home / Archives for Uncategorized

Customising Ubuntu Desktop 24.04

2024/12/14 by sudo Leave a Comment

This blog post aims to serve as a guide to anyone who is setting up Ubuntu Desktop 24.04. It will be split into sections incase you’re only interested in specific parts of the setup process, and follow up posts will cover setting up development tools.

Improvements to Ubuntu’s UI

While the default Ubuntu user interface is usable, I have grown up with Windows and Windows parallel user interfaces with the taskbar at the bottom of the screen. I don’t like installing lots of plugins (like dash to dock on gnome extensions, which I do recommend if you’re more used to Windows or Cinnamon style layouts). Instead I’ve opted to simply edit the preferences within Ubuntu Desktop to set the dock at the bottom of the screen.

Setting the dock to the bottom of the screen

This can be achieved by going to the settings and locating “Ubuntu Desktop” from the list on the left hand side. Then changing the “Position on Screen” to “bottom” and altering the icon size as desired.

Ubuntu Desktop Settings screenshot

Ubuntu Desktop Settings screenshot

Window tiling improvements

One additional enhancement that is worth while is “Tiling Shell” by domferr, which is available as a gnome extension.

Install gnome browser connector to browse and install gnome packages:

sudo apt-get install gnome-shell-extension-manager gnome-browser-connector

This can then be found in the system menu by searching for shell

From the tool, search for Tiling Shell by domferr and install it.Gnome Extension Manager "Search for extenions" screenDisable Ubuntu snapping from the shell extension manager, and enable tiling. a new menu appears top left on the task bar to select the window layout. Hot keys can be defined in the extension manager.Gnome Extension Manager installed extensions options screenThis also allows you to view and configure any options for the tiling manager, but by default the keybindings are super (windows key) + arrow keys. A new icon will appear at the top of the desktop, indicating windows in a tiled pattern. This lets you control what tiling option is currently enabled, as well as creating additional ones.

Tiling sell configuration screen, showing window position options.Tiling shell is a really neat little extension. Historically I’ve used gTile, also a gnome shell extension, but have found it a bit harder to setup – it is more flexible though.

Web Browsers and Plugins

Ubuntu Desktop 24.04 ships with Firefox as it’s default web browser. Firefox is one of the only open source browsers that is not based on the Chromium engine, used by Chromium, Chrome, Brave, etc. While it’s title position as the most used web browser is long lost to history, it is still highly recommended and there’s no reason to install another browser, unless you’re a web developer and need some additional browsers for testing. The only thing worth doing is installing some plugins.

Blocking adverts has become a default, given how obtrusive they have become. Firefox supports uBlock Origin and it is available from it’s own extensions site. To find it, open Firefox and enter “about:addons” in the address bar. This will take you to the extensions screen where you can “Find more add-ons” and search for it.

Firefox addons selection screen

There are other plugins for firefox which may be worth browsing through to see if you like the look of them. A password manager like BitWarden or LastPass may be useful, as may Privacy Badger or Facebook Container – both used to help maintain privacy.

 

Quality of Life Additional Software

Cleaning up old snaps

Annoyingly, Ubuntu’s snap ecosystem does not automatically remove old snaps when new versions are installed. While it’s not clear if there have been improvements in Ubuntu 24.04, certainly 22.04 needed a dedicated script to help clean up these old snaps. It seems reasonable to include the script on Ubuntu 24.04 just in case:

#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
    while read snapname revision; do
        snap remove "$snapname" --revision="$revision"
    done

This can then be executed as part of general system updates:

sudo apt-get update; sudo apt-get upgrade -y; sudo ~/clean_snaps.sh

 

Aliases

Lots of people use aliases in their shell to streamline commonly used commands or sets of commands, however I like to re-enforce my use of standard commands so I can be relatively systems agnostic. If I pick up work doing support on someone elses Linux system I am not fighting my own muscle memory using aliases that don’t exist. Should you wish to setup your own aliases, this can be done using the ~/.bash_aliases file.

Firewall

One final note on the base machine setup is that by default Ubuntu 24.04 (infact any Ubuntu version) does not start the system firewall by default. Usually it’s better to enable it, even if your machine does not have any ports open by default. This can be done simply with the following command:

sudo ufw enable

Filed Under: Guides, Linux, Technology, Uncategorized

Raspberry Pi Keyboard Mini Review

2022/09/10 by sudo Leave a Comment

The raspberry pi keyboard is small and compact, perfect for traveling with if you have a phone or tablet but want a physical qwerty keyboard that you can connect with a cable. The cable connection saves significant battery power compared to Bluetooth keyboards. The key spacing of the keyboard is reasonable, but it does feel somewhat cheap when compared to premium keyboards like he MX keys. It’s got a very plasticy feel to it and there’s some sloppy key movement which might put off some more professional typists. For small pieces of work or ones that don’t require significant speed it is tenable as a keyboard, but if you’re in it for typing speed and accuracy there’s just something about it that seems to slow you down.

The keyboard itself requires a reasonable amount of force to trigger key presses and it makes quite a lot of noise for a low profile keyboard. I was quite surprised by this and I’m not sure what about the mechanics and construction make it work in this way. Coming from an IBM model M you might feel quite at home with the stompy key presses but from something like the MX Keys as a more modern low profile example I would say my preferences lead towards the more premium keyboard. You can soft type with the keyboard but something about it, either the construction quality or key travel distance really makes me want to hard-press instead of gently touch each key.

The integrated USB hub makes the device slightly more interesting than most run of the mill keyboards. It has been quite useful when the keyboard is setup on a desktop PC or with a laptop with few USB ports It’s allowed quick insertion of USB drives and even the wireless dongle for my mouse. I would not say it is a killer feature though.

I’ve been able to use the Pi keyboard, using a micro-USB to USB-C shim with both my phone (Google Pixel) and tablet (Samsung s6 lite). It has worked well with Google Docs in particular, although the keyboard did need changed from English US to English GB layout to work with quote marks, etc.

Overall I’d rate the Raspberry pi keyboard with half marks, 5 out of 10. It’s not unpleasant to work on and entirely serviceable but it does leave me longing for a better keyboard when writing longer pieces and it does get a little bit tiring to type on with the key stomp. Good for it’s price range but nothing to write home about.

Filed Under: Review, Technology, Uncategorized Tagged With: keyboards, raspberry pi, review

Solving Error on statfs() system call with cAdvisor and Docker

2021/01/14 by sudo Leave a Comment

With a docker setup running with Prometheus node exporter and a docker container running cAdvisor, I’ve been seeing error messages similar to the following repeatedly appearing in syslog:

Jan 14 15:15:25 dockerserver-live prometheus-node-exporter[603]: time="2021-01-14T15:15:25Z" level=error msg="Error on statfs() system call for \"/var/lib/docker/containers/719fe4c20d2d274bb034e914006ecfe6760d8aec98efdc8010c85a01cf4059aa/mounts/shm\": permission denied" source="filesystem_linux.go:57"
Jan 14 16:23:25 dockerserver-live prometheus-node-exporter[28623]: time="2021-01-14T16:23:25Z" level=error msg="Error on statfs() system call for \"/var/lib/docker/overlay2/8c25cb3049b4cfc9bebfd4df0ea6104560155bed2c18a9bd75d21323931570f4/merged\": permission denied" source="filesystem_linux.go:57"

These errors are being generated by a Prometheus node exporter process running with the following args:

      --collector.diskstats.ignored-devices=^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$ \
      --collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run)($|/) \
      --collector.netdev.ignored-devices=^lo$ \
      --collector.textfile.directory=/var/lib/prometheus/node-exporter

I’m not sure where this block originally came from, but in our case it’s in /etc/defaults/prometheus-node-exporter and easily edited to fix the regular expressions. Specifcally, because there’s problems with permissions on the shm and overlay they can be added to the ignored-mount-point regular expression as below:

      --collector.diskstats.ignored-devices=^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$ \
      --collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run|var\/lib\/docker\/containers\/.*\/mounts\/shm|var\/lib\/docker\/overlay2\/.*\/merged)($|/) \
      --collector.netdev.ignored-devices=^lo$ \
      --collector.textfile.directory=/var/lib/prometheus/node-exporter

following this change and restarting the prometheus-node-exporter process stopped new entries appearing in our syslog as it should be ignoring both troublesome directories.

Filed Under: Docker, Linux, Technology, Uncategorized

MySQL in Docker for Local Development

2020/08/04 by sudo Leave a Comment

Outside of my standard docker-compose setup for Laravel, I find myself requiring one-off MySQL instances for short pieces of development, debugging or testing. Instead of building a whole container ecosystem to do this, if I can get away with it I simply run MySQL as a docker container, binding it to the local machine’s ports.

The MySQL docker container is available on docker hub https://hub.docker.com/_/mysql which provides some basic usage instructions. I’m going to outline how I use MySQL in docker for this one off work.

Almost everything I do is based on the older MySQL 5.7. That means I need to use that image specifically when running docker. In order to make sure my local container is up to date and ready and waiting for use I tend to run a docker pull command on my dev machine as soon as it’s setup.

docker pull mysql:5.7

Version information is available on the MySQL docker hub page if you need a different version of MySQL. Now that the docker image is held locally it’s much easier to just start up a container whenever you need it and it will not spend ages re-downloading.

Understanding the Basics of MySQL’s Docker Container

There’s a few things I do with my containers. Firstly I want to expose the container to the host machine. This allows database administration tools like MySQL Workbench or Datagrip to connect to the MySQL docker instance. It also allows code to talk to it, and often this is what I want to do. It’s important not to overlap these ports, but generally I don’t run a temporary MySQL container along side any development stacks or local installs so I bind to the default port (3306). To do this I add the -p 3306:3306 flag to the command. If you want to change the external port (the one you’re using to connect to MySQL inside docker), then change the port number before the colon (:) like so -p 1234:3306. This maps port 1234 on your machine to the docker containers port 3306 inside the container.

Next, a root password and default database should be created. You could skip database creation and do it later with the management tool of your choice, but I find this easier. There’s two environment variables to set and I usually pick a short, insecure password for MySQL’s root account as this is only a test locally and firewalled on my dev machine. -e MYSQL_ROOT_PASSWORD=toor sets the root password to “toor” (root backwards. This was a default on a few Linux distros for a while). Setting the default database is just as easy -e MYSQL_DATABASE=dev. In this case it’s creating a database called “dev”.

Finally, I tend to name the docker container so I can run it again easily if required. I do this long hand with --name mysql57 where “mysql57” is the name of the container I’m creating. You can name this per project if it makes more sense for you, but I do regularly delete and recreate this container as it’s outside my usual dev workflow and usually just for debugging/fixing something once.

Creating a Named MySQL Docker Container Exposed to the Host

Rolling it all together you can run this command to create a named MySQL 5.7 instance that is running in the background (-d).

docker run --name mysql57 -e MYSQL_ROOT_PASSWORD=toor -e MYSQL_DATABASE=dev -p 3306:3306 -d mysql:5.7

Restore Backups to a MySQL Docker Container

If you have a database backup you need to restore, then it’s reasonably easy to pass it into MySQL, although if it’s a big database then it can take some time to do. This can be done by using cat to read the backup file and feeding it into the MySQL docker container. If you’re a user who doesn’t have native docker permissions (like on Ubuntu, which requires sudo docker) then it may be best to change to a user that does have permissions (sudo -i to switch to root, then run the backup restore command).

cat database_backup.sql | docker exec -i mysql57 /usr/bin/mysql -u root --password=toor dev

Backing up a Database Inside MySQL’s Docker Container

If you need to backup your MySQL docker database from the container, you can do so by running the mysqldump command that the container has installed by default, passing it container name, username, password and database you’ve defined when creating the container and defining the output file to save the database dump to.

docker exec mysql57 /usr/bin/mysqldump -u root --password=toor dev > dev_backup.sql

Cleaning up

Once you’re done with your MySQL container, you can stop and delete it by running the following commands, making sure to replace the container name (“mysql57”) with the name of your container if you happened to change it:

docker stop mysql57
docker rm mysql57

That’s it! You’ve created a named docker container running MySQL 5.7. You’ve exposed it to the host machine using port binding and learned how to restore a database backup to it. It’s not as useful as a full docker-compose stack for development. If you’re interested in a docker-compose dev environment check out this article. It does, however give you quick and easy MySQL access when you just need to poke around a database.

Filed Under: Development, Docker, Linux, Technology, Uncategorized Tagged With: docker, mysql, mysql-server

Docker WordPress Increase PHP Max File Size

2020/07/21 by sudo 1 Comment

I’ve recently been working with WordPress inside docker containers and discovered that file uploads are limited to 2MB, the apache default when using the official WordPress docker image. I don’t know of any sites that I’ve worked on that can actually work with only 2MB (possibly that is an indication of how abused WordPress is to turn it into something beyond a simple blogging platform). This brief guide provides you with one possible way of increasing the WordPress maximum file upload size in docker.

Firstly, create an uploads.ini file, content is defined below

upload_max_filesize = 16M
post_max_size = 16M

Now either mount the file using volumes in docker, or using docker compose. Below is an example except using docker-compose

wordpress:
  image: wordpress:latest
  ports:
    - "80:80"
  volumes:
    - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
    - ./wp-content:/var/www/html/wp-content/

Filed Under: Docker, Guides, Technology, Uncategorized

  • 1
  • 2
  • Next Page »

Recent Posts

  • Disable iLO on HP Microserver Gen8
  • Ubuntu Desktop 24.04 Change Wallpaper Settings
  • Customising Ubuntu Desktop 24.04
  • Remove domains from Let’s Encrypt using Certbot
  • Install Jetbrains Toolbox on Ubuntu 22.04

Tags

API auditing crochet data recovery debian debudding development Dingo API docker email Getting started with Laravel 5 & Dingo API hard drive health HP Microserver KVM Laravel larvel 5 lenovo Linux Minion mint netgear nas networking network shares php PHP development Postfix raspberry pi review samba security SMART smartctl smartmontools smb testing traefik ubuntu ubuntu 18.04 ubuntu 20.04 ubuntu 22.04 ubuntu server vagrant Virtual machines xdebug xubuntu

© Copyright 2015 apt get life

 

Loading Comments...